我已成功将我的 Delphi(FM) 应用程序连接到 ESP32 设备,并可以通过 BLE 发送命令/接收数据(连接成功/失败后会显示连接状态消息)。但问题是,如果用户关闭/关闭 ESP32 设备,则移动应用程序仍然显示已建立连接。
我尝试使用System.Bluetooth.TBluetoothConnectionState和System.Bluetooth.TBluetoothLEManager.ConnectionState与 TTimer,但没有成功。
if not (BLEDevice1.ConnectionState = TBluetoothConnectionState.Connected) then
begin
Showmessge('Connection not established!');
// this type of control doesn't change anything.
end;