clean up some commented out code
parent
796a27e0ff
commit
a705830502
|
|
@ -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: --> {3fa4585a-ce4a-3bad-db4b-b8df8179ea09} (Handle 0x411 Name: ): 0313091e0b2936000000000000000000 )6
|
||||||
//I | EQ3: C: --> {d0e8434d-cd29-0996-af41-6c90f4e0eb2a} (Handle 0x421 Name: ): 00000000000000000000000000000000
|
//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
|
//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"));
|
const QBluetoothUuid eqivaGapServiceUuid = QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb"));
|
||||||
//I | EQ3: Service discovered: "Generic Access" "{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
|
//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: --> {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: --> {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
|
//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"));
|
const QBluetoothUuid eqivaGattServiceUuid = QBluetoothUuid(QString("00001801-0000-1000-8000-00805f9b34fb"));
|
||||||
//I | EQ3: Service discovered: "Generic Attribute" "{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: 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
|
//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"));
|
const QBluetoothUuid eqivaDeviceInfoServiceUuid = QBluetoothUuid(QString("0000180a-0000-1000-8000-00805f9b34fb"));
|
||||||
//I | EQ3: Service discovered: "Device Information" "{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: --> {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
|
//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"));
|
const QBluetoothUuid eqivaUnknownServiceUuid = QBluetoothUuid(QString("9e5d1e47-5c13-43a0-8635-82ad38a1386f"));
|
||||||
//I | EQ3: Service discovered: "Unknown Service" "{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: ):
|
//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();
|
// qCDebug(dcEQ3()) << m_name << "Discovered: Service UUIDS:" << m_bluetoothDevice->serviceUuids();
|
||||||
// QBluetoothUuid uuid = QBluetoothUuid(QString("{3e135142-654f-9090-134a-a6ff5bb77046}"));
|
// QBluetoothUuid uuid = QBluetoothUuid(QString("{3e135142-654f-9090-134a-a6ff5bb77046}"));
|
||||||
//// QBluetoothUuid uuid = QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb"));
|
//// QBluetoothUuid uuid = QBluetoothUuid(QString("00001800-0000-1000-8000-00805f9b34fb"));
|
||||||
|
|
@ -273,9 +278,6 @@ void EqivaBluetooth::controllerStateChanged(const QLowEnergyController::Controll
|
||||||
//// service->readCharacteristic(characteristic);
|
//// 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;
|
// return;
|
||||||
|
|
@ -335,13 +337,13 @@ void EqivaBluetooth::serviceStateChanged(QLowEnergyService::ServiceState newStat
|
||||||
}
|
}
|
||||||
qCDebug(dcEQ3()) << m_name << "Service details discovered";
|
qCDebug(dcEQ3()) << m_name << "Service details discovered";
|
||||||
|
|
||||||
foreach (const QLowEnergyCharacteristic &characteristic, m_eqivaService->characteristics()) {
|
// DEBUG
|
||||||
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 QLowEnergyCharacteristic &characteristic, m_eqivaService->characteristics()) {
|
||||||
foreach (const QLowEnergyDescriptor &descriptor, characteristic.descriptors()) {
|
// 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();
|
||||||
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();
|
// 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);
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
m_available = true;
|
m_available = true;
|
||||||
m_reconnectAttempt = 0;
|
m_reconnectAttempt = 0;
|
||||||
|
|
@ -352,15 +354,11 @@ void EqivaBluetooth::serviceStateChanged(QLowEnergyService::ServiceState newStat
|
||||||
// Enable notifications
|
// Enable notifications
|
||||||
QLowEnergyCharacteristic characteristic = m_eqivaService->characteristic(notificationCharacteristicUuid);
|
QLowEnergyCharacteristic characteristic = m_eqivaService->characteristic(notificationCharacteristicUuid);
|
||||||
QLowEnergyDescriptor notificationDescriptor = characteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
QLowEnergyDescriptor notificationDescriptor = characteristic.descriptor(QBluetoothUuid::ClientCharacteristicConfiguration);
|
||||||
// m_eqivaService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0000"));
|
|
||||||
m_eqivaService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
m_eqivaService->writeDescriptor(notificationDescriptor, QByteArray::fromHex("0100"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EqivaBluetooth::characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value)
|
void EqivaBluetooth::characteristicChanged(const QLowEnergyCharacteristic &info, const QByteArray &value)
|
||||||
{
|
{
|
||||||
// qCDebug(dcEQ3()) << m_name << "Notification received" << info.uuid() << value.toHex();
|
|
||||||
|
|
||||||
if (info.uuid() != notificationCharacteristicUuid) {
|
if (info.uuid() != notificationCharacteristicUuid) {
|
||||||
qCWarning(dcEQ3()) << m_name << "Received a notification from a characteristic we did't expect:" << info.uuid() << value.toHex();
|
qCWarning(dcEQ3()) << m_name << "Received a notification from a characteristic we did't expect:" << info.uuid() << value.toHex();
|
||||||
return;
|
return;
|
||||||
|
|
@ -466,7 +464,6 @@ void EqivaBluetooth::sendDate()
|
||||||
stream << static_cast<quint8>(now.time().second());
|
stream << static_cast<quint8>(now.time().second());
|
||||||
|
|
||||||
// Example: 03130117172315 -> 03YYMMDDHHMMSS
|
// Example: 03130117172315 -> 03YYMMDDHHMMSS
|
||||||
// qCDebug(dcEQ3()) << m_name << "Updating date on device...";
|
|
||||||
enqueue("SetDate", data);
|
enqueue("SetDate", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -477,7 +474,6 @@ int EqivaBluetooth::enqueue(const QString &name, const QByteArray &data)
|
||||||
cmd.id = m_nextCommandId++;
|
cmd.id = m_nextCommandId++;
|
||||||
cmd.data = data;
|
cmd.data = data;
|
||||||
m_commandQueue.append(cmd);
|
m_commandQueue.append(cmd);
|
||||||
// qCDebug(dcEQ3()) << m_name << "Enqueued command" << cmd.name << "Command queue length:" << m_commandQueue.length();
|
|
||||||
processCommandQueue();
|
processCommandQueue();
|
||||||
return cmd.id;
|
return cmd.id;
|
||||||
}
|
}
|
||||||
|
|
@ -490,7 +486,6 @@ void EqivaBluetooth::processCommandQueue()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_commandQueue.isEmpty()) {
|
if (m_commandQueue.isEmpty()) {
|
||||||
// qCDebug(dcEQ3()) << m_name << "Command queue is empty. Nothing to do...";
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue