Skip to content
Merged
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
12 changes: 8 additions & 4 deletions adafruit_ble/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,12 @@ class BLERadio:
It uses this library's `Advertisement` classes and the `BLEConnection` class."""

def __init__(self, adapter=None):
if not adapter:
adapter = _bleio.adapter
self._adapter = adapter
"""If no adapter is supplied, use the built-in `_bleio.adapter`.
If no built-in adapter is available, raise `RuntimeError`.
"""
if adapter is None and _bleio.adapter is None:
raise RuntimeError("No adapter available")
self._adapter = adapter or _bleio.adapter
self._current_advertisement = None
self._connection_cache = {}

Expand Down Expand Up @@ -186,6 +189,7 @@ def start_advertising(
if scan_response:
scan_response_bytes = bytes(scan_response)

# pylint: disable=unexpected-keyword-arg
# Remove after 5.x is no longer supported.
if (
sys.implementation.name == "circuitpython"
Expand Down Expand Up @@ -347,4 +351,4 @@ def address_bytes(self):
@property
def advertising(self):
"""The advertising state"""
return self._adapter.advertising
return self._adapter.advertising # pylint: disable=no-member