From a7058305027bb4b2c48f003d06e999de3dc514a9 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Fri, 18 Oct 2019 12:22:54 +0200 Subject: [PATCH] clean up some commented out code --- eq-3/eqivabluetooth.cpp | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/eq-3/eqivabluetooth.cpp b/eq-3/eqivabluetooth.cpp index 7fdc9482..9ae727ec 100644 --- a/eq-3/eqivabluetooth.cpp +++ b/eq-3/eqivabluetooth.cpp @@ -11,6 +11,7 @@ const QBluetoothUuid eqivaCommandServiceUuid = QBluetoothUuid(QString("{3e135142 //I | EQ3: C: --> {3fa4585a-ce4a-3bad-db4b-b8df8179ea09} (Handle 0x411 Name: ): 0313091e0b2936000000000000000000  )6 //I | EQ3: C: --> {d0e8434d-cd29-0996-af41-6c90f4e0eb2a} (Handle 0x421 Name: ): 00000000000000000000000000000000 //I | EQ3: D: --> {00002902-0000-1000-8000-00805f9b34fb} (Handle 0x430 Name: Client Characteristic Configuration): 0100 + const QBluetoothUuid eqivaGapServiceUuid = QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb")); //I | EQ3: Service discovered: "Generic Access" "{00001800-0000-1000-8000-00805f9b34fb}" //I | EQ3: C: --> {00002a00-0000-1000-8000-00805f9b34fb} (Handle 0x111 Name: GAP Device Name): 43432d52542d424c45CC-RT-BLE @@ -18,14 +19,17 @@ const QBluetoothUuid eqivaGapServiceUuid = QBluetoothUuid(QString("00001800-0000 //I | EQ3: C: --> {00002a02-0000-1000-8000-00805f9b34fb} (Handle 0x131 Name: GAP Peripheral Privacy Flag): 00 //I | EQ3: C: --> {00002a03-0000-1000-8000-00805f9b34fb} (Handle 0x141 Name: GAP Reconnection Address): //I | EQ3: C: --> {00002a04-0000-1000-8000-00805f9b34fb} (Handle 0x151 Name: GAP Peripheral Preferred Connection Parameters): 0000000000000000 + const QBluetoothUuid eqivaGattServiceUuid = QBluetoothUuid(QString("00001801-0000-1000-8000-00805f9b34fb")); //I | EQ3: Service discovered: "Generic Attribute" "{00001801-0000-1000-8000-00805f9b34fb}" //I | EQ3: C: --> {00002a05-0000-1000-8000-00805f9b34fb} (Handle 0x211 Name: GATT Service Changed): 00000000 //I | EQ3: D: --> {00002902-0000-1000-8000-00805f9b34fb} (Handle 0x220 Name: Client Characteristic Configuration): 0200 + const QBluetoothUuid eqivaDeviceInfoServiceUuid = QBluetoothUuid(QString("0000180a-0000-1000-8000-00805f9b34fb")); //I | EQ3: Service discovered: "Device Information" "{0000180a-0000-1000-8000-00805f9b34fb}" //I | EQ3: C: --> {00002a29-0000-1000-8000-00805f9b34fb} (Handle 0x311 Name: Manufacturer Name String): 65712d33eq-3 //I | EQ3: C: --> {00002a24-0000-1000-8000-00805f9b34fb} (Handle 0x321 Name: Model Number String): 43432d52542d424c45CC-RT-BLE + const QBluetoothUuid eqivaUnknownServiceUuid = QBluetoothUuid(QString("9e5d1e47-5c13-43a0-8635-82ad38a1386f")); //I | EQ3: Service discovered: "Unknown Service" "{9e5d1e47-5c13-43a0-8635-82ad38a1386f}" //I | EQ3: C: --> {e3dd50bf-f7a7-4e99-838e-570a086c666b} (Handle 0xff02 Name: ): @@ -249,7 +253,8 @@ void EqivaBluetooth::controllerStateChanged(const QLowEnergyController::Controll } - // DEBUG + // DEBUG: Enabling this will read all the services and their characteristics and print them out. + // qCDebug(dcEQ3()) << m_name << "Discovered: Service UUIDS:" << m_bluetoothDevice->serviceUuids(); // QBluetoothUuid uuid = QBluetoothUuid(QString("{3e135142-654f-9090-134a-a6ff5bb77046}")); //// QBluetoothUuid uuid = QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb")); @@ -273,9 +278,6 @@ void EqivaBluetooth::controllerStateChanged(const QLowEnergyController::Controll //// service->readCharacteristic(characteristic); // } -// }); -// connect(service, &QLowEnergyService::characteristicRead, this, [service](const QLowEnergyCharacteristic &info, const QByteArray &value){ -// qCDebug(dcEQ3()) << "Characteristic read:" << info.name() << info.uuid() << value.toHex(); // }); // return; @@ -335,13 +337,13 @@ void EqivaBluetooth::serviceStateChanged(QLowEnergyService::ServiceState newStat } qCDebug(dcEQ3()) << m_name << "Service details discovered"; - foreach (const QLowEnergyCharacteristic &characteristic, m_eqivaService->characteristics()) { - qCDebug(dcEQ3()).nospace().noquote() << "C: --> " << characteristic.uuid().toString() << " (Handle 0x" << QString("%1").arg(characteristic.handle(), 0, 16) << " Name: " << characteristic.name() << "): " << characteristic.value().toHex() << characteristic.value(); - foreach (const QLowEnergyDescriptor &descriptor, characteristic.descriptors()) { - qCDebug(dcEQ3()).nospace().noquote() << "D: --> " << descriptor.uuid().toString() << " (Handle 0x" << QString("%2").arg(descriptor.handle(), 0, 16) << " Name: " << descriptor.name() << "): " << descriptor.value().toHex() << characteristic.value(); - } -// m_eqivaService->readCharacteristic(characteristic); - } + // DEBUG +// foreach (const QLowEnergyCharacteristic &characteristic, m_eqivaService->characteristics()) { +// qCDebug(dcEQ3()).nospace().noquote() << "C: --> " << characteristic.uuid().toString() << " (Handle 0x" << QString("%1").arg(characteristic.handle(), 0, 16) << " Name: " << characteristic.name() << "): " << characteristic.value().toHex() << characteristic.value(); +// foreach (const QLowEnergyDescriptor &descriptor, characteristic.descriptors()) { +// qCDebug(dcEQ3()).nospace().noquote() << "D: --> " << descriptor.uuid().toString() << " (Handle 0x" << QString("%2").arg(descriptor.handle(), 0, 16) << " Name: " << descriptor.name() << "): " << descriptor.value().toHex() << characteristic.value(); +// } +// } m_available = true; m_reconnectAttempt = 0; @@ -352,15 +354,11 @@ void EqivaBluetooth::serviceStateChanged(QLowEnergyService::ServiceState newStat // Enable notifications QLowEnergyCharacteristic characteristic = m_eqivaService->characteristic(notificationCharacteristicUuid); QLowEnergyDescriptor notificationDescriptor = characteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration); -// m_eqivaService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0000")); m_eqivaService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100")); - } void EqivaBluetooth::characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value) { -// qCDebug(dcEQ3()) << m_name << "Notification received" << info.uuid() << value.toHex(); - if (info.uuid() != notificationCharacteristicUuid) { qCWarning(dcEQ3()) << m_name << "Received a notification from a characteristic we did't expect:" << info.uuid() << value.toHex(); return; @@ -466,7 +464,6 @@ void EqivaBluetooth::sendDate() stream << static_cast(now.time().second()); // Example: 03130117172315 -> 03YYMMDDHHMMSS -// qCDebug(dcEQ3()) << m_name << "Updating date on device..."; enqueue("SetDate", data); } @@ -477,7 +474,6 @@ int EqivaBluetooth::enqueue(const QString &name, const QByteArray &data) cmd.id = m_nextCommandId++; cmd.data = data; m_commandQueue.append(cmd); -// qCDebug(dcEQ3()) << m_name << "Enqueued command" << cmd.name << "Command queue length:" << m_commandQueue.length(); processCommandQueue(); return cmd.id; } @@ -490,7 +486,6 @@ void EqivaBluetooth::processCommandQueue() } if (m_commandQueue.isEmpty()) { -// qCDebug(dcEQ3()) << m_name << "Command queue is empty. Nothing to do..."; return; }