summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/qt-ble.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp
index eca615fbe..92a78ae65 100644
--- a/core/qt-ble.cpp
+++ b/core/qt-ble.cpp
@@ -382,8 +382,19 @@ dc_status_t qt_ble_open(dc_custom_io_t *io, dc_context_t *context, const char *d
qDebug() << "Descriptor:" << d.name() << "uuid:" << d.uuid().toString();
if (!l.isEmpty()) {
- d = l.first();
- qDebug() << "now writing \"0x0100\" to the first descriptor";
+ bool foundCCC = false;
+ foreach (d, l) {
+ if (d.type() == QBluetoothUuid::ClientCharacteristicConfiguration) {
+ // pick the correct characteristic
+ foundCCC = true;
+ break;
+ }
+ }
+ if (!foundCCC)
+ // if we didn't find a ClientCharacteristicConfiguration, try the first one
+ d = l.first();
+
+ qDebug() << "now writing \"0x0100\" to the descriptor" << d.uuid().toString();
ble->preferredService()->writeDescriptor(d, QByteArray::fromHex("0100"));
}