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, Index: sources/bluetooth/BluetoothInterface.h =================================================================== diff -u -r7bb28b34d5337c6fe8669ee797e0312639c0e02f -r8247dc0f182707a9689f719e2d386e640440c55b --- sources/bluetooth/BluetoothInterface.h (.../BluetoothInterface.h) (revision 7bb28b34d5337c6fe8669ee797e0312639c0e02f) +++ sources/bluetooth/BluetoothInterface.h (.../BluetoothInterface.h) (revision 8247dc0f182707a9689f719e2d386e640440c55b) @@ -168,8 +168,8 @@ void interpretBloodPressure (const QByteArray &vData); void interpretInformation (); void interpretBattery (const QByteArray &vData); + bool getIsCurrentlyPaired (); - signals: void didStateChange (const BluetoothData &vData); void didActionReceive (const UIBloodPressureData &vData); Index: sources/model/settings/MBluetooth.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r8247dc0f182707a9689f719e2d386e640440c55b --- sources/model/settings/MBluetooth.cpp (.../MBluetooth.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/model/settings/MBluetooth.cpp (.../MBluetooth.cpp) (revision 8247dc0f182707a9689f719e2d386e640440c55b) @@ -55,3 +55,14 @@ error (vError ), valid (vValid ){ } + +MBluetooth::MBluetooth( + InterfaceStates vState , + QString vDeviceAddr , + QString vDeviceName , + bool vIsPaired ): + state (vState ), + deviceAddr (vDeviceAddr ), + deviceName (vDeviceName ), + isPaired (vIsPaired ){ +} Index: sources/model/settings/MBluetooth.h =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r8247dc0f182707a9689f719e2d386e640440c55b --- sources/model/settings/MBluetooth.h (.../MBluetooth.h) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/model/settings/MBluetooth.h (.../MBluetooth.h) (revision 8247dc0f182707a9689f719e2d386e640440c55b) @@ -106,6 +106,8 @@ QString detailName = ""; QString detailValue = ""; + bool isPaired = false; + MBluetooth( InterfaceStates vState = eIS_Idle, QString vDeviceAddr = "", @@ -128,6 +130,13 @@ qint16 vError , bool vValid ); + + MBluetooth( + InterfaceStates vState , + QString vDeviceAddr , + QString vDeviceName , + bool vIsPaired + ); }; } Index: sources/view/settings/VBluetooth.cpp =================================================================== diff -u -rab995780e1eb9082f3c33a357e1386c19de1fa81 -r8247dc0f182707a9689f719e2d386e640440c55b --- sources/view/settings/VBluetooth.cpp (.../VBluetooth.cpp) (revision ab995780e1eb9082f3c33a357e1386c19de1fa81) +++ sources/view/settings/VBluetooth.cpp (.../VBluetooth.cpp) (revision 8247dc0f182707a9689f719e2d386e640440c55b) @@ -144,6 +144,19 @@ scanEnabled(true); break; + case MBluetooth::eIS_Device_Connect : + if(vData.isPaired) + { + LOG_APPED_UI(tr("Bluetooth reconnected.")); + } else { + LOG_APPED_UI(tr("Bluetooth connected." )); + } + break; + + case MBluetooth::eIS_Device_Disconnect : + LOG_APPED_UI(tr("Bluetooth disconnected." )); + break; + case MBluetooth::eIS_Idle : case MBluetooth::eIS_Local_Connect : case MBluetooth::eIS_Local_Error_Invalid : @@ -161,11 +174,9 @@ case MBluetooth::eIS_Device_Init : case MBluetooth::eIS_Device_Start : - case MBluetooth::eIS_Device_Connect : case MBluetooth::eIS_Device_Error_Init : case MBluetooth::eIS_Device_Error : case MBluetooth::eIS_Device_Done : - case MBluetooth::eIS_Device_Disconnect : case MBluetooth::eIS_Service_Start : case MBluetooth::eIS_Service_Invalid :