安卓端低功耗蓝牙与小程序对接时小程序无法接收数据报10008错误

新手上路,请多包涵

小程序使用 notifyBLECharacteristicValueChange 这个函数时返回10008代码
错误描述为 notifyBLECharacteristicValueChange:fail:no descriptor"
我去小程序开发社区看到需要在 从机端可以检查一下characteristic是否带上了Client Characteristic Configuration Descriptor
目前就是不知道这个Client Characteristic Configuration Descriptor 要如何添加。
下面是我安卓从机端代码

 BluetoothGattService service = new BluetoothGattService(UUID_SERVICE, BluetoothGattService.SERVICE_TYPE_PRIMARY);
        //添加可读+通知characteristic
        BluetoothGattCharacteristic characteristicRead = new BluetoothGattCharacteristic(UUID_CHAR_READ_NOTIFY,
                BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ);
        characteristicRead.addDescriptor(new BluetoothGattDescriptor(UUID_DESC_NOTITY, BluetoothGattCharacteristic.PERMISSION_WRITE));
        service.addCharacteristic(characteristicRead);

希望有大佬可以解答

阅读 2.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题