diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-11-18 08:50:54 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-11-24 15:08:57 +0100 |
commit | 6ed49688149fd43b3d4c5aa0415191a8c1cdc1a5 (patch) | |
tree | ae2a3ef1c4d5c5bcb5f6912ed874bcebf8977eed /src/bluetooth/qlowenergycontroller_android.cpp | |
parent | 5de53cc79ecb83e3bce97567b1462ce432cc5759 (diff) |
Android: characteristic changed notification support
Change-Id: I4c50df7d758390989c2e2127f7646e5d2dc34712
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.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp index a28feaf6..e2624a56 100644 --- a/src/bluetooth/qlowenergycontroller_android.cpp +++ b/src/bluetooth/qlowenergycontroller_android.cpp @@ -78,6 +78,8 @@ void QLowEnergyControllerPrivate::connectToDevice() this, &QLowEnergyControllerPrivate::characteristicWritten); connect(hub, &LowEnergyNotificationHub::descriptorWritten, this, &QLowEnergyControllerPrivate::descriptorWritten); + connect(hub, &LowEnergyNotificationHub::characteristicChanged, + this, &QLowEnergyControllerPrivate::characteristicChanged); } if (!hub->javaObject().isValid()) { @@ -432,4 +434,24 @@ void QLowEnergyControllerPrivate::descriptorWritten( emit service->descriptorWritten(descriptor, data); } +void QLowEnergyControllerPrivate::characteristicChanged( + int charHandle, const QByteArray &data) +{ + QSharedPointer<QLowEnergyServicePrivate> service = + serviceForHandle(charHandle); + if (service.isNull()) + return; + + qCDebug(QT_BT_ANDROID) << "Characteristic change notification" << service->uuid + << charHandle << data.toHex(); + + QLowEnergyCharacteristic characteristic = characteristicForHandle(charHandle); + if (!characteristic.isValid()) { + qCWarning(QT_BT_ANDROID) << "characteristicChanged: Cannot find characteristic"; + return; + } + + emit service->characteristicChanged(characteristic, data); +} + QT_END_NAMESPACE |