add channel index to send text

This commit is contained in:
Mike Kinney
2021-12-20 14:00:56 -08:00
parent 23d946baaa
commit 4597ea1898
2 changed files with 7 additions and 4 deletions

View File

@@ -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)

View File

@@ -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