From 8be27e4e942a2c84113836f34f5b4d1d4f25cb18 Mon Sep 17 00:00:00 2001 From: agessaman Date: Sat, 25 Apr 2026 17:02:41 -0700 Subject: [PATCH] refactor(mqtt): reorganize packet message structure in MQTTMessageBuilder Updated the buildPacketMessage function to improve the structure of the JSON object being built. The 'origin_id' field has been moved to a later position, and the 'hash' field has been added to enhance the packet's metadata. This change aims to streamline the message format for better clarity and consistency. --- src/helpers/MQTTMessageBuilder.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/MQTTMessageBuilder.cpp b/src/helpers/MQTTMessageBuilder.cpp index 8332108f1..4648a70c4 100644 --- a/src/helpers/MQTTMessageBuilder.cpp +++ b/src/helpers/MQTTMessageBuilder.cpp @@ -117,9 +117,9 @@ int MQTTMessageBuilder::buildPacketMessage( snprintf(snr_str, sizeof(snr_str), "%.1f", snr); snprintf(rssi_str, sizeof(rssi_str), "%d", rssi); - root["origin"] = origin; - root["origin_id"] = origin_id; root["timestamp"] = timestamp; + root["origin"] = origin; + root["hash"] = hash; root["type"] = "PACKET"; root["direction"] = direction; root["time"] = time; @@ -129,12 +129,12 @@ int MQTTMessageBuilder::buildPacketMessage( root["route"] = route; root["payload_len"] = payload_len_str; root["raw"] = raw; + root["origin_id"] = origin_id; // SNR and RSSI are only meaningful for RX packets (received from radio) if (strcmp(direction, "rx") == 0) { root["SNR"] = snr_str; root["RSSI"] = rssi_str; } - root["hash"] = hash; if (path && strlen(path) > 0) { root["path"] = path;