如何在Android BLE上读取超过23个字节

时间:2017-05-04 12:53:13

标签: android bluetooth-lowenergy

我知道Android BLE中有23个字节的限制。

有几个关于发送超过20个字节的stackoverflow问题。

但我的问题是,如何使用Android BLE 读取超过20个字节。

是的,可以通过操纵MTU轻松完成,但Kitkat不支持 requestMTU 你知道:(

天真实施,

override fun onCharacteristicRead(gatt: BluetoothGatt?, characteristic: BluetoothGattCharacteristic?, status: Int) {
    new String(characteristic?.value)
}

这只产生前23个字节。

1 个答案:

答案 0 :(得分:1)

看看this question

虽然如果您确实可以控制外围设备,但您可能希望对数据进行分块。