I have code that scans for BLE devices and then tries to get services to determine if a device provides the service i need (heart rate or cycling speed/cadence). I do the initial scan in 4 seconds, but connecting to each device and checking services takes over 60 seconds (for 3 devices). I could try to use multiple threads if bluepy could handle it, but is there a better way?
What I wanted is:
1. User selects to connect with a heart rate sensor
2. Perform BLE scan
3. Filter out devices by service
4. Show use all heart rate sensors
The problem is with devices that I'm not interested in - they refuse connection and I wait for time out. I may end up with user selecting the device and then I can verify if the device provides what's needed, but i don't like that. Another idea is to build a local list with 'bad' addresses, so only the first scan would be very long, but it's a workaround, not a proper solution.
Any ideas how to solve it?
Edit: bluepy ScanEntry has a field 'connectable' that provides required info, so I can skip problematic devices. More here: https://ianharvey.github.io/bluepy-doc/scanentry.html