Skip to content

Commit 2599b97

Browse files
committed
take transport codes into account in echoes
1 parent 1b21ec8 commit 2599b97

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/meshcore_cli/meshcore_cli.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,20 @@ async def handle_log_rx(event):
210210
pkt = bytes().fromhex(event.payload["payload"])
211211

212212
if handle_log_rx.channel_echoes:
213-
if pkt[0] == 0x15:
213+
if pkt[0] & ~1 == 0x14:
214214
chan_name = ""
215-
path_len = pkt[1]
216-
path = pkt[2:path_len+2].hex()
217-
chan_hash = pkt[path_len+2:path_len+3].hex()
218-
cipher_mac = pkt[path_len+3:path_len+5]
219-
msg = pkt[path_len+5:]
215+
if pkt[0] & 1: #no transport code
216+
path_len = pkt[1]
217+
path = pkt[2:path_len+2].hex()
218+
path_end = path_len+2
219+
else:
220+
path_len = pkt[5]
221+
path = pkt[6:path_len+6].hex()
222+
path_end = path_len+6
223+
224+
chan_hash = pkt[path_end:path_end+1].hex()
225+
cipher_mac = pkt[path_end+1:path_end+3]
226+
msg = pkt[path_end+3:]
220227
channel = None
221228
for c in await get_channels(mc):
222229
if c["channel_hash"] == chan_hash : # validate against MAC

0 commit comments

Comments
 (0)