summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2019-03-15 13:42:17 +0100
committerOliver Wolff <oliver.wolff@qt.io>2019-03-19 09:50:43 +0000
commit4747a72d9a69f53760793ce0c0bb0154e43eca45 (patch)
tree031777613354dfcb99e6a3916983df1840cf4d35
parented4f9f3c4354d4f65318832eadaf0cfc5c288404 (diff)
winrt: Fix notifications in Bluetooth LE
We have to register callbacks for every indicatable characteristics we encounter during lookup so we have to store our list for the whole lookup period. Previously the list of indicatable characteristics was recreated in every "Completed" handler of Characteristic::GetDescriptorsAsync. The result was, that at most 1 indicatable characteristic was found. That behavior is wrong and we have to store the list of indicatable characteristics through the whole obtainCharList call. Fixes: QTBUG-74394 Change-Id: Ie93d9bd0184686d2d7cf9b082e85cf89ca5493ce Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/bluetooth/qlowenergycontroller_winrt_new.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/bluetooth/qlowenergycontroller_winrt_new.cpp b/src/bluetooth/qlowenergycontroller_winrt_new.cpp
index df00d4c8..95acfbb9 100644
--- a/src/bluetooth/qlowenergycontroller_winrt_new.cpp
+++ b/src/bluetooth/qlowenergycontroller_winrt_new.cpp
@@ -138,7 +138,7 @@ public:
public slots:
void obtainCharList()
{
- QVector<QBluetoothUuid> indicateChars;
+ mIndicateChars.clear();
quint16 startHandle = 0;
quint16 endHandle = 0;
qCDebug(QT_BT_WINRT) << __FUNCTION__;
@@ -146,7 +146,7 @@ public slots:
HRESULT hr = mDeviceService->GetAllCharacteristics(&characteristics);
Q_ASSERT_SUCCEEDED(hr);
if (!characteristics) {
- emit charListObtained(mService, mCharacteristicList, indicateChars, startHandle, endHandle);
+ emit charListObtained(mService, mCharacteristicList, mIndicateChars, startHandle, endHandle);
QThread::currentThread()->quit();
return;
}
@@ -235,7 +235,6 @@ public slots:
charData.value = byteArrayFromGattResult(readResult);
}
- QVector<QBluetoothUuid> indicateChars;
ComPtr<IVectorView<GattDescriptor *>> descriptors;
ComPtr<IGattCharacteristic2> characteristic2;
@@ -289,7 +288,7 @@ public slots:
descData.value = QByteArray(2, Qt::Uninitialized);
qToLittleEndian(result, descData.value.data());
- indicateChars << charData.uuid;
+ mIndicateChars << charData.uuid;
} else {
ComPtr<IAsyncOperation<GattReadResult *>> readOp;
hr = descriptor->ReadValueWithCacheModeAsync(BluetoothCacheMode_Uncached,
@@ -309,7 +308,7 @@ public slots:
mCharacteristicList.insert(handle, charData);
mCharacteristicsCountToBeDiscovered--;
if (mCharacteristicsCountToBeDiscovered == 0) {
- emit charListObtained(mService, mCharacteristicList, indicateChars,
+ emit charListObtained(mService, mCharacteristicList, mIndicateChars,
mStartHandle, mEndHandle);
QThread::currentThread()->quit();
}
@@ -326,6 +325,7 @@ public:
uint mCharacteristicsCountToBeDiscovered;
quint16 mStartHandle = 0;
quint16 mEndHandle = 0;
+ QVector<QBluetoothUuid> mIndicateChars;
signals:
void charListObtained(const QBluetoothUuid &service, QHash<QLowEnergyHandle,