Skip to content

Commit

Permalink
[Android] fix requestMtu (regression in 1.10.6)
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Jul 25, 2023
1 parent 37a77f7 commit 2e2de93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ public void onMethodCall(@NonNull MethodCall call,

case "requestMtu":
{
// see: BmMtuSizeRequest
// see: BmMtuChangeRequest
HashMap<String, Object> data = call.arguments();
String remoteId = (String) data.get("remote_id");
int mtu = (int) data.get("mtu");
Expand Down Expand Up @@ -1592,7 +1592,7 @@ public void onMtuChanged(BluetoothGatt gatt, int mtu, int status)
response.put("error_code", status);
response.put("error_string", gattErrorString(status));

invokeMethodUIThread("onMtuChanged", response);
invokeMethodUIThread("OnMtuChanged", response);
}
}; // BluetoothGattCallback

Expand Down
4 changes: 2 additions & 2 deletions lib/src/bluetooth_device.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ class BluetoothDevice {
.map((p) => p.mtu);
}

/// Request to change MTU
/// Request to change MTU (Android Only)
/// - returns new MTU
Future<int> requestMtu(int desiredMtu, {int timeout = 15}) async {
var request = BmMtuSizeRequest(
var request = BmMtuChangeRequest(
remoteId: remoteId.str,
mtu: desiredMtu,
);
Expand Down
6 changes: 3 additions & 3 deletions lib/src/bluetooth_msgs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -744,17 +744,17 @@ class BmConnectedDevicesResponse {
}
}

class BmMtuSizeRequest {
class BmMtuChangeRequest {
final String remoteId;
final int mtu;

BmMtuSizeRequest({required this.remoteId, required this.mtu});
BmMtuChangeRequest({required this.remoteId, required this.mtu});

Map<dynamic, dynamic> toMap() {
final Map<dynamic, dynamic> data = {};
data['remote_id'] = remoteId;
data['mtu'] = mtu;
_printDbg("\nBmMtuSizeRequest $data");
_printDbg("\nBmMtuChangeRequest $data");
return data;
}
}
Expand Down

0 comments on commit 2e2de93

Please sign in to comment.