diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-11-25 10:46:37 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-11-26 14:52:24 +0100 |
commit | 0e3046f29b0e86affeb33c8f6687618cfd1dfae2 (patch) | |
tree | 418db3d38304a8431dc2205c2e6e6cd2c5a0866c | |
parent | be750788c7f5276b0a8686e1f11bf4ca12ee9231 (diff) |
Fix missing update of cached characteristic value
When we receive a characteristic update we have to update the cached
value on the Qt side. This was accidentally missed during an earlier
commit.
Change-Id: I0f84e35ee44e38d1e46b7ddcd4e78b7e216e49d5
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r-- | src/bluetooth/qlowenergycontroller_android.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp index e2624a56..16298c96 100644 --- a/src/bluetooth/qlowenergycontroller_android.cpp +++ b/src/bluetooth/qlowenergycontroller_android.cpp @@ -451,6 +451,8 @@ void QLowEnergyControllerPrivate::characteristicChanged( return; } + updateValueOfCharacteristic(characteristic.attributeHandle(), + data, false); emit service->characteristicChanged(characteristic, data); } diff --git a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp index a91f8096..67ae1872 100644 --- a/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp +++ b/tests/auto/qlowenergycontroller/tst_qlowenergycontroller.cpp @@ -1858,6 +1858,13 @@ void tst_QLowEnergyController::tst_writeDescriptor() const QLowEnergyCharacteristic ch = entry[0].value<QLowEnergyCharacteristic>(); QCOMPARE(tempData, ch); + + //check last characteristic changed value matches the characteristics current value + if (i == (charChangedSpy.count() - 1)) { + writtenValue = entry[1].toByteArray(); + QCOMPARE(ch.value(), writtenValue); + QCOMPARE(tempData.value(), writtenValue); + } } service->writeCharacteristic(tempConfig, QByteArray::fromHex("00")); |