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

Support --ble on older firmwares that don't have the log-radio characteristic yet #626

Merged
merged 2 commits into from
Jul 1, 2024
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
7 changes: 6 additions & 1 deletion meshtastic/ble_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
self.close()
raise e

self.client.start_notify(LOGRADIO_UUID, self.log_radio_handler)
if self.client.has_characteristic(LOGRADIO_UUID):
self.client.start_notify(LOGRADIO_UUID, self.log_radio_handler)

Check warning on line 60 in meshtastic/ble_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/ble_interface.py#L59-L60

Added lines #L59 - L60 were not covered by tests

logging.debug("Mesh configure starting")
self._startConfig()
Expand Down Expand Up @@ -248,6 +249,10 @@
def write_gatt_char(self, *args, **kwargs): # pylint: disable=C0116
self.async_await(self.bleak_client.write_gatt_char(*args, **kwargs))

def has_characteristic(self, specifier):
"""Check if the connected node supports a specified characteristic."""
return bool(self.bleak_client.services.get_characteristic(specifier))

Check warning on line 254 in meshtastic/ble_interface.py

View check run for this annotation

Codecov / codecov/patch

meshtastic/ble_interface.py#L254

Added line #L254 was not covered by tests

def start_notify(self, *args, **kwargs): # pylint: disable=C0116
self.async_await(self.bleak_client.start_notify(*args, **kwargs))

Expand Down
Loading