7#include <QCoreApplication>
9#include <QtCore/QLoggingCategory>
10#include <QtCore/QRandomGenerator>
11#include <QtCore/QJniEnvironment>
29 qCDebug(QT_BT_ANDROID) <<
"Creating Android Peripheral/Server support for BTLE";
30 jBluetoothLe = QJniObject::construct<QtJniTypes::QtBtLEServer>(
31 QNativeInterface::QAndroidApplication::context());
33 qCDebug(QT_BT_ANDROID) <<
"Creating Android Central/Client support for BTLE";
35 QJniObject::fromString(remote.toString());
36 jBluetoothLe = QJniObject::construct<QtJniTypes::QtBtLECentral>(
37 address.object<jstring>(), QNativeInterface::QAndroidApplication::context());
40 if (!jBluetoothLe.isValid())
return;
47 if (!hubMap()->
contains(javaToCtoken))
51 hubMap()->insert(javaToCtoken,
this);
54 jBluetoothLe.setField<jlong>(
"qtObject", javaToCtoken);
60 hubMap()->remove(javaToCtoken);
80void LowEnergyNotificationHub::lowEnergy_mtuChanged(
81 JNIEnv *, jobject, jlong qtObject, jint mtu)
92void LowEnergyNotificationHub::lowEnergy_remoteRssiRead(JNIEnv *, jobject, jlong qtObject,
93 int rssi,
bool success)
107 JNIEnv *, jobject, jlong qtObject, jint errorCode, jstring uuidList)
122void LowEnergyNotificationHub::lowEnergy_serviceDetailsDiscovered(
123 JNIEnv *, jobject, jlong qtObject, jstring uuid, jint startHandle,
140void LowEnergyNotificationHub::lowEnergy_characteristicRead(
141 JNIEnv *env, jobject, jlong qtObject, jstring sUuid, jint
handle,
163 reinterpret_cast<signed char*
>(payload.
data()));
175void LowEnergyNotificationHub::lowEnergy_descriptorRead(
176 JNIEnv *env, jobject, jlong qtObject, jstring sUuid, jstring cUuid,
191 if (
charUuid.isNull() || descUuid.isNull())
199 reinterpret_cast<signed char*
>(payload.
data()));
211 JNIEnv *env, jobject, jlong qtObject, jint charHandle,
212 jbyteArray
data, jint errorCode)
225 reinterpret_cast<signed char*
>(payload.
data()));
235void LowEnergyNotificationHub::lowEnergy_descriptorWritten(
236 JNIEnv *env, jobject, jlong qtObject, jint descHandle,
237 jbyteArray
data, jint errorCode)
250 reinterpret_cast<signed char*
>(payload.
data()));
260void LowEnergyNotificationHub::lowEnergy_serverDescriptorWritten(
261 JNIEnv *env, jobject, jlong qtObject, QtJniTypes::BluetoothGattDescriptor descriptor,
275 reinterpret_cast<signed char*
>(payload.
data()));
283void LowEnergyNotificationHub::lowEnergy_characteristicChanged(
284 JNIEnv *env, jobject, jlong qtObject, jint charHandle, jbyteArray
data)
297 reinterpret_cast<signed char*
>(payload.
data()));
304void LowEnergyNotificationHub::lowEnergy_serverCharacteristicChanged(
305 JNIEnv *env, jobject, jlong qtObject,
306 QtJniTypes::BluetoothGattCharacteristic characteristic, jbyteArray newValue)
319 reinterpret_cast<signed char*
>(payload.
data()));
327void LowEnergyNotificationHub::lowEnergy_serviceError(
328 JNIEnv *, jobject, jlong qtObject, jint attributeHandle,
int errorCode)
343 JNIEnv *, jobject, jlong qtObject, jint status)
static void lowEnergy_advertisementError(JNIEnv *, jobject, jlong qtObject, jint status)
jlong QtJniTypes::BluetoothGattDescriptor descriptor
jlong jstring serviceUuid
jlong QtJniTypes::BluetoothGattCharacteristic characteristic
jlong jstring jstring jint jstring dUuid
jlong jstring jint jstring jint properties
jlong jint attributeHandle
static void lowEnergy_connectionChange(JNIEnv *, jobject, jlong qtObject, jint errorCode, jint newState)
static void lowEnergy_characteristicWritten(JNIEnv *, jobject, jlong qtObject, jint charHandle, jbyteArray data, jint errorCode)
jlong jstring jint jstring charUuid
~LowEnergyNotificationHub()
jlong QtJniTypes::BluetoothGattDescriptor jbyteArray newValue
jlong jstring jint jint endHandle
jlong jstring jstring cUuid
jlong jstring jint startHandle
static void lowEnergy_servicesDiscovered(JNIEnv *, jobject, jlong qtObject, jint errorCode, jstring uuidList)
jlong jint jbyteArray jint errorCode
char * data()
\macro QT_NO_CAST_FROM_BYTEARRAY
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
ControllerState
Indicates the state of the controller object.
Error
Indicates all possible error conditions found during the controller's existence.
ServiceError
This enum describes all possible error conditions during the service's existence.
quint32 generate()
Generates a 32-bit random quantity and returns it.
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
QT_BEGIN_NAMESPACE typedef QHash< long, LowEnergyNotificationHub * > HubMapType
Combined button and popup list for selecting options.
static const QCssKnownValue properties[NumProperties - 1]
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
#define Q_ARG(Type, data)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLuint64 GLenum void * handle
GLenum GLuint GLenum GLsizei length
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLuint64EXT address
char * toString(const MyType &t)
[31]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent