Index: sources/bluetooth/BluetoothInterface.cpp =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r45e753bb6f0ffde4ebdb60f6658cbccdd440957f --- sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision 45e753bb6f0ffde4ebdb60f6658cbccdd440957f) @@ -413,6 +413,10 @@ initConnections(); NOTIFY_LOCAL_INIT NOTIFY_IDLE + + // The initial scan to populate the bt device list + // opting to not quitDevice to hold previous paired status + startScan(false); } /*! @@ -422,7 +426,8 @@ */ void BluetoothInterface::ondoScan() { - startScan(); + // Re-scanning, opting to unpair to last device + startScan(true); } // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -476,7 +481,18 @@ BluetoothDeviceData data; data.addr = vInfo.address().toString(); data.name = vInfo.name(); - data.pair = _local->pairingStatus(vInfo.address()); + + bool isPaired = _local->pairingStatus(vInfo.address()) == QBluetoothLocalDevice::Paired; + bool isAuthPaired = _local->pairingStatus(vInfo.address()) == QBluetoothLocalDevice::AuthorizedPaired; + + data.pair = isPaired || isAuthPaired; + + if ( data.pair ) { + // If a previously paired device is found, sdo initial connecting to it + _temp = QBluetoothDeviceInfo(vInfo.address(), vInfo.name(), QBluetoothDeviceInfo::HealthBloodPressureMonitor); + connectToDevice(); + } + emit didDeviceChange(data); NOTIFY_SCAN_FOUND } @@ -785,9 +801,10 @@ /*! * \brief BluetoothInterface::startScan * \details Stars the agent device scan + * \param vQuitDevice - true if quitting device, else scan only * \return true if the agent can successfully start the scan. */ -bool BluetoothInterface::startScan() +bool BluetoothInterface::startScan(bool vQuitDevice) { if ( ! isValid() ) return false; // POST failed. @@ -797,7 +814,11 @@ } NOTIFY_SCAN_START - quitDevice(); + + if (vQuitDevice) { + quitDevice(); + } + _agent->start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod); return true; } Index: sources/bluetooth/BluetoothInterface.h =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r45e753bb6f0ffde4ebdb60f6658cbccdd440957f --- sources/bluetooth/BluetoothInterface.h (.../BluetoothInterface.h) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/bluetooth/BluetoothInterface.h (.../BluetoothInterface.h) (revision 45e753bb6f0ffde4ebdb60f6658cbccdd440957f) @@ -129,7 +129,7 @@ void onAttributeResponse (const DeviceBluetoothPairedQueryResponseData &vData); private: - bool startScan (); + bool startScan (bool vQuitDevice); bool stopScan (); void initConnections (); Index: sources/gui/qml/pages/settings/SettingsBluetoothCuff.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r45e753bb6f0ffde4ebdb60f6658cbccdd440957f --- sources/gui/qml/pages/settings/SettingsBluetoothCuff.qml (.../SettingsBluetoothCuff.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/pages/settings/SettingsBluetoothCuff.qml (.../SettingsBluetoothCuff.qml) (revision 45e753bb6f0ffde4ebdb60f6658cbccdd440957f) @@ -65,7 +65,7 @@ readonly property color selectedColor: Colors.borderButtonSelected readonly property color pairedColor: Colors.borderButton readonly property color normalColor: Colors.borderButtonUnselected - property bool selectedDevice: addr === vBluetooth.pairedAddr + property bool selectedDevice: pair || addr === vBluetooth.pairedAddr clip : true radius : 10 width : 500 - 10 // give room to scrollbar