diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-12-03 15:18:02 +0100 |
---|---|---|
committer | Timur Pocheptsov <Timur.Pocheptsov@digia.com> | 2014-12-03 16:37:39 +0100 |
commit | eec48542c7de7e3e4b729268756f3bcf0c13fde0 (patch) | |
tree | 56163dca24febf2c287622ee8edba4e1c1989f1b /src | |
parent | ff28b5529c7620f57130f24ce4fd6d55ab49c0af (diff) |
Bluez: Do not update char value() if char is non-readable
Change-Id: Ia075bfb4174c7a2b90376b215f3366076d9ae1c9
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluez.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 55acfc36..63de6edb 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -908,8 +908,9 @@ void QLowEnergyControllerPrivate::processReply( const QByteArray newValue = request.reference2.toByteArray(); if (!descriptorHandle) { - updateValueOfCharacteristic(charHandle, newValue, NEW_VALUE); QLowEnergyCharacteristic ch(service, charHandle); + if (ch.properties() & QLowEnergyCharacteristic::Read) + updateValueOfCharacteristic(charHandle, newValue, NEW_VALUE); emit service->characteristicWritten(ch, newValue); } else { updateValueOfDescriptor(charHandle, descriptorHandle, newValue, NEW_VALUE); @@ -976,8 +977,9 @@ void QLowEnergyControllerPrivate::processReply( attrHandle, newValue, NEW_VALUE); emit service->descriptorWritten(descriptor, newValue); } else { - updateValueOfCharacteristic(attrHandle, newValue, NEW_VALUE); QLowEnergyCharacteristic ch(service, attrHandle); + if (ch.properties() & QLowEnergyCharacteristic::Read) + updateValueOfCharacteristic(attrHandle, newValue, NEW_VALUE); emit service->characteristicWritten(ch, newValue); } } @@ -1236,7 +1238,8 @@ void QLowEnergyControllerPrivate::processUnsolicitedReply(const QByteArray &payl const QLowEnergyCharacteristic ch = characteristicForHandle(changedHandle); if (ch.isValid() && ch.handle() == changedHandle) { - updateValueOfCharacteristic(ch.attributeHandle(), payload.mid(3), NEW_VALUE); + if (ch.properties() & QLowEnergyCharacteristic::Read) + updateValueOfCharacteristic(ch.attributeHandle(), payload.mid(3), NEW_VALUE); emit ch.d_ptr->characteristicChanged(ch, payload.mid(3)); } else { qCWarning(QT_BT_BLUEZ) << "Cannot find matching characteristic for " |