mirror of
https://github.com/agessaman/meshcore-bot.git
synced 2026-10-23 06:12:19 +00:00
Enhance TRACE payload handling and path extraction in message processing
- Updated `update_mesh_graph_from_trace_data` to clarify the format of `path_hashes` as per-hop hash strings from the trace payload. - Modified `MessageHandler` to differentiate between TRACE packets and regular transmissions, preventing incorrect extraction of repeater prefixes from RF path bytes. - Introduced `parse_trace_payload_route_hashes` utility to extract TRACE route hash segments from payloads, ensuring accurate handling of path data. - Enhanced `PacketCaptureService` to correctly populate packet information for TRACE packets, including SNR path and route hashes. - Expanded test coverage for TRACE payload decoding and path extraction to validate functionality and correctness. These changes improve the accuracy and reliability of TRACE data processing in the application.
This commit is contained in:
1 parent
6a7a79af3c
commit
f3e667e64f
7 files changed
+247
-76
No files matched your search
@@ -21,7 +21,7 @@ from meshcore import EventType
|
||||
from ..enums import PayloadType, PayloadVersion, RouteType
|
||||
|
||||
# Import bot's utilities for packet hash
|
||||
from ..utils import calculate_packet_hash, decode_path_len_byte
|
||||
from ..utils import calculate_packet_hash, decode_path_len_byte, parse_trace_payload_route_hashes
|
||||
|
||||
# Import MQTT client
|
||||
try:
|
||||
@@ -907,7 +907,7 @@ class PacketCaptureService(BaseServicePlugin):
|
||||
'path_byte_length': path_byte_length,
|
||||
'bytes_per_hop': bytes_per_hop,
|
||||
'path_hex': path_hex,
|
||||
'path': path_nodes, # List of hex node IDs
|
||||
'path': path_nodes, # For TRACE, RF path is SNR×4 per hop — replaced below
|
||||
'payload_hex': packet_payload.hex(),
|
||||
'payload_bytes': len(packet_payload),
|
||||
'raw_hex': raw_hex,
|
||||
@@ -916,6 +916,14 @@ class PacketCaptureService(BaseServicePlugin):
|
||||
'transport_codes': transport_codes
|
||||
}
|
||||
|
||||
# TRACE: RF path bytes are SNR samples; commanded route is in payload[9:]
|
||||
if payload_type == PayloadType.TRACE:
|
||||
packet_info['trace_snr_path_hex'] = path_hex.upper()
|
||||
trace_route = parse_trace_payload_route_hashes(packet_payload)
|
||||
if trace_route:
|
||||
packet_info['path'] = trace_route
|
||||
packet_info['path_len'] = len(trace_route)
|
||||
|
||||
return packet_info
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in new issue
Block a user