Merge remote-tracking branch 'origin/master' into protobuf-ble-logging

This commit is contained in:
Ben Meadors
2024-07-01 06:18:32 -05:00
2 changed files with 25 additions and 13 deletions

View File

@@ -1442,16 +1442,6 @@ def initParser():
"--reply", help="Reply to received messages", action="store_true"
)
group.add_argument(
"--gpio-wrb", nargs=2, help="Set a particular GPIO # to 1 or 0", action="append"
)
group.add_argument("--gpio-rd", help="Read from a GPIO mask (ex: '0x10')")
group.add_argument(
"--gpio-watch", help="Start watching a GPIO mask for changes (ex: '0x10')"
)
group.add_argument(
"--no-time",
help="Suppress sending the current time to the mesh",
@@ -1490,7 +1480,7 @@ def initParser():
"--pos-fields",
help="Specify fields to send when sending a position. Use no argument for a list of valid values. "
"Can pass multiple values as a space separated list like "
"this: '--pos-fields POS_ALTITUDE POS_ALT_MSL'",
"this: '--pos-fields ALTITUDE HEADING SPEED'",
nargs="*",
action="store",
)
@@ -1531,6 +1521,21 @@ def initParser():
action="store_true",
)
remoteHardwareArgs = parser.add_argument_group('Remote Hardware', 'Arguments related to the Remote Hardware module')
remoteHardwareArgs.add_argument(
"--gpio-wrb", nargs=2, help="Set a particular GPIO # to 1 or 0", action="append"
)
remoteHardwareArgs.add_argument(
"--gpio-rd", help="Read from a GPIO mask (ex: '0x10')"
)
remoteHardwareArgs.add_argument(
"--gpio-watch", help="Start watching a GPIO mask for changes (ex: '0x10')"
)
have_tunnel = platform.system() == "Linux"
if have_tunnel:
tunnelArgs = parser.add_argument_group('Tunnel', 'Arguments related to establishing a tunnel device over the mesh.')

View File

@@ -61,8 +61,11 @@ class BLEInterface(MeshInterface):
self.close()
raise e
#self.client.start_notify(LEGACY_LOGRADIO_UUID, self.legacy_log_radio_handler)
self.client.start_notify(LOGRADIO_UUID, self.log_radio_handler)
if self.client.has_characteristic(LEGACY_LOGRADIO_UUID):
self.client.start_notify(LEGACY_LOGRADIO_UUID, self.legacy_log_radio_handler)
if self.client.has_characteristic(LOGRADIO_UUID):
self.client.start_notify(LOGRADIO_UUID, self.log_radio_handler)
logging.debug("Mesh configure starting")
self._startConfig()
@@ -270,6 +273,10 @@ class BLEClient:
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))
def start_notify(self, *args, **kwargs): # pylint: disable=C0116
self.async_await(self.bleak_client.start_notify(*args, **kwargs))