laptou / bluez-rs

Control Bluetooth on Linux.
MIT License
39 stars 9 forks source link

Allow duplicate entries to be discovered #6

Open skreborn opened 4 years ago

skreborn commented 4 years ago

I'm looking for a way to continually discover beacons that use simple advertising packets to emit telemetry data (among others). Is there a way to run discovery in a way that would allow me to capture and process all these packets, even if multiple packets are sent from the same device?

laptou commented 4 years ago

I've never tried to do something like this myself. What's the current behaviour, and how is this stopping you from achieving your goal?

dbrgn commented 4 years ago

Right now when starting discovery, a node that is broadcasting multiple advertisement frames with different data will only be discovered once. For using beacons as a means to transfer data, the user would need to see every advertisement frame.

Furthermore, right now discovery always seems to be active, while processing beacon data would only require passive scans.

The best interface in this case would probably be an event for every incoming raw (or parsed, but complete) advertisement frame. This way the user could process the advertisement data as appropriate.

I'm not sure if I overlooked it, but right now there's no such interface, right?

oxc commented 4 years ago

I believe you have to add the device using AddDevice with BackgroundScan action. Then you'll get a passive scan with multiple events.

Afaict, the kernel mgmt interface does not allow for explicitly starting a passive scan in any other way.

Please note that removing the device from the list is currently broken (#14).