Broadcast neighbor info

also update trunk
This commit is contained in:
Thomas Göttgens
2023-05-31 13:18:09 +02:00
parent b1398d0770
commit 61661aed50
10 changed files with 390 additions and 8 deletions

View File

@@ -544,6 +544,24 @@ std::string MQTT::downstreamPacketToJson(meshtastic_MeshPacket *mp)
};
break;
}
case meshtastic_PortNum_NEIGHBORINFO_APP: {
msgType = "neighborinfo";
meshtastic_NeighborInfo scratch;
meshtastic_NeighborInfo *decoded = NULL;
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
memset(&scratch, 0, sizeof(scratch));
if (pb_decode_from_bytes(mp->decoded.payload.bytes, mp->decoded.payload.size, &meshtastic_NeighborInfo_msg,
&scratch)) {
decoded = &scratch;
msgPayload["node_id"] = new JSONValue((int)decoded->node_id);
msgPayload["neighbors_count"] = new JSONValue((int)decoded->neighbors_count);
msgPayload["neighbors"] = new JSONValue(decoded->neighbors);
} else {
LOG_ERROR("Error decoding protobuf for neighborinfo message!\n");
}
};
break;
}
// add more packet types here if needed
default:
break;