-
Notifications
You must be signed in to change notification settings - Fork 334
v2.0.0 #1861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
v2.0.0 #1861
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prefer `name: SomeType[T] = SomeType()` over `name = SomeType[T]()`. We have, e.g `name: list[T] = []`, in many places, so this makes the style consistent.
The `__init__()` method already ensures that `_or_patterns` is not `None` when `_scanning_mode` is `"passive"`, but the type checker cannot infer that in other methods.
Add a few more that were missed in commit a242cfb.
Rectified typo at backend/winrt/scanner.py
Change the minimum macOS version is now 10.15, because CBCentralManager.authorization is not earlier available. We will be using this in a future commit.
Add a new BleakBluetoothNotAvailableError specialized exception to be able to provide more useful error messages on how to recover from Bluetooth not being available. This exception includes a `reason` property that can be used to programatically check the reason as well. This is only implemented in the corebluetooth backend currently. Other backends will be adapted in later commits.
Drop support for Python 3.9 as it has reached end-of-life.
Give more nuanced exceptions when Bluetooth is not available on Linux.
Update poetry.lock to get latest versions and Python 3.14 support.
Document the version this was added/changed and add a few missing docstrings.
Change - bullets to * bullets in CHANGELOG.rst. This is consistent with the rest of the file.
These were added automatically be VSCode.
Check the Bluetooth adapter/radio status when starting scanning on Windows backend. This uses the new BleakBluetoothNotAvailableError with appropriate reason codes when no adapter is found, or the radio is turned off. Also, it fixes a possible deadlock when starting scanning while the radio is off which happens because of the while loop waiting for the watcher status to change from CREATED.
Add NO_BLE_CENTRAL reason to BleakBluetoothNotAvailableReason enum. In some backends, we can actually check if the Bluetooth adapter supports the BLE 'central' role required by Bleak.
… for rubicon-objc Split ObjC delegate classes into two separate classes, one with only ObjC methods and one with only Python methods. This will allow sharing more code between PyObjC and Rubicon ObjC runtimes.
Fix a missing return statement when looking up the Bluetooth address for a peripheral fails.
Various assortment of type checking fixes and improvements in the CoreBluetooth backend.
Replace `__del__` with `weakref.finalize` to ensure proper cleanup of observers. This is slightly more deterministic than relying on `__del__` which is not guaranteed to be called.
We forgot to add BleakClient.name to the docs when the property was added. Add it now. Fixes: #1854
Add try/except blocks to all delegate callbacks to catch RuntimeError exceptions that can occur if the asyncio event loop is closed while callbacks are being processed. In rare cases, one of these can be triggered while Python is shutting down causing the process to crash rather than exiting successfully.
Add new backend enum and detection function. This de-duplicates the backend detection logic. Also add new `backend_id` property to `BleakClient` and `BleakScanner` to get the backend used by each instance.
align WinRT implementation with other backends
Using StartNotify in the BlueZ backend has a similar issue as the CoreBluetooth backend in that we get the same signal that the characteristic value has changed for both notifications and reads and there isn't a way to tell the difference. Using AcquireNotify instead of StartNotify creates a pipe that only receives notifications for a single characteristic. Having this separate communication channel makes it known that the change was a notification and not a read. As a bonus, this should be more performant since it avoids a D-Bus signal on every notification (although we didn't actually measure it).
Call disconnect() on the old bus object if we have to reconnect to the D-Bus system bus. This ensures that file handles are released and we don't leak them.
We need to check the current session status *after* registering the event handler, otherwise we might miss the event if the session status changes between checking the status and registering the handler.
This pulls in some fixes to prevent leaking resources and allows us to drop a bunch of "assert reply" lines that were only there to keep type checkers happy. We still allow older versions of dbus-fast for better compatibility with existing installations.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added
bleak.backends.get_default_backend()andBleakBackendenum for a centralized backend detection.BleakClient().backend_idandBleakScanner().backend_idproperties to identify the backend in use.Changed
"AcquireNotify"rather than"StartNotify"for Linux backend on supported characteristicsdisconnect()on Windows to align behavior over all backends.BleakBluetoothNotAvailableErrorwhen Bluetooth is not supported, turned off or permission is denied.Fixed
Removed