diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-07-07 14:06:47 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-07-13 09:07:46 +0000 |
commit | 06f04ba7aa619a722a6c4eaa11e49a1c0ed6a240 (patch) | |
tree | f85114215a4f1874b5509adf383a5669721e69de | |
parent | 381dcbd8f6f67883b0a7cc82a62380882e0c4ce3 (diff) |
Do not cut 32bit value down to 16bit
handledata contains a 16bit char handle in the lower bits and
may contains a 16bit descriptor handle in its upper 16 bits.
When doing blob read requests for descriptors the upper 16 bit
may be cut off and the descriptor read turns into a characteristic
read. In turn this switches the internal
state of the service discovery state machine causing an endless loop
between descriptor and characteristic reads.
Change-Id: Ia66f230e8fb018da51c3ce32db936d02a0b195b8
Task-number: QTBUG-47028
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluez.cpp | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_p.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 0654bda1..a35545b0 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -1222,7 +1222,7 @@ void QLowEnergyControllerPrivate::readServiceValues( starting the next read request. */ void QLowEnergyControllerPrivate::readServiceValuesByOffset( - quint16 handleData, quint16 offset, bool isLastValue) + uint handleData, quint16 offset, bool isLastValue) { const QLowEnergyHandle charHandle = (handleData & 0xffff); const QLowEnergyHandle descriptorHandle = ((handleData >> 16) & 0xffff); diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h index bb26a538..810f0ff4 100644 --- a/src/bluetooth/qlowenergycontroller_p.h +++ b/src/bluetooth/qlowenergycontroller_p.h @@ -173,7 +173,7 @@ private: void sendReadValueRequest(QLowEnergyHandle attributeHandle, bool isDescriptor); void readServiceValues(const QBluetoothUuid &service, bool readCharacteristics); - void readServiceValuesByOffset(quint16 handleData, quint16 offset, + void readServiceValuesByOffset(uint handleData, quint16 offset, bool isLastValue); void discoverServiceDescriptors(const QBluetoothUuid &serviceUuid); |