mirror of
https://github.com/meshtastic/python.git
synced 2025-12-30 03:17:54 -05:00
add channel index to send text
This commit is contained in:
@@ -240,11 +240,14 @@ def onConnected(interface):
|
||||
|
||||
if args.sendtext:
|
||||
closeNow = True
|
||||
channelIndex = 0
|
||||
if args.ch_index is not None:
|
||||
channelIndex = int(args.ch_index)
|
||||
print(f"Sending text message {args.sendtext} to {args.destOrAll}")
|
||||
interface.sendText(args.sendtext, args.destOrAll, wantAck=True)
|
||||
interface.sendText(args.sendtext, args.destOrAll, wantAck=True, channelIndex=channelIndex)
|
||||
|
||||
if args.sendping:
|
||||
print(f"Sending ping message {args.sendtext} to {args.destOrAll}")
|
||||
print(f"Sending ping message {args.sendping} to {args.destOrAll}")
|
||||
payload = str.encode("test string")
|
||||
interface.sendData(payload, args.destOrAll, portNum=portnums_pb2.PortNum.REPLY_APP,
|
||||
wantAck=True, wantResponse=True)
|
||||
|
||||
@@ -404,7 +404,7 @@ def test_main_sendtext(capsys, reset_globals):
|
||||
Globals.getInstance().set_args(sys.argv)
|
||||
|
||||
iface = MagicMock(autospec=SerialInterface)
|
||||
def mock_sendText(text, dest, wantAck):
|
||||
def mock_sendText(text, dest, wantAck, channelIndex):
|
||||
print('inside mocked sendText')
|
||||
iface.sendText.side_effect = mock_sendText
|
||||
|
||||
@@ -425,7 +425,7 @@ def test_main_sendtext_with_dest(capsys, reset_globals):
|
||||
Globals.getInstance().set_args(sys.argv)
|
||||
|
||||
iface = MagicMock(autospec=SerialInterface)
|
||||
def mock_sendText(text, dest, wantAck):
|
||||
def mock_sendText(text, dest, wantAck, channelIndex):
|
||||
print('inside mocked sendText')
|
||||
iface.sendText.side_effect = mock_sendText
|
||||
|
||||
|
||||
Reference in New Issue
Block a user