Skip to content

Commit 0fb72b8

Browse files
Only allow PRIVATE_APP custom port
1 parent 74c911c commit 0fb72b8

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

meshtastic/__main__.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -442,15 +442,15 @@ def onConnected(interface):
442442
channelIndex = mt_config.channel_index or 0
443443
if checkChannel(interface, channelIndex):
444444
print(
445-
f"Sending text message {args.sendtext} to {args.dest}:{args.textport} on channelIndex:{channelIndex}"
445+
f"Sending text message {args.sendtext} to {args.dest} on channelIndex:{channelIndex} {"using PRIVATE_APP port" if args.private else ""}"
446446
)
447447
interface.sendText(
448448
args.sendtext,
449449
args.dest,
450450
wantAck=True,
451451
channelIndex=channelIndex,
452452
onResponse=interface.getNode(args.dest, False, **getNode_kwargs).onAckNak,
453-
portNum=args.textport
453+
portNum=portnums_pb2.PortNum.PRIVATE_APP if args.private else portnums_pb2.PortNum.TEXT_MESSAGE_APP
454454
)
455455
else:
456456
meshtastic.util.our_exit(
@@ -1593,16 +1593,14 @@ def addRemoteActionArgs(parser: argparse.ArgumentParser) -> argparse.ArgumentPar
15931593

15941594
group.add_argument(
15951595
"--sendtext",
1596-
help="Send a text message. Can specify a destination '--dest', port '--textport', and/or channel index '--ch-index'.",
1596+
help="Send a text message. Can specify a destination '--dest', use of PRIVATE_APP port '--private', and/or channel index '--ch-index'.",
15971597
metavar="TEXT",
15981598
)
15991599

1600-
group.add_argument(
1601-
"--textport",
1602-
help="Optional argument for sending text messages to the non default port. Use in combination with --sendtext.",
1603-
type=int,
1604-
default=portnums_pb2.PortNum.TEXT_MESSAGE_APP,
1605-
metavar="PORT"
1600+
group.add_argument(
1601+
"--private",
1602+
help="Optional argument for sending text messages to the PRIVATE_APP port. Use in combination with --sendtext.",
1603+
action="store_true"
16061604
)
16071605

16081606
group.add_argument(

0 commit comments

Comments
 (0)