diff --git a/.vscode/launch.json b/.vscode/launch.json index 6676991..aca86dd 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 6a2f31c..0077ce0 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -761,6 +761,9 @@ def onConnected(interface): 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(