Skip to content

Commit

Permalink
add topic-string to json-fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Teikahym committed Apr 8, 2021
1 parent 2d1eb4f commit 42f61be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void quackJson(std::vector<byte> packetBuffer) {
Serial.println("[PAPI] Packet Received:");
Serial.println("[PAPI] sduid: " + String(sduid.c_str()));
Serial.println("[PAPI] dduid: " + String(dduid.c_str()));

Serial.println("[PAPI] topic: " + String(toTopicString(packet.topic).c_str()));
Serial.println("[PAPI] muid: " + String(muid.c_str()));
Serial.println("[PAPI] path: " + String(path.c_str()));
Serial.println("[PAPI] data: " + String(payload.c_str()));
Expand All @@ -196,10 +196,10 @@ void quackJson(std::vector<byte> packetBuffer) {
doc["path"].set(path);
doc["hops"].set(packet.hopCount);
doc["duckType"].set(packet.duckType);
doc["topic"].set(toTopicString(packet.topic));

std::string cdpTopic = toTopicString(packet.topic);

std::string topic = "iot-2/evt/" + cdpTopic + "/fmt/json";
//std::string cdpTopic = toTopicString(packet.topic);
//std::string topic = "iot-2/evt/" + cdpTopic + "/fmt/json";

String jsonstat;
serializeJson(doc, jsonstat);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ void quackJson(std::vector<byte> packetBuffer) {
doc["path"].set(path);
doc["hops"].set(packet.hopCount);
doc["duckType"].set(packet.duckType);
doc["topic"].set(toTopicString(packet.topic));

String jsonstat;
serializeJson(doc, Serial);
Expand Down

0 comments on commit 42f61be

Please sign in to comment.