request method

  1. @override
Future<int> request({
  1. required int mtu,
})
override

Implementation

@override
Future<int> request({required int mtu}) async {
  for (BlueZGattService service in device.gattServices) {
    for (BlueZGattCharacteristic characteristic in service.characteristics) {
      int? requested = characteristic.mtu;
      // The value provided by Bluez includes an extra 3 bytes from the GATT header, which needs to be removed.
      if (requested != null) return min(requested - 3, mtu);
    }
  }
  return min(23, mtu);
}