diff --git a/src/meshcore/commands/messaging.py b/src/meshcore/commands/messaging.py index 830f5ec..492ba06 100644 --- a/src/meshcore/commands/messaging.py +++ b/src/meshcore/commands/messaging.py @@ -328,7 +328,7 @@ class MessagingCommands(CommandHandlerBase): return Event(EventType.ERROR, {"reason": "unsupported_path_type"}) # Prepare the command packet: CMD(1) + tag(4) + auth_code(4) + flags(1) + [path] - cmd_data = bytearray([36]) # CMD_SEND_TRACE_PATH + cmd_data = bytearray([CommandType.SEND_TRACE_PATH.value]) # CMD_SEND_TRACE_PATH cmd_data.extend(tag.to_bytes(4, "little")) cmd_data.extend(auth_code.to_bytes(4, "little")) cmd_data.append(flags) @@ -366,7 +366,7 @@ class MessagingCommands(CommandHandlerBase): if len(payload) < 4: raise ValueError("payload must be at least 4 bytes") path = bytes(path) - data = bytes([0x19, len(path)]) + path + bytes(payload) + data = bytes([CommandType.SEND_RAW_DATA.value, len(path)]) + path + bytes(payload) return await self.send(data, [EventType.OK, EventType.ERROR]) async def send_channel_data( @@ -401,7 +401,7 @@ class MessagingCommands(CommandHandlerBase): if len(path) >= 0xFF: raise ValueError("path must be shorter than 255 bytes") path_bytes = bytes([len(path)]) + path - data = bytes([0x3E, chan]) + path_bytes + data_type.to_bytes(2, "little") + bytes(payload) + data = bytes([CommandType.SEND_CHANNEL_DATA.value, chan]) + path_bytes + data_type.to_bytes(2, "little") + bytes(payload) return await self.send(data, [EventType.OK, EventType.ERROR]) async def set_flood_scope(self, scope, force_unscoped=False): diff --git a/src/meshcore/packets.py b/src/meshcore/packets.py index 7c6d679..26a5462 100644 --- a/src/meshcore/packets.py +++ b/src/meshcore/packets.py @@ -86,6 +86,7 @@ class CommandType(Enum): GET_ALLOWED_REPEAT_FREQ = 60 GET_STATS = 56 # R04: CMD_GET_STATS — used by get_stats_core/radio/packets SET_PATH_HASH_MODE = 61 + SEND_CHANNEL_DATA = 62 SET_DEFAULT_FLOOD_SCOPE = 63 GET_DEFAULT_FLOOD_SCOPE = 64 SEND_RAW_PACKET = 65