Index: sources/bluetooth/BluetoothInterface.cpp =================================================================== diff -u -r3e64d98e243484505a44d99b13826097cb6b01eb -r47c8f13876317ba36500400f894d96c9bce9eb17 --- sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision 3e64d98e243484505a44d99b13826097cb6b01eb) +++ sources/bluetooth/BluetoothInterface.cpp (.../BluetoothInterface.cpp) (revision 47c8f13876317ba36500400f894d96c9bce9eb17) @@ -20,6 +20,7 @@ #include // Project +#include "ApplicationController.h" #include "Logger.h" // namespace @@ -295,6 +296,10 @@ connect(this , SIGNAL(didDeviceSelect (BluetoothDeviceData )), this , SLOT( onDeviceSelect (BluetoothDeviceData ))); + + connect(&_ApplicationController, SIGNAL(didAttributeResponse(const DeviceBluetoothPairedQueryResponseData &)), + this , SLOT( onAttributeResponse(const DeviceBluetoothPairedQueryResponseData &))); + } /*! @@ -515,6 +520,30 @@ connectToDevice(); } +void BluetoothInterface::onAttributeResponse(const DeviceBluetoothPairedQueryResponseData &vData) +{ + // Notify the View that it is a new scan so clean up the list, and update screen status. + NOTIFY_SCAN_START + + // create a device info with the given paired device information + // to simulate the device discovered slot call + QBluetoothDeviceInfo info(QBluetoothAddress(vData.mAddr), vData.mName, 0); + info.setCoreConfigurations(QBluetoothDeviceInfo::LowEnergyCoreConfiguration); + onAgentDiscoverDevice(info); + + // since it is only one paired device, the device discovery finish is called to process the device. + onAgentDiscoverFinish(); + + // try to call to the device for the first time to make the device and initialize it. + BluetoothDeviceData data; + data.addr = vData.mAddr; + data.name = vData.mName; + onDeviceSelect(data); + + // set the flag for the re-connection timer. + _reconnectionActive = true; +} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~ Remote Device Slots // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~