Index: sources/bluetooth/BluetoothInterface.cpp =================================================================== diff -u -r068426e216f9ae5bc4879e4f75bf0f346e33a1ae -rf11dd9cd2c07f96d9d939d70ed9c4ce2edef2a9d --- sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision 068426e216f9ae5bc4879e4f75bf0f346e33a1ae) +++ sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision f11dd9cd2c07f96d9d939d70ed9c4ce2edef2a9d) @@ -228,10 +228,55 @@ service->serviceUuid().toString() , \ service->serviceName() )); #define NOTIFY_DETAILS_INVALID notifyStateChange(MBluetooth(MBluetooth::eIS_Service_Detail_Invalid )); +#define NOTIFY_DETAILS_CHANGE notifyStateChange(MBluetooth(MBluetooth::eIS_Detail_Change , \ + _device->remoteAddress().toString() , \ + _device->remoteName(), "" , \ + _local->pairingStatus(_device->remoteAddress()), 0, 1 , \ + service->serviceUuid().toString() , \ + service->serviceName() , \ + vCharacteristic.uuid().toString() , \ + vCharacteristic.name() , \ + QString(vValue) )); +#define NOTIFY_DETAILS_READ notifyStateChange(MBluetooth(MBluetooth::eIS_Detail_Read , \ + _device->remoteAddress().toString() , \ + _device->remoteName(), "" , \ + _local->pairingStatus(_device->remoteAddress()), 0, 1 , \ + service->serviceUuid().toString() , \ + service->serviceName() , \ + vCharacteristic.uuid().toString() , \ + vCharacteristic.name() , \ + QString(vValue) )); +#define NOTIFY_DETAILS_WRITE notifyStateChange(MBluetooth(MBluetooth::eIS_Detail_Write , \ + _device->remoteAddress().toString() , \ + _device->remoteName(), "" , \ + _local->pairingStatus(_device->remoteAddress()), 0, 1 , \ + service->serviceUuid().toString() , \ + service->serviceName() , \ + vCharacteristic.uuid().toString() , \ + vCharacteristic.name() , \ + QString(vValue) )); +#define NOTIFY_CONFIG_READ notifyStateChange(MBluetooth(MBluetooth::eIS_Config_Read , \ + _device->remoteAddress().toString() , \ + _device->remoteName(), "" , \ + _local->pairingStatus(_device->remoteAddress()), 0, 1 , \ + service->serviceUuid().toString() , \ + service->serviceName() , \ + vDescriptor.uuid().toString() , \ + vDescriptor.name() , \ + QString(vValue) )); +#define NOTIFY_CONFIG_WRITE notifyStateChange(MBluetooth(MBluetooth::eIS_Config_Write , \ + _device->remoteAddress().toString() , \ + _device->remoteName(), "" , \ + _local->pairingStatus(_device->remoteAddress()), 0, 1 , \ + service->serviceUuid().toString() , \ + service->serviceName() , \ + vDescriptor.uuid().toString() , \ + vDescriptor.name() , \ + QString(vValue) )); #define NOTIFY_SERVICE_DETAILS_DONE notifyStateChange(MBluetooth(MBluetooth::eIS_Service_Detail_Done , \ _device->remoteAddress().toString() , \ _device->remoteName(), "" , \ - _local->pairingStatus(_device->remoteAddress()), vState, 0 , \ + _local->pairingStatus(_device->remoteAddress()), 0, 1 , \ service->serviceUuid().toString() , \ service->serviceName() )); @@ -252,7 +297,6 @@ */ void BluetoothInterface::onstart() { - _local->powerOn(); if ( ! isLocalValid() ) return; quitDevice(); _agent->setLowEnergyDiscoveryTimeout(5000); @@ -267,7 +311,6 @@ */ void BluetoothInterface::ondoScan() { - onstart(); // TODO: it may require in case the application needs to reset the Bluetooth Adapter. Or can be moved to Adapter Reset function(no implemented yet) if (_agent && _agent->isActive()) { NOTIFY_SCAN_REJECT return; @@ -480,8 +523,25 @@ } -void BluetoothInterface::onServiceCharacteristicChanged(const QLowEnergyCharacteristic &vCharacteristic, const QByteArray &vValue) { - qDebug() << " ..... Service Charc C:" << vCharacteristic.name() << vValue; +void BluetoothInterface::onServiceDescriptorRead (const QLowEnergyDescriptor &vDescriptor , const QByteArray &vValue) { + QLowEnergyService *service = reinterpret_cast(sender()); + NOTIFY_CONFIG_READ +} +void BluetoothInterface::onServiceDescriptorWritten (const QLowEnergyDescriptor &vDescriptor , const QByteArray &vValue) { + QLowEnergyService *service = reinterpret_cast(sender()); + NOTIFY_CONFIG_WRITE +} +void BluetoothInterface::onServiceCharacteristicRead (const QLowEnergyCharacteristic &vCharacteristic, const QByteArray &vValue) { + QLowEnergyService *service = reinterpret_cast(sender()); + NOTIFY_DETAILS_READ +} +void BluetoothInterface::onServiceCharacteristicWritten (const QLowEnergyCharacteristic &vCharacteristic, const QByteArray &vValue) { + QLowEnergyService *service = reinterpret_cast(sender()); + NOTIFY_DETAILS_WRITE +} +void BluetoothInterface::onServiceCharacteristicChanged (const QLowEnergyCharacteristic &vCharacteristic, const QByteArray &vValue) { + QLowEnergyService *service = reinterpret_cast(sender()); + NOTIFY_DETAILS_CHANGE if (vCharacteristic.uuid() == QBluetoothUuid(QBluetoothUuid::BloodPressureMeasurement)) { parseMeasurement(vValue); @@ -491,7 +551,6 @@ void BluetoothInterface::parseMeasurement(const QByteArray &byteArray) { MeasurementData measurement; -// const uint8_t *d = reinterpret_cast(byteArray.constData()); const uchar *d = reinterpret_cast(byteArray.constData()); measurement.flags = *d;