Skip to content

Commit

Permalink
Fixed ble-disconnect: use controller after subscription cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasDem14 committed Mar 29, 2022
1 parent c70d2f2 commit 6bc44af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/datalink/ble/ble_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ class BleClient extends ServiceClient {
/// Cancels the connection with the remote device.
@override
Future<void> disconnect() async {
stopListening();
if (_connectionSub != null) {
// Abort connection with the remote host
_connectionSub!.cancel();
// Notify upper layer of a connection aborted
controller.add(AdHocEvent(CONNECTION_ABORTED, _device.mac));
}
stopListening();
}

/// Sends a [message] to the remote device.
Expand Down

0 comments on commit 6bc44af

Please sign in to comment.