Disocover services after disconnect BLE
Hello,
I would like to be able to disconnect from a BLE peripheral and reconnect to it without having to fully close the application. I have used the BluetoothLEDevice.Disconnect function. The BLE peripheral device returns to advertising. I am able to discover the device but unable to discover the services. This is because Discoverservices returns false.
Looking at the Heartrate sensor example I havn't found a anything relating to disconnecting from a device and reconnecting.
How do I properly disconnect from a device?
Why does discoverservices return false?
Accepted Answer
After calling Bluetoothdevice.disconnect(); I set the enable property of the bluetoothLE1 component to false and set it it true again before searching for new devices. Now I'm able to reconnect to the device.
-
Accepted Answer
0I'm using 10.2.2 Tokyo. When I call BluetoothLE1.DiscoverdDevices.Items[i].DisposeOf; I get segmentation fault 11.
-
Accepted Answer
0What version of Delphi are you using? The ability to disconnect from a BTLE device got added starting with Delphi XE8.
try calling:
BluetoothLE1->DiscoveredDevices->Items[i]->DisposeOf();
where
BluetoothLE1->DiscoveredDevices->Items[i] is the device you are connected to.