From a1ffb459f836dda7430cf36fa72b31b085337a27 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 8 Mar 2024 14:16:02 -0600 Subject: [PATCH] Added command to listen to protobuf stream --- .vscode/launch.json | 8 ++++++++ meshtastic/__main__.py | 11 ++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 6676991e..aca86dde 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -44,6 +44,14 @@ "justMyCode": true, "args": ["--debug"] }, + { + "name": "meshtastic listen", + "type": "python", + "request": "launch", + "module": "meshtastic", + "justMyCode": true, + "args": ["--listen", "--debug"] + }, { "name": "meshtastic debug getPref", "type": "python", diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index 6a2f31c4..0077ce08 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -761,6 +761,9 @@ def setSimpleConfig(modem_preset): qr = pyqrcode.create(url) print(qr.terminal()) + if args.listen: + closeNow = False + have_tunnel = platform.system() == "Linux" if have_tunnel and args.tunnel: # pylint: disable=C0415 @@ -987,7 +990,7 @@ def common(): have_tunnel = platform.system() == "Linux" if ( - args.noproto or args.reply or (have_tunnel and args.tunnel) + args.noproto or args.reply or (have_tunnel and args.tunnel) or args.listen ): # loop until someone presses ctrlc while True: time.sleep(1000) @@ -1335,6 +1338,12 @@ def initParser(): action="store_true", ) + parser.add_argument( + "--listen", + help="Just stay open and listen to the protobuf stream.", + action="store_true", + ) + have_tunnel = platform.system() == "Linux" if have_tunnel: parser.add_argument(