Index: sources/bluetooth/BluetoothInterface.cpp =================================================================== diff -u -r7bb28b34d5337c6fe8669ee797e0312639c0e02f -r8247dc0f182707a9689f719e2d386e640440c55b --- sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision 7bb28b34d5337c6fe8669ee797e0312639c0e02f) +++ sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision 8247dc0f182707a9689f719e2d386e640440c55b) @@ -183,7 +183,8 @@ _device->remoteName(), _tempBatt )); #define NOTIFY_DEVICE_CONNECT notifyStateChange(MBluetooth(MBluetooth::eIS_Device_Connect , \ _device->remoteAddress().toString() , \ - _device->remoteName() )); + _device->remoteName() , \ + getIsCurrentlyPaired() )); #define NOTIFY_DEVICE_DONE notifyStateChange(MBluetooth(MBluetooth::eIS_Device_Done , \ _device->remoteAddress().toString() , \ _device->remoteName() )); @@ -193,7 +194,8 @@ 0,0, vError, false )); #define NOTIFY_DEVICE_DISCONNECT notifyStateChange(MBluetooth(MBluetooth::eIS_Device_Disconnect , \ _device->remoteAddress().toString() , \ - _device->remoteName() )); + _device->remoteName() , \ + getIsCurrentlyPaired() )); // ~~~~~~~~~~ Service #define NOTIFY_SERVICE_START notifyStateChange(MBluetooth(MBluetooth::eIS_Service_Start )); #define NOTIFY_SERVICE_DISCOVER notifyStateChange(MBluetooth(MBluetooth::eIS_Service_Discover )); @@ -374,7 +376,22 @@ emit didStateChange(vData); } + /*! + * \brief BluetoothInterface::getIsCurrentlyPaired + * \details Determine whether the local device is paired to a remote bt device. + * \returns true if there is a pairing, false otherwise + */ +bool BluetoothInterface::getIsCurrentlyPaired() +{ + if ( !isLocalValid() ) { return false; } + if ( !isDeviceValid()) { return false; } + + QBluetoothLocalDevice::Pairing currentPairingStatus = _local->pairingStatus(_device->remoteAddress()); + return currentPairingStatus != QBluetoothLocalDevice::Unpaired; +} + +/*! * \brief BluetoothInterface::doNotifyStatePOSTError * \details The public slot for public notification on POST error, * since the POST is done by ApplicationPOST class,