Delphi FMX BluetoothLE-写入特征失败
我正在编写一个针对Android和iOS的应用程序,通过BLE与Adafruit Bluefruit LE UART Friend使用北欧UART服务和TxD/RxD特性进行通信Delphi FMX BluetoothLE-写入特征失败,delphi,bluetooth-lowenergy,firemonkey,android-bluetooth,ios-bluetooth,Delphi,Bluetooth Lowenergy,Firemonkey,Android Bluetooth,Ios Bluetooth,我正在编写一个针对Android和iOS的应用程序,通过BLE与Adafruit Bluefruit LE UART Friend使用北欧UART服务和TxD/RxD特性进行通信 TxGattCharact: TBluetoothGattCharacteristic; SelectedDevice: TBluetoothLEDevice; TxGattCharact.SetValueAsString(myString, True); // UTF8 required if BluetoothL
TxGattCharact: TBluetoothGattCharacteristic;
SelectedDevice: TBluetoothLEDevice;
TxGattCharact.SetValueAsString(myString, True); // UTF8 required
if BluetoothLE1.WriteCharacteristic(SelectedDevice, TxGattCharact) then
... // everything just fine
else
Log('Writing Characteristic denied or unsuccessfull');
我必须把我的字符串分割成最多20个字符的块,这是我的规则。
这90%的时间都在工作
然而,有时WriteCharacteristic并不成功
有没有办法了解原因并采取可能的措施防止这种情况发生?
在发送另一个字符串之前,是否可以刷新BLE缓冲区以清除所有内容
提前感谢您的帮助需要检查的一件事是,在北欧模块上启用了UART——我遇到了类似的问题,因为有时UART会以某种方式被禁用。您可以使用Nordic工具箱应用程序(适用于iOS或Android)进行检查。
在尝试写入设备之前,您可能还需要检查设备是否仍然连接(检查TBluetoothLEDevice.IsConnected属性)。需要检查的一件事是,北欧模块上启用了UART——我遇到了类似的问题,因为有时UART会以某种方式被禁用。您可以使用Nordic工具箱应用程序(适用于iOS或Android)进行检查。 在尝试写入设备之前,您可能还需要检查设备是否仍处于连接状态(请检查TBluetoothLEDevice.IsConnected属性)