gpt4 book ai didi

delphi - 如何检查仍然与 Delphi 10.3 连接的 BLE 设备

转载 作者:行者123 更新时间:2023-12-03 18:39:53 28 4
gpt4 key购买 nike

我已成功将我的 Delphi(FM) 应用程序连接到 ESP32 设备,我可以通过 BLE 发送命令/接收数据(连接成功/失败后,我会显示连接状态消息)。但问题是,如果用户关闭/关闭 ESP32 设备,则移动应用程序仍会显示已建立连接。

我都试过了 System.Bluetooth.TBluetoothConnectionStateSystem.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;

最佳答案

使用蓝牙设备(TBluetoothLEDevice)的OnDisconnect事件

关于delphi - 如何检查仍然与 Delphi 10.3 连接的 BLE 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57401075/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com