Disocover services after disconnect BLE

0

 

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

    Tuesday, April 10 2018, 07:16 AM - #Permalink
    0

    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.

    The reply is currently minimized Show
  • Responses (2)
    • Accepted Answer

      Monday, March 26 2018, 04:42 AM - #Permalink
      0

      I'm using 10.2.2 Tokyo. When I call BluetoothLE1.DiscoverdDevices.Items[i].DisposeOf; I get  segmentation fault 11.

      The reply is currently minimized Show
    • Accepted Answer

      Friday, March 23 2018, 01:31 PM - #Permalink
      0

      What 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.

      The reply is currently minimized Show
    Your Reply

    Please login to post a reply.........