【问题标题】:Delphi FMX BluetoothLE - Writing Characteristic unsuccessfulDelphi FMX BluetoothLE - 写入特性不成功
【发布时间】:2017-09-26 13:11:40
【问题描述】:

我正在编写一个针对 Android 和 iOS 的应用程序,它通过 BLE 使用 Nordic UART 服务和 TxD/RxD 特性与 Adafruit Bluefruit LE UART Friend 进行通信。

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');

按照 BLE 规则,我必须将字符串拆分为最多 20 个字符的块。 这是 90% 的时间 但是,有时,WriteCharacteristic 并不成功

有没有办法了解原因并采取可能的措施来防止这种情况? 我可以在发送另一个字符串之前刷新 BLE 缓冲区以清除所有内容吗?

提前感谢您的帮助

【问题讨论】:

    标签: delphi bluetooth-lowenergy firemonkey android-bluetooth ios-bluetooth


    【解决方案1】:

    要检查的一件事是,在 Nordic 模块上启用了 UART——我遇到了与此类似的问题,因为有时 UART 以某种方式被禁用。您可以使用 Nordic Toolbox 应用程序(适用于 iOS 或 Android)进行检查。 在尝试写入之前,您可能还需要检查设备是否仍处于连接状态(检查 TBluetoothLEDevice.IsConnected 属性)。

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 1970-01-01
      • 2021-06-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多