Disocover services after disconnect BLE
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?
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.
I'm using 10.2.2 Tokyo. When I call BluetoothLE1.DiscoverdDevices.Items[i].DisposeOf; I get segmentation fault 11.
What version of Delphi are you using? The ability to disconnect from a BTLE device got added starting with Delphi XE8.
BluetoothLE1->DiscoveredDevices->Items[i] is the device you are connected to.