feature-mqtt: add hop_start and hop_limit to MQTT uplink

pull/4088/head
John Gorkos - AB0OO 2024-06-12 08:22:01 -07:00
rodzic 78fd17c12e
commit 871f6854b5
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -902,7 +902,9 @@ std::string MQTT::meshPacketToJson(meshtastic_MeshPacket *mp)
jsonObj["snr"] = new JSONValue((float)mp->rx_snr); jsonObj["snr"] = new JSONValue((float)mp->rx_snr);
if (mp->hop_start != 0 && mp->hop_limit <= mp->hop_start) if (mp->hop_start != 0 && mp->hop_limit <= mp->hop_start)
jsonObj["hops_away"] = new JSONValue((unsigned int)(mp->hop_start - mp->hop_limit)); jsonObj["hops_away"] = new JSONValue((unsigned int)(mp->hop_start - mp->hop_limit));
jsonObj["hop_start"] = new JSONValue((unsigned int)(mp->hop_start));
jsonObj["hop_limit"] = new JSONValue((unsigned int)(mp->hop_limit));
// serialize and write it to the stream // serialize and write it to the stream
JSONValue *value = new JSONValue(jsonObj); JSONValue *value = new JSONValue(jsonObj);
std::string jsonStr = value->Stringify(); std::string jsonStr = value->Stringify();