我正在开发与 BLE 设备通信的应用程序。我可以轻松地在特性上写入 20 个字节,但是当它超过 20 个字节时就会产生问题。我正在使用
mBluetoothGatt.requestMtu(512);
成功后写特征。
@Override
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
super.onMtuChanged(gatt, mtu, status);
if (status == BluetoothGatt.GATT_SUCCESS) {
System.out.print("Mtu Granted");
// this.supportedMTU = mtu;
}
}
这在棉花糖和棒棒糖中运行良好。但它在牛轧糖(三星 Galaxy s6)中不起作用。