summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-04 14:37:37 +0100
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-12-05 08:50:28 +0100
commita7e67ace12d71162583b00b306060d21ad0a5580 (patch)
treed7f3529add3c9e9f4a89c33370f90f5a5dada336 /src
parentffbb91da8e8f14d7d5ffa8bbeace3e6c42eb525b (diff)
Client characteristic configuration (OS X and iOS)
If client characteristic configuration descriptor has an indication/notification bit set - enable ("automatically" == no explicit user's request) notifications. Change-Id: I839aabd6f5513141f66c8e4467618b3edd523350 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/osx/osxbtcentralmanager.mm5
-rw-r--r--src/bluetooth/qlowenergycontroller_osx.mm7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/bluetooth/osx/osxbtcentralmanager.mm b/src/bluetooth/osx/osxbtcentralmanager.mm
index 73d9d5bc..733d73a6 100644
--- a/src/bluetooth/osx/osxbtcentralmanager.mm
+++ b/src/bluetooth/osx/osxbtcentralmanager.mm
@@ -530,6 +530,11 @@ using namespace QT_NAMESPACE;
newDesc.uuid = qt_uuid(d.UUID);
newDesc.value = qt_bytearray(static_cast<NSObject *>(d.value));
descList[lastValidHandle] = newDesc;
+ // Check, if it's client characteristic configuration descriptor:
+ if (newDesc.uuid == QBluetoothUuid::ClientCharacteristicConfiguration) {
+ if (newDesc.value.size() && (newDesc.value[0] & 3))
+ [peripheral setNotifyValue:YES forCharacteristic:c];
+ }
}
newChar.descriptorList = descList;
diff --git a/src/bluetooth/qlowenergycontroller_osx.mm b/src/bluetooth/qlowenergycontroller_osx.mm
index ea22ac36..cde11f67 100644
--- a/src/bluetooth/qlowenergycontroller_osx.mm
+++ b/src/bluetooth/qlowenergycontroller_osx.mm
@@ -344,8 +344,11 @@ void QLowEnergyControllerPrivateOSX::characteristicUpdateNotification(QLowEnergy
ServicePrivate service(serviceForHandle(charHandle));
if (service.isNull()) {
- qCWarning(QT_BT_OSX) << "QLowEnergyControllerPrivateOSX::characteristicUpdateNotification(), "
- "can not find service for characteristic handle " << charHandle;
+ // This can be an error (no characteristic found for this handle),
+ // it can also be that we set notify value before the service
+ // was reported (serviceDetailsDiscoveryFinished) - this happens,
+ // if we read a descriptor (characteristic client configuration),
+ // and it's (pre)set.
return;
}