Skip to content

Add HCI support #103

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 3 commits into from
Sep 8, 2020
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