Skip to content

Commit fdf5944

Browse files
authored
Merge pull request #496 from meshtastic/listen-command
Added command to listen to protobuf stream
2 parents 8d6827d + a1ffb45 commit fdf5944

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

.vscode/launch.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444
"justMyCode": true,
4545
"args": ["--debug"]
4646
},
47+
{
48+
"name": "meshtastic listen",
49+
"type": "python",
50+
"request": "launch",
51+
"module": "meshtastic",
52+
"justMyCode": true,
53+
"args": ["--listen", "--debug"]
54+
},
4755
{
4856
"name": "meshtastic debug getPref",
4957
"type": "python",

meshtastic/__main__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,9 @@ def setSimpleConfig(modem_preset):
762762
qr = pyqrcode.create(url)
763763
print(qr.terminal())
764764

765+
if args.listen:
766+
closeNow = False
767+
765768
have_tunnel = platform.system() == "Linux"
766769
if have_tunnel and args.tunnel:
767770
# pylint: disable=C0415
@@ -988,7 +991,7 @@ def common():
988991

989992
have_tunnel = platform.system() == "Linux"
990993
if (
991-
args.noproto or args.reply or (have_tunnel and args.tunnel)
994+
args.noproto or args.reply or (have_tunnel and args.tunnel) or args.listen
992995
): # loop until someone presses ctrlc
993996
while True:
994997
time.sleep(1000)
@@ -1336,6 +1339,12 @@ def initParser():
13361339
action="store_true",
13371340
)
13381341

1342+
parser.add_argument(
1343+
"--listen",
1344+
help="Just stay open and listen to the protobuf stream.",
1345+
action="store_true",
1346+
)
1347+
13391348
have_tunnel = platform.system() == "Linux"
13401349
if have_tunnel:
13411350
parser.add_argument(

0 commit comments

Comments
 (0)