android - 如何让一个特性既可以读又可以写?

标签 android bluetooth-lowenergy

我知道一个特征只能有一个属性和一个权限,并且该属性必须与权限具有相同的值,例如如果特征具有写入权限,则它必须具有可写的属性...那么如何使特征可读且可写?

例如

如何转动

int permission = BluetoothGattCharacteristic.PERMISSION_WRITE;
int property = BluetoothGattCharacteristic.PROPERTY_WRITE;

分为读

最佳答案

使用口罩

int permission = BluetoothGattCharacteristic.PERMISSION_WRITE | BluetoothGattCharacteristic.PERMISSION_READ;
int property = BluetoothGattCharacteristic.PROPERTY_WRITE|BluetoothGattCharacteristic.PROPERTY_READ;

关于android - 如何让一个特性既可以读又可以写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47341515/

相关文章:

android - 如何检测连接的蓝牙外围设备(自拍杆)的点击事件?

android - 如何测量充当 iBeacon 的 iPhone 与 Android 设备之间的距离

java - 如果返回类型是 xpose 中的 list<string>,我该如何 Hook ?

android - 从自定义基本适配器>getView [包含IMG]单击按钮启动对话框 fragment

android - RxAndroid : Possible to use zip function on an array of api requests with interval or delay?

android - 在 OpenGL ES 2.0 中将图像映射到正方形(2 个三角形带)的最简单方法是什么?

android - Android 和 Iphone 之间的应用感知蓝牙 BLE 通信

java - 无法将条目 ':app:sourceSets' 添加到缓存 taskArtifacts.bin

如果在蓝牙扫描期间滚动,则出现 java.lang.IllegalStateException

bluetooth - 从 BLE 设备读取日志数据记录