diff options
author | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-11-11 14:25:34 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2014-11-12 15:59:25 +0100 |
commit | 720137353b3d6ecb6a07d1f5486ab20306be8134 (patch) | |
tree | abd069d6d6dc057b45df81146795e6287735950d /src/bluetooth/qlowenergycontroller_android.cpp | |
parent | 2f4269da610083795440545c7f191eea1c9c3c4c (diff) |
Fix intermittent failure when mapping handles to services
startHandle and endHandle were randomly initialized and thus
QLowEnergyControllerPrivate::serviceForHandle(..) failed at the same
rate.
In addition this adds a few debug logs which turned out useful when
debugging the above issue.
Change-Id: I41b65274213a66fa100d8c69bba02be0bb876b65
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 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_android.cpp b/src/bluetooth/qlowenergycontroller_android.cpp index 4f8bfc5e..3891bb5b 100644 --- a/src/bluetooth/qlowenergycontroller_android.cpp +++ b/src/bluetooth/qlowenergycontroller_android.cpp @@ -166,6 +166,8 @@ void QLowEnergyControllerPrivate::writeCharacteristic( bool result = false; if (hub) { + qCDebug(QT_BT_ANDROID) << "Write characteristic with handle " << charHandle + << newValue.toHex() << "(service:" << service->uuid << ")"; result = hub->javaObject().callMethod<jboolean>("writeCharacteristic", "(I[B)Z", charHandle, payload); } @@ -271,7 +273,7 @@ void QLowEnergyControllerPrivate::serviceDetailsDiscoveryFinished( pointer->endHandle = endHandle; qCDebug(QT_BT_ANDROID) << "Service" << serviceUuid << "discovered (start:" - << startHandle << "end:" << endHandle << ")"; + << startHandle << "end:" << endHandle << ")" << pointer.data(); pointer->setState(QLowEnergyService::ServiceDiscovered); } @@ -338,6 +340,10 @@ void QLowEnergyControllerPrivate::characteristicWritten( if (service.isNull()) return; + + qCDebug(QT_BT_ANDROID) << "Characteristic write confirmation" << service->uuid + << charHandle << data.toHex() << errorCode; + if (errorCode != QLowEnergyService::NoError) { service->setError(errorCode); return; |