How to check a BLE device still connected with Delphi 10.3


I’ve successfully connected my Delphi(FM) app to a ESP32 device and I can send commands/receive data over BLE (I am showing a message for connection status after connection is successful/unsuccessful). But problem is that, if user close/power off the ESP32 device then mobile app still shows connection established.

I’ve tried both System.Bluetooth.TBluetoothConnectionState and System.Bluetooth.TBluetoothLEManager.ConnectionState with a TTimer but no success.

if not (BLEDevice1.ConnectionState = TBluetoothConnectionState.Connected) then
Showmessge(‘Connection not established!’);
// this type of control doesn’t change anything.

Comments are closed.