Skip to content

Commit 49bd9cb

Browse files
committed
Support --ble on older firmwares that don't have the log-radio characteristic yet.
1 parent 33c5be5 commit 49bd9cb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

meshtastic/ble_interface.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def __init__(
5656
self.close()
5757
raise e
5858

59-
self.client.start_notify(LOGRADIO_UUID, self.log_radio_handler)
59+
if self.client.has_characteristic(LOGRADIO_UUID):
60+
self.client.start_notify(LOGRADIO_UUID, self.log_radio_handler)
6061

6162
logging.debug("Mesh configure starting")
6263
self._startConfig()
@@ -248,6 +249,12 @@ def read_gatt_char(self, *args, **kwargs): # pylint: disable=C0116
248249
def write_gatt_char(self, *args, **kwargs): # pylint: disable=C0116
249250
self.async_await(self.bleak_client.write_gatt_char(*args, **kwargs))
250251

252+
def has_characteristic(self, specifier):
253+
if self.bleak_client.services.get_characteristic(specifier):
254+
return True
255+
else:
256+
return False
257+
251258
def start_notify(self, *args, **kwargs): # pylint: disable=C0116
252259
self.async_await(self.bleak_client.start_notify(*args, **kwargs))
253260

0 commit comments

Comments
 (0)