IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.6k stars 490 forks source link

Change the state changed to at the end of a scan from disconnected. #350

Closed johnfwhitmore closed 5 years ago

johnfwhitmore commented 5 years ago

This resolves an issue when scanning whilst currently connected to devices.

This might not be a good fix to the issue I'm having, and possibly further testing will shed some light onto a better fix, for this will possibly result in comments from maintainers who have a better idea what is going on.

The problem I'm having is probably very dependant on the use case I'm working on. Basically I'm connecting to a number of Bluetooth LE Sensors. Now the sensors can be powered on asynchronously so to facilitate that I perform a scan for 10 seconds every minute, connecting to any sensors which have powered up.

The problem is that scanning for new sensors disconnects any previously connected sensors. To get around that issue I've simply changed the state transitioned to at the end of a scan. This is a quick and dirty fix and the only reason I'm creating this pull request is in search of comments on the issue.

johnfwhitmore commented 5 years ago

closing this PR as I have to add a number of other changes. I put this change directly into my master branch so I'm going to change that to create a new branch for my changes.