如何在Android BLE上读取超过23字节的数据
我知道Android BLE中有23个字节的限制 关于发送超过20字节的有几个堆栈溢出问题 但我的问题是,如何使用Android BLE读取超过20个字节 是的,操作MTU很容易,但Kitkat不支持requestMTU您知道:( 通过天真的实施如何在Android BLE上读取超过23字节的数据,android,bluetooth-lowenergy,Android,Bluetooth Lowenergy,我知道Android BLE中有23个字节的限制 关于发送超过20字节的有几个堆栈溢出问题 但我的问题是,如何使用Android BLE读取超过20个字节 是的,操作MTU很容易,但Kitkat不支持requestMTU您知道:( 通过天真的实施 override fun onCharacteristicRead(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?, status: Int) { new S
override fun onCharacteristicRead(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?, status: Int) {
new String(characteristic?.value)
}
这只产生前23个字节。请查看
尽管您确实可以控制外围设备,但您可能希望将数据分块。有两个选项。您的对等设备请求更高的MTU,或者您必须将数据分为多条消息(分段)