support bleak 0.19.0 and up #58
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
bleak
version was pinned to 0.11.0 in the early days of this library, whenbleak
was undergoing a lot of API churn. That may have also prevented advancing the supported Python version (the guide recommended Python 3.8). There have been many changes, fixes, and improvements tobleak
since then. As an example, the Windows backend now uses a different lower-level lirbrary.Updated to handle API changes in
bleak
from 0.19.0 on.Tested using
adafruit_ble_heart_rate
withbleak
0.20.1, on Linux, macoS 13.2.1 and 13.3, Windows 10, and Windows 11, with Python 3.10.x and 3.11.x. Works on all, except that on Windows, the default timeout forBLERadio.connect()
, which is 4 seconds seems to be too short at least some of the time. I increased it to 10 seconds and it connects successfully. Once it has connected once, further connects are faster. I may change the timeout there after this is released; at the very least I will document the issue in the Learn Guide, https://learn.adafruit.com/circuitpython-ble-libraries-on-any-computer.EDIT: Tested on latest RPI bullseye as well. Works, after lengthening connection timeout to 10 seconds, as I had to do for Windows. This confirms it's a good idea to change the default.
Fixes #41.
Fixes #45.