diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-01 09:14:36 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-01 09:14:42 +0200 |
commit | 60d1ebac9e81619a24e66fc6defc3e0299491a9d (patch) | |
tree | 39cc5bfb0f6f5b22b0d0a2e71d92ac7e9e69d0e7 | |
parent | 22bffc8c5927d2a6e6b50b05bb6c9db2bc0c7e15 (diff) | |
parent | 71a0d199a29001cc31bfde15aabcc53cf88aae1e (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I64352b6cc066255972874e2f9c28abff35f0d613
-rw-r--r-- | examples/bluetooth/heartlistener/heartrate.cpp | 10 | ||||
-rw-r--r-- | src/bluetooth/android/jni_android.cpp | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdeviceinfo.cpp | 7 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdeviceinfo.h | 2 | ||||
-rw-r--r-- | src/nfc/android/androidjninfc.cpp | 5 | ||||
-rw-r--r-- | src/nfc/qllcpserver_android_p.cpp | 4 | ||||
-rw-r--r-- | src/nfc/qllcpserver_android_p.h | 1 |
7 files changed, 28 insertions, 6 deletions
diff --git a/examples/bluetooth/heartlistener/heartrate.cpp b/examples/bluetooth/heartlistener/heartrate.cpp index 08433195..7077bf1c 100644 --- a/examples/bluetooth/heartlistener/heartrate.cpp +++ b/examples/bluetooth/heartlistener/heartrate.cpp @@ -234,8 +234,10 @@ void HeartRate::disconnectService() return; } - //disable notifications - if (m_notificationDesc.isValid() && m_service) { + //disable notifications before disconnecting + if (m_notificationDesc.isValid() && m_service + && m_notificationDesc.value() == QByteArray::fromHex("0100")) + { m_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0000")); } else { m_control->disconnectFromDevice(); @@ -266,7 +268,7 @@ void HeartRate::serviceStateChanged(QLowEnergyService::ServiceState s) break; } - const QLowEnergyDescriptor m_notificationDesc = hrChar.descriptor( + m_notificationDesc = hrChar.descriptor( QBluetoothUuid::ClientCharacteristicConfiguration); if (m_notificationDesc.isValid()) { m_service->writeDescriptor(m_notificationDesc, QByteArray::fromHex("0100")); @@ -333,7 +335,7 @@ void HeartRate::updateHeartRateValue(const QLowEnergyCharacteristic &c, void HeartRate::confirmedDescriptorWrite(const QLowEnergyDescriptor &d, const QByteArray &value) { - if (d.isValid() && d == m_notificationDesc && value == QByteArray("0000")) { + if (d.isValid() && d == m_notificationDesc && value == QByteArray::fromHex("0000")) { //disabled notifications -> assume disconnect intent m_control->disconnectFromDevice(); delete m_service; diff --git a/src/bluetooth/android/jni_android.cpp b/src/bluetooth/android/jni_android.cpp index b48cd21f..95011c6c 100644 --- a/src/bluetooth/android/jni_android.cpp +++ b/src/bluetooth/android/jni_android.cpp @@ -284,6 +284,11 @@ static bool registerNatives(JNIEnv *env) Q_BLUETOOTH_EXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/) { + static bool initialized = false; + if (initialized) + return JNI_VERSION_1_6; + initialized = true; + typedef union { JNIEnv *nativeEnvironment; void *venv; diff --git a/src/bluetooth/qbluetoothdeviceinfo.cpp b/src/bluetooth/qbluetoothdeviceinfo.cpp index 6f1ab4ae..41f77153 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.cpp +++ b/src/bluetooth/qbluetoothdeviceinfo.cpp @@ -504,7 +504,12 @@ QBluetoothDeviceInfo::MajorDeviceClass QBluetoothDeviceInfo::majorDeviceClass() } /*! - Returns the minor device class of the device. + Returns the minor device class of the device. The actual information + is context dependent on the value of \l majorDeviceClass(). + + \sa MinorAudioVideoClass, MinorComputerClass, MinorHealthClass, MinorImagingClass, + MinorMiscellaneousClass, MinorNetworkClass, MinorPeripheralClass, MinorPhoneClass, + MinorToyClass, MinorWearableClass */ quint8 QBluetoothDeviceInfo::minorDeviceClass() const { diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h index 2cf26a21..751c8384 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.h +++ b/src/bluetooth/qbluetoothdeviceinfo.h @@ -58,7 +58,7 @@ public: MiscellaneousDevice = 0, ComputerDevice = 1, PhoneDevice = 2, - LANAccessDevice = 3, + LANAccessDevice = 3, // TODO Qt 6 rename to NetworkDevice -> inconsistency with MinorNetworkClass AudioVideoDevice = 4, PeripheralDevice = 5, ImagingDevice = 6, diff --git a/src/nfc/android/androidjninfc.cpp b/src/nfc/android/androidjninfc.cpp index 671811c3..4adb6f21 100644 --- a/src/nfc/android/androidjninfc.cpp +++ b/src/nfc/android/androidjninfc.cpp @@ -96,6 +96,11 @@ QT_END_ANDROIDNFC_NAMESPACE Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/) { + static bool initialized = false; + if (initialized) + return JNI_VERSION_1_6; + initialized = true; + JNIEnv* env; if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) { return -1; diff --git a/src/nfc/qllcpserver_android_p.cpp b/src/nfc/qllcpserver_android_p.cpp index 8055782b..eb0306a0 100644 --- a/src/nfc/qllcpserver_android_p.cpp +++ b/src/nfc/qllcpserver_android_p.cpp @@ -47,6 +47,10 @@ QLlcpServerPrivate::QLlcpServerPrivate(QLlcpServer *q) { } +QLlcpServerPrivate::~QLlcpServerPrivate() +{ +} + bool QLlcpServerPrivate::listen(const QString &/*serviceUri*/) { /*//The server is already listening diff --git a/src/nfc/qllcpserver_android_p.h b/src/nfc/qllcpserver_android_p.h index 32e6259c..5d5e2aea 100644 --- a/src/nfc/qllcpserver_android_p.h +++ b/src/nfc/qllcpserver_android_p.h @@ -61,6 +61,7 @@ class QLlcpServerPrivate : public QObject Q_OBJECT public: QLlcpServerPrivate(QLlcpServer *q); + ~QLlcpServerPrivate(); bool listen(const QString &serviceUri); bool isListening() const; |