我制作了一个在 BLE 中读写一些字符的应用程序。
我的操作在那里:
- 连接到 gatt
- 发现服务
- 读字符
- 写字符
除了某些小米和红米设备外,每个设备上的一切都很好。我在 writeCharacteristic 上有问题,我没有响应,并且设备没有在 LE periph 上写入任何内容。读完一个特征(所以进入“onCharacteristicRead”回调)我称之为写
final BluetoothGattCharacteristic characteristicBadge = mBluetoothGattService.getCharacteristic(UUID_CHARSBADGE);
characteristicBadge.setValue(resultBadge); //resultBadge is an array
characteristicBadge.setWriteType(BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT);
mBluetoothGatt.writeCharacteristic(characteristicBadge);
但我没有任何回应,永远不会调用 onCharacteristicWrite。我尝试了一切,无论是否使用自动连接 connectGatt。
有没有人有同样的问题?我很快就会疯掉。。