我有一个具有多个特征的BLE设备,默认地址为here
制造商名称字符串,硬件修订字符串,序列号字符串等等。
使用UUID类我尝试了几种不同的方法来构造一个RxAndroidBle可以接受并读取这些特征的UUID。
我最喜欢的那个是:
UUID GATT_DSR1_MANUFACTURER_NAME = new UUID(0L, 0x2A29L);
但我刚回到onError回调。
RxBleConnection.readCharacteristic仅接受使用UUID创建的UUID或BluetoothGattCharacter ......
答案 0 :(得分:1)
创建UUID (从How to correctly use UUID.fromString method?复制)
在BLE规范中,有两种UUID。
UUID.fromString("F000xxxx-0451-4000-B000-000000000000");
UUID.fromString("0000xxxx-0000-1000-8000-00805f9b34fb")
其中xxxx是地方填写从您的0x2A29L
代表"2A29"
字符串为xxxx。
获取BluetoothGattCharacteristic
在Android上,无法使用BluetoothGattCharacteristic
创建有效的UUID
。仍然可以调用RxBleConnection.discoverServices()
并从结果中获取它。