Skip to content
Merged

Master #1862

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0
`Unreleased`_
=============

`2.0.0`_ (2025-11-22)
=====================

Added
-----
* Added ``bleak.backends.get_default_backend()`` and ``BleakBackend`` enum for a centralized backend detection.
* Added ``BleakClient().backend_id`` and ``BleakScanner().backend_id`` properties to identify the backend in use.

Changed
-------
* Use AcquireNotify rather than StartNotify for Linux backend on supported characteristics
* Allow multiple calls to ``disconnect()`` on Windows to align behaviour over all backends.
* Use ``"AcquireNotify"`` rather than ``"StartNotify"`` for Linux backend on supported characteristics
* Allow multiple calls to ``disconnect()`` on Windows to align behavior over all backends.
* Raise new ``BleakBluetoothNotAvailableError`` when Bluetooth is not supported, turned off or permission is denied.

Fixed
Expand Down Expand Up @@ -1144,7 +1147,8 @@ Fixed
* Bleak created.


.. _Unreleased: https://github.com/hbldh/bleak/compare/v1.1.1...develop
.. _Unreleased: https://github.com/hbldh/bleak/compare/v2.0.0...develop
.. _2.0.0: https://github.com/hbldh/bleak/compare/v1.1.1...v2.0.0
.. _1.1.1: https://github.com/hbldh/bleak/compare/v1.1.0...v1.1.1
.. _1.1.0: https://github.com/hbldh/bleak/compare/v1.0.1...v1.1.0
.. _1.0.1: https://github.com/hbldh/bleak/compare/v1.0.0...v1.0.1
Expand Down
6 changes: 3 additions & 3 deletions bleak/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def backend_id(self) -> BleakBackend | str:
The value is one of the :class:`BleakBackend` enum values in case of
built-in backends, or a string identifying a custom backend.

.. versionadded:: unreleased
.. versionadded:: 2.0
"""
return self._backend_id

Expand All @@ -172,7 +172,7 @@ async def start(self) -> None:
BleakBluetoothNotAvailableError:
if Bluetooth is not currently available

.. versionchanged:: unreleased
.. versionchanged:: 2.0
Now raises :class:`BleakBluetoothNotAvailableError` instead of :class:`BleakError`
when Bluetooth is not currently available.
"""
Expand Down Expand Up @@ -547,7 +547,7 @@ def backend_id(self) -> BleakBackend | str:
The value is one of the :class:`BleakBackend` enum values in case of
built-in backends, or a string identifying a custom backend.

.. versionadded:: unreleased
.. versionadded:: 2.0
"""
return self._backend_id

Expand Down
4 changes: 2 additions & 2 deletions bleak/backends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BleakBackend(str, enum.Enum):
"""
Identifiers for available built-in Bleak backends.

.. versionadded:: unreleased
.. versionadded:: 2.0
"""

P4ANDROID = "p4android"
Expand Down Expand Up @@ -52,7 +52,7 @@ def get_default_backend() -> BleakBackend:
"""
Returns the preferred backend for the current platform/environment.

.. versionadded:: unreleased
.. versionadded:: 2.0
"""
if os.environ.get("P4A_BOOTSTRAP") is not None:
return BleakBackend.P4ANDROID
Expand Down
2 changes: 1 addition & 1 deletion bleak/backends/bluezdbus/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def get_default_adapter(self) -> str:
BleakBluetoothNotAvailableError:
if there are no Bluetooth Low Energy adapters or if none of the adapters are powered

.. versionchanged:: unreleased
.. versionchanged:: 2.0
Now raises :class:`BleakBluetoothNotAvailableError` instead of :class:`BleakError`.
"""
if not any(self._adapters):
Expand Down
4 changes: 2 additions & 2 deletions bleak/exc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class BleakBluetoothNotAvailableReason(enum.Enum):
"""
Reasons for Bluetooth not being available.

.. versionadded:: unreleased
.. versionadded:: 2.0
"""

NO_BLUETOOTH = enum.auto()
Expand Down Expand Up @@ -57,7 +57,7 @@ class BleakBluetoothNotAvailableError(BleakError):
"""
Exception which is raised if the Bluetooth access is not available for some reason.

.. versionadded:: unreleased
.. versionadded:: 2.0
"""

def __init__(self, msg: str, reason: BleakBluetoothNotAvailableReason) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "bleak"
version = "1.1.1"
version = "2.0.0"
description = "Bluetooth Low Energy platform Agnostic Klient"
authors = [{ name = "Henrik Blidh", email = "[email protected]" }]
license = "MIT"
Expand Down
Loading