chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
791 stars 479 forks source link

[Feature]: Cancel connect() #753

Closed elliotrtd closed 10 months ago

elliotrtd commented 10 months ago

FlutterBluePlus Version

1.30.6

Flutter Version

3.16.5

What OS?

All

OS Version

Android 13 / iOS 16

Bluetooth Module

N/A

What is your feature request?

I work with multiple devices and automatically handle my own reconnects if a device is lost (swappable batteries means it could disconnect but the user would want to pick up where they left off when a new battery goes in).

In some cases I would then want to cancel connecting and forcibly disconnect the device but disconnect() does nothing if connect() is still running. If connect() could return an object that could then also be cancelled that would allow me to force it to disconnect when needed.

I am conscious that this may not be possible but a Quick Look in to the Java code suggested there was a variable for currentlyConnectingDevices.

Alternatively maybe disconnect() could check if the devices is in the currentlyConnectingDevices and subsequently cancel this.

Logs

-
elliotrtd commented 10 months ago

Closed this - I realised that this can be done with the queue parameter - sorry ;)