Closed theedov closed 1 year ago
Hi! You can wrap the call to try await manager.connect(restoredPeripheral)
in a Task
, store it, and then cancel it before attempting to reconnect again. This is a bit of a pain though. I'm looking at other options. Something I've been thinking is exposing a flush
method that clients can call when, for example, bluetooth is turned off. Anyway, please let me know if this works.
There's now a cancelAllOperations
call you can make to flush all awaits. There's an example in the README, but tl;dr; you can call manager.cancelAllOperations()
when the state switches to .poweredOff
.
Hello,
I'm facing this weird issue. When a peripheral is in state where it's trying to connect, I disable bluetooth and enable it back(basically interrupting the process). The connection is then stuck and this message printed every time I manually try to reconnect:
The problem is, it's not connecting even after 10 min. The only way to get the device reconnected is to kill the app.
Here is my reconnection code:
I'm not sure if it's a bug, or if I'm doing something wrong. Can't seem to find a way to cancel any pending connections.