summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qlowenergycontroller_android.cpp
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@theqtcompany.com>2014-12-03 14:19:48 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2014-12-04 09:35:31 +0100
commit90491cb94b5aaad8c9aded106fea0aba09ac4be9 (patch)
treebe2e5bc76035a99932caf011e407813ab33ce31b /src/bluetooth/qlowenergycontroller_android.cpp
parent01ea948742b649ad482c2e3e6d914fc1ac5f4917 (diff)
Don't update cached char value when property is not readable
In addition we update the documentation to reflect the slightly changed API behavior. Change-Id: Ieddee750aa35a32d3c01213dfbf678ee2a1d88d7 Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_android.cpp')
-rw-r--r--src/bluetooth/qlowenergycontroller_android.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp
index 9be5cff0..e1b668ca 100644
--- a/src/bluetooth/qlowenergycontroller_android.cpp
+++ b/src/bluetooth/qlowenergycontroller_android.cpp
@@ -431,7 +431,10 @@ void QLowEnergyControllerPrivate::characteristicWritten(
return;
}
- updateValueOfCharacteristic(charHandle, data, false);
+ // only update cache when property is readable. Otherwise it remains
+ // empty.
+ if (characteristic.properties() & QLowEnergyCharacteristic::Read)
+ updateValueOfCharacteristic(charHandle, data, false);
emit service->characteristicWritten(characteristic, data);
}
@@ -479,7 +482,10 @@ void QLowEnergyControllerPrivate::characteristicChanged(
return;
}
- updateValueOfCharacteristic(characteristic.attributeHandle(),
+ // only update cache when property is readable. Otherwise it remains
+ // empty.
+ if (characteristic.properties() & QLowEnergyCharacteristic::Read)
+ updateValueOfCharacteristic(characteristic.attributeHandle(),
data, false);
emit service->characteristicChanged(characteristic, data);
}