【问题标题】:Android BLE 4.3 onDescriptorWrite returns status 128 on enabling characteristics notificationAndroid BLE 4.3 onDescriptorWrite 在启用特征通知时返回状态 128
【发布时间】:2013-08-26 18:28:54
【问题描述】:

关于使用新的 android BLE 4.3 启用特性的问题:

我没有从 BLE 设备收到任何通知,尽管我使用队列异步地启用了关于特性的通知。

我还使用 ENABLE_NOTIFICATION_VALUE 编写了 UUID“00002902-0000-1000-8000-00805f9b34fb”的描述符。

我已遵循 Google sdk doc 的建议以及各种论坛的建议。

顺便说一下,我在“onDescriptorWrite”上获得了 status = 128。知道这个状态意味着什么吗?

我通过谷歌代码并没有看到任何信息。甚至源代码也没有说明如何设置此状态。

如果您在为身体媒体设备启用通知时遇到过这种情况,请告诉我。有时我会在描述符写入时获得状态 133。我使用最新的 Nexus 7 进行测试。

【问题讨论】:

标签: android bluetooth-lowenergy gatt


【解决方案1】:

我遇到了同样的问题,通过禁用和重新启用蓝牙接口解决了它。

Android BLE 堆栈似乎还不成熟,存在不稳定问题。

【讨论】:

    【解决方案2】:

    此错误可能与 Android 操作系统施加的最大阈值有关。

    #define BTA_GATTC_NOTIF_REG_MAX     15
    
     - for 4.3 max number of notification/indication is 4 
     - for 4.4 max number of notification/indication is 7
     - for 5.0 max number of notification/indication is 15
    

    https://groups.google.com/forum/#!topic/android-platform/FNHO5KB4sKI

    https://android.googlesource.com/platform/external/bluetooth/bluedroid/+/android-5.0.2_r1/bta/gatt/bta_gattc_int.h

    【讨论】:

      【解决方案3】:

      一个很晚的答案,但这对于在gatt.writedescriptor() 呼叫中遇到状态 128 (GATT_NO_RESOURCES) 的任何人来说可能很有价值。

      在我的情况下,状态 128 出现在尝试为需要通过 ENABLE_INDICATION_VALUE 订阅指示的特征写入值为 ENABLE_NOTIFICATION_VALUE 的描述符时。

      所以不是

      BluetoothGattDescriptor descriptor = bluetoothGattCharacteristic.getDescriptor(DESCRIPTOR_UUID);
      descriptor.setValue(ENABLE_NOTIFICATION_VALUE);
      mGatt.writeDescriptor(descriptor);
      

      去

      BluetoothGattDescriptor descriptor = bluetoothGattCharacteristic.getDescriptor(DESCRIPTOR_UUID);
      descriptor.setValue(ENABLE_INDICATION_VALUE);
      mGatt.writeDescriptor(descriptor);
      

      解决了这个问题。我假设反过来会产生相同的错误状态 128。

      【讨论】:

        【解决方案4】:

        我在使用WriteNoResponse 属性执行writeCharacteristic 时收到此错误。当我为writeCharacteristic 指定WriteWithoutResponse 参数时,问题就消失了。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-01-20
          • 1970-01-01
          • 2017-09-17
          • 2013-12-01
          相关资源
          最近更新 更多