manolofdez / AsyncBluetooth

A small library that adds concurrency to CoreBluetooth APIs.
MIT License
160 stars 30 forks source link

Task Cancellation #18

Closed mickeyl closed 1 year ago

mickeyl commented 1 year ago

Is Task Cancellation implemented? For me it looks like the manager continues to scan in the background even after I cancelled the task from which the scan was started.

manolofdez commented 1 year ago

Hi! Yes, cancelation is implemented. You can cancel any bluetooth command to stop awaiting for a response. If the command is in a queue, it will get removed. You are correct that cancelling the start scanning task won't stop scanning. Since each command in AsyncBluetooth is written to mimmic what you would find in Core Bluetooth, there's an explicit stopScan command.