deviceplug / btleplug

Rust Cross-Platform Host-Side Bluetooth LE Access Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

start_scan when scanning is already in progress

hansmbakker opened this issue · comments

If for some reason Adapter.start_scan() is called multiple times (e.g. because of running an app multiple time before the first scan is stopped) then I get an error on Linux:
DbusError(D-Bus error: Operation already in progress (org.bluez.Error.InProgress))

I believe there is currently no way to do this safe. The Adapter.session property is private and I'm not sure if that would give a way to check whether a scan is in progress.

Platform: linux
Btleplug version: 0.9.2

What I did to hotfix this bug in my program is to call Adapter.stop_scan() before any adapter.start_scan()

Link to the code