Skip to content
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

During init() support raising a "BLE is unsupported" #533

Merged
merged 2 commits into from
May 11, 2021
Merged
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions bleak/backends/corebluetooth/CentralManagerDelegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def init(self):
# It doesn't take long for the callback to occur, so we should be able
# to do a blocking wait here without anyone complaining.
self._did_update_state_event.wait(1)

if self.central_manager.state() == CBManagerStateUnsupported:
raise BleakError("BLE is unsupported")

if self.central_manager.state() != CBManagerStatePoweredOn:
raise BleakError("Bluetooth device is turned off")

Expand Down