mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-18 00:32:38 +00:00
Add RAK4631 Ethernet Gateway with working JSON output to MQTT
This commit is contained in:
@@ -379,13 +379,13 @@ void MQTT::sendSubscriptions()
|
||||
std::string topic = cryptTopic + channels.getGlobalId(i) + "/+";
|
||||
LOG_INFO("Subscribing to %s\n", topic.c_str());
|
||||
pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right?
|
||||
#ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804
|
||||
// #ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJSON ###
|
||||
if (moduleConfig.mqtt.json_enabled == true) {
|
||||
std::string topicDecoded = jsonTopic + channels.getGlobalId(i) + "/+";
|
||||
LOG_INFO("Subscribing to %s\n", topicDecoded.c_str());
|
||||
pubSub.subscribe(topicDecoded.c_str(), 1); // FIXME, is QOS 1 right?
|
||||
}
|
||||
#endif // ARCH_NRF52
|
||||
// #endif // ARCH_NRF52
|
||||
}
|
||||
}
|
||||
#if !MESHTASTIC_EXCLUDE_PKI
|
||||
@@ -480,7 +480,7 @@ void MQTT::publishQueuedMessages()
|
||||
|
||||
publish(topic.c_str(), bytes, numBytes, false);
|
||||
|
||||
#ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804
|
||||
// #ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJson ###
|
||||
if (moduleConfig.mqtt.json_enabled) {
|
||||
// handle json topic
|
||||
auto jsonString = MeshPacketSerializer::JsonSerialize(env->packet);
|
||||
@@ -496,7 +496,7 @@ void MQTT::publishQueuedMessages()
|
||||
publish(topicJson.c_str(), jsonString.c_str(), false);
|
||||
}
|
||||
}
|
||||
#endif // ARCH_NRF52
|
||||
// #endif // ARCH_NRF52
|
||||
mqttPool.release(env);
|
||||
}
|
||||
}
|
||||
@@ -562,7 +562,7 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp, const meshtastic_MeshPacket &
|
||||
|
||||
publish(topic.c_str(), bytes, numBytes, false);
|
||||
|
||||
#ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804
|
||||
// #ifndef ARCH_NRF52 // JSON is not supported on nRF52, see issue #2804 ### Fixed by using ArduinoJson ###
|
||||
if (moduleConfig.mqtt.json_enabled) {
|
||||
// handle json topic
|
||||
auto jsonString = MeshPacketSerializer::JsonSerialize((meshtastic_MeshPacket *)&mp_decoded);
|
||||
@@ -573,7 +573,7 @@ void MQTT::onSend(const meshtastic_MeshPacket &mp, const meshtastic_MeshPacket &
|
||||
publish(topicJson.c_str(), jsonString.c_str(), false);
|
||||
}
|
||||
}
|
||||
#endif // ARCH_NRF52
|
||||
// #endif // ARCH_NRF52
|
||||
} else {
|
||||
LOG_INFO("MQTT not connected, queueing packet\n");
|
||||
if (mqttQueue.numFree() == 0) {
|
||||
|
||||
Reference in New Issue
Block a user