From 86c78d21adb28512c823e3d63a1e379e0fd2ab61 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 27 Jun 2020 17:14:03 -0700 Subject: [PATCH] core/BLE: debug output for characteristics we read/write Signed-off-by: Dirk Hohndel --- core/qt-ble.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/qt-ble.cpp b/core/qt-ble.cpp index 7aec38b4e..2c9c00620 100644 --- a/core/qt-ble.cpp +++ b/core/qt-ble.cpp @@ -410,6 +410,19 @@ dc_status_t BLEObject::select_preferred_service(void) return DC_STATUS_IO; } + bool hasread = false; + bool haswrite = false; + foreach (const QLowEnergyCharacteristic &c, preferred->characteristics()) { + if (is_read_characteristic(c) && !hasread) { + qDebug() << " Reading from " << c.uuid(); + hasread = true; + } + if (is_write_characteristic(c) && !haswrite) { + qDebug() << " Writing to " << c.uuid(); + haswrite = true; + } + } + connect(preferred, &QLowEnergyService::stateChanged, this, &BLEObject::serviceStateChanged); connect(preferred, &QLowEnergyService::characteristicChanged, this, &BLEObject::characteristcStateChanged); connect(preferred, &QLowEnergyService::characteristicWritten, this, &BLEObject::characteristicWritten);