【问题标题】:bluetoothGatt writeCharacteristic returns falsebluetoothGatt writeCharacteristic 返回 false
【发布时间】:2015-06-09 16:21:53
【问题描述】:

我创建了一个具有 WRITE_TYPE_NO_RESPONSE 特性的外围设备。 在另一个应用程序中,我在特性上写道,但我偶尔会遇到带有棒棒糖 5.1.1 的三星 Galaxy nexus i9250 的问题: 有时 BluetoothGatt.writeCharacteristic 函数返回 false 并且写入未完成。

可能是什么?可能是 cyanogenmod 的错吗?我可以通过什么方式修补这个问题?

在外围:

new BluetoothGattCharacteristic(
                UUID.fromString(characteristic),
                BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE ,
                BluetoothGattCharacteristic.PERMISSION_WRITE);

编辑:这个问题只发生在 android >= 5.0.2

在 kitkat 和 android 5.0.1 上从未发生过,是偶然的吗?

【问题讨论】:

    标签: android bluetooth-lowenergy android-ble


    【解决方案1】:

    我通过在连续的 BluetoothGatt 读/写调用之间留出一秒钟的间隔解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-27
      • 1970-01-01
      • 1970-01-01
      • 2014-10-18
      • 2015-08-02
      • 2012-05-17
      • 2013-10-26
      相关资源
      最近更新 更多