How can Android BLE read more than 20 bytes in Delphi FMX 10.3 API is(API 29)

  

in Delphi FMX 10.3
now i can scan BLE deveice and can connect it ,also can receive data ,but when senddata more than 20 bytes ,the app cannot receive data. i know Modify the MTU >20 ,it will work ok
in Android studio it Easy to implement, but in Delphi fmx can not find any supports
Android studio sample
private void setMtu(int setMtu) {
BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
BluetoothAdapter bluetoothAdapter = bluetoothManager.getAdapter();
bluetoothAdapter.startLeScan(new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
device.connectGatt(DemoActivity.this, true, new BluetoothGattCallback() {
@Override
public void onServicesDiscovered(BluetoothGatt gatt, int status) {
super.onServicesDiscovered(gatt, status);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (setMtu > 23 && setMtu < 512) {
gatt.requestMtu(setMtu);
}
}
}

@Override
public void onMtuChanged(BluetoothGatt gatt, int mtu, int status) {
super.onMtuChanged(gatt, mtu, status);
mMtu = mtu;
if (BluetoothGatt.GATT_SUCCESS == status && setMtu == mtu) {
LogUtils.d("MTU change success = " + mtu);
} else {
LogUtils.d("MTU change fail!");
}
}
});
}
});
}

but in Delphi How to implement?

Comments are closed.