小程序使用 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);
希望有大佬可以解答