diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-07 03:07:09 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-03-07 03:07:09 +0100 |
commit | 35fe7d452d5b85eabe1c3ec9d09019fe4f3e2d2e (patch) | |
tree | 528d85e9b75e8450295a259e05266a834780642d /src/bluetooth/qlowenergycontroller_bluezdbus.cpp | |
parent | 531443d1f00c0ebc6a56ebc30e5eea85b318b73e (diff) | |
parent | 58e0224a6677667b1102b34ad5b35a787bd74077 (diff) |
Merge remote-tracking branch 'origin/5.14' into 5.15v5.15.0-beta4v5.15.0-beta3v5.15.0-beta2
Change-Id: I037246140f5c52dde3335952d4bf77e43b1c3503
Diffstat (limited to 'src/bluetooth/qlowenergycontroller_bluezdbus.cpp')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluezdbus.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp index 5dde8774..d69fb6cd 100644 --- a/src/bluetooth/qlowenergycontroller_bluezdbus.cpp +++ b/src/bluetooth/qlowenergycontroller_bluezdbus.cpp @@ -851,7 +851,7 @@ void QLowEnergyControllerPrivateBluezDBus::onCharWriteFinished(QDBusPendingCallW updateValueOfCharacteristic(nextJob.handle, nextJob.value, false); QLowEnergyCharacteristic ch(service, nextJob.handle); - // write without respone implies zero feedback + // write without response implies zero feedback if (nextJob.writeMode == QLowEnergyService::WriteWithResponse) { qCDebug(QT_BT_BLUEZ) << "Written Char:" << charData.uuid << nextJob.value.toHex(); emit service->characteristicWritten(ch, nextJob.value); @@ -971,7 +971,12 @@ void QLowEnergyControllerPrivateBluezDBus::scheduleNextJob() if (charData.uuid != QBluetoothUuid(gattChar.characteristic->uUID())) continue; - QDBusPendingReply<> reply = gattChar.characteristic->WriteValue(nextJob.value, QVariantMap()); + QVariantMap options; + // The "type" option only works with BlueZ >= 5.50, older versions always write with response + options[QStringLiteral("type")] = nextJob.writeMode == QLowEnergyService::WriteWithoutResponse ? + QStringLiteral("command") : QStringLiteral("request"); + QDBusPendingReply<> reply = gattChar.characteristic->WriteValue(nextJob.value, options); + QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, &QLowEnergyControllerPrivateBluezDBus::onCharWriteFinished); |