From cf161dbd3d12a324916d5bdc47b3bc0b5cd819db Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Fri, 9 Jun 2023 17:24:07 +0100 Subject: [PATCH] Remove the unneeded source from the JSON except for the start of the transmission. --- DMRSlot.cpp | 14 ++++++-------- DMRSlot.h | 2 +- DStarControl.cpp | 2 -- M17Control.cpp | 2 -- NXDNControl.cpp | 16 +++++++--------- NXDNControl.h | 2 +- P25Control.cpp | 10 ++++------ P25Control.h | 2 +- YSFControl.cpp | 8 ++------ schema.json | 39 +++++++++++++++++++++++++++++++++------ 10 files changed, 55 insertions(+), 42 deletions(-) diff --git a/DMRSlot.cpp b/DMRSlot.cpp index eed76ac..962fbe3 100644 --- a/DMRSlot.cpp +++ b/DMRSlot.cpp @@ -2295,7 +2295,7 @@ void CDMRSlot::writeJSONRF(const char* action) nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); WriteJSON("DMR", json); } @@ -2344,7 +2344,7 @@ void CDMRSlot::writeJSONRF(const char* action, float duration, float ber) nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); json["duration"] = duration; json["ber"] = ber; @@ -2358,7 +2358,7 @@ void CDMRSlot::writeJSONRF(const char* action, float duration, float ber, unsign nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); json["duration"] = duration; json["ber"] = ber; @@ -2379,7 +2379,7 @@ void CDMRSlot::writeJSONNet(const char* action) nlohmann::json json; - writeJSON(json, "network", action); + writeJSON(json, action); WriteJSON("DMR", json); } @@ -2428,7 +2428,7 @@ void CDMRSlot::writeJSONNet(const char* action, float duration, float loss, floa nlohmann::json json; - writeJSON(json, "network", action); + writeJSON(json, action); json["duration"] = duration; json["loss"] = loss; @@ -2437,13 +2437,11 @@ void CDMRSlot::writeJSONNet(const char* action, float duration, float loss, floa WriteJSON("DMR", json); } -void CDMRSlot::writeJSON(nlohmann::json& json, const char* source, const char* action) +void CDMRSlot::writeJSON(nlohmann::json& json, const char* action) { - assert(source != NULL); assert(action != NULL); json["timestamp"] = CUtils::createTimestamp(); - json["source"] = source; json["action"] = action; json["slot"] = int(m_slotNo); } diff --git a/DMRSlot.h b/DMRSlot.h index 42888e0..2e940c2 100644 --- a/DMRSlot.h +++ b/DMRSlot.h @@ -174,7 +174,7 @@ private: void writeJSONNet(const char* action, float duration, float loss, float ber); void writeJSONNet(const char* action, const char* desc, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId); - void writeJSON(nlohmann::json& json, const char* source, const char* action); + void writeJSON(nlohmann::json& json, const char* action); void writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId); }; diff --git a/DStarControl.cpp b/DStarControl.cpp index c1577ab..4f13e4d 100644 --- a/DStarControl.cpp +++ b/DStarControl.cpp @@ -1423,7 +1423,6 @@ void CDStarControl::writeJSONNet(const char* action, float duration, float loss) json["duration"] = duration; json["loss"] = loss; - json["source"] = "network"; json["action"] = action; WriteJSON("D-Star", json); @@ -1438,7 +1437,6 @@ void CDStarControl::writeJSONRF(nlohmann::json& json, const char* action, float json["duration"] = duration; json["ber"] = ber; - json["source"] = "rf"; json["action"] = action; } diff --git a/M17Control.cpp b/M17Control.cpp index 7909b52..fa2e3a8 100644 --- a/M17Control.cpp +++ b/M17Control.cpp @@ -995,7 +995,6 @@ void CM17Control::writeJSONRF(nlohmann::json& json, const char* action) json["timestamp"] = CUtils::createTimestamp(); - json["source"] = "rf"; json["action"] = action; } @@ -1043,7 +1042,6 @@ void CM17Control::writeJSONNet(nlohmann::json& json, const char* action) json["timestamp"] = CUtils::createTimestamp(); - json["source"] = "network"; json["action"] = action; } diff --git a/NXDNControl.cpp b/NXDNControl.cpp index 22b159f..7417571 100644 --- a/NXDNControl.cpp +++ b/NXDNControl.cpp @@ -1176,7 +1176,7 @@ void CNXDNControl::writeJSONRF(const char* action, float duration, float ber) nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); json["duration"] = duration; json["ber"] = ber; @@ -1190,7 +1190,7 @@ void CNXDNControl::writeJSONRF(const char* action, float duration, float ber, un nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); json["duration"] = duration; json["ber"] = ber; @@ -1211,7 +1211,7 @@ void CNXDNControl::writeJSONNet(const char* action) nlohmann::json json; - writeJSON(json, "network", action); + writeJSON(json, action); WriteJSON("NXDN", json); } @@ -1246,21 +1246,19 @@ void CNXDNControl::writeJSONNet(const char* action, float duration) nlohmann::json json; - writeJSON(json, "network", action); + writeJSON(json, action); json["duration"] = duration; WriteJSON("NXDN", json); } -void CNXDNControl::writeJSON(nlohmann::json& json, const char* source, const char* action) +void CNXDNControl::writeJSON(nlohmann::json& json, const char* action) { - assert(source != NULL); assert(action != NULL); - json["timestamp"] = CUtils::createTimestamp(); - json["source"] = source; - json["action"] = action; + json["timestamp"] = CUtils::createTimestamp(); + json["action"] = action; } void CNXDNControl::writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned short srcId, const std::string& srcInfo, bool grp, unsigned short dstId) diff --git a/NXDNControl.h b/NXDNControl.h index efdabf8..9925000 100644 --- a/NXDNControl.h +++ b/NXDNControl.h @@ -112,7 +112,7 @@ private: void writeJSONNet(const char* action); void writeJSONNet(const char* action, float duration); - void writeJSON(nlohmann::json& json, const char* source, const char* action); + void writeJSON(nlohmann::json& json, const char* action); void writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned short srcId, const std::string& srcInfo, bool grp, unsigned short dstId); }; diff --git a/P25Control.cpp b/P25Control.cpp index a208021..0e69298 100644 --- a/P25Control.cpp +++ b/P25Control.cpp @@ -1230,7 +1230,7 @@ void CP25Control::writeJSONRF(const char* action, float duration, float ber) nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); json["duration"] = duration; json["ber"] = ber; @@ -1244,7 +1244,7 @@ void CP25Control::writeJSONRF(const char* action, float duration, float ber, uns nlohmann::json json; - writeJSON(json, "rf", action); + writeJSON(json, action); json["duration"] = duration; json["ber"] = ber; @@ -1276,7 +1276,7 @@ void CP25Control::writeJSONNet(const char* action, float duration, float loss) nlohmann::json json; - writeJSON(json, "network", action); + writeJSON(json, action); json["duration"] = duration; json["loss"] = loss; @@ -1284,13 +1284,11 @@ void CP25Control::writeJSONNet(const char* action, float duration, float loss) WriteJSON("P25", json); } -void CP25Control::writeJSON(nlohmann::json& json, const char* source, const char* action) +void CP25Control::writeJSON(nlohmann::json& json, const char* action) { - assert(source != NULL); assert(action != NULL); json["timestamp"] = CUtils::createTimestamp(); - json["source"] = source; json["action"] = action; } diff --git a/P25Control.h b/P25Control.h index d927da3..de4d917 100644 --- a/P25Control.h +++ b/P25Control.h @@ -128,7 +128,7 @@ private: void writeJSONNet(const char* action, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId); void writeJSONNet(const char* action, float duration, float loss); - void writeJSON(nlohmann::json& json, const char* source, const char* action); + void writeJSON(nlohmann::json& json, const char* action); void writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId); }; diff --git a/YSFControl.cpp b/YSFControl.cpp index a11b690..7492707 100644 --- a/YSFControl.cpp +++ b/YSFControl.cpp @@ -1330,9 +1330,7 @@ void CYSFControl::writeJSONRF(nlohmann::json& json, const char* action) assert(action != NULL); json["timestamp"] = CUtils::createTimestamp(); - - json["source"] = "rf"; - json["action"] = action; + json["action"] = action; } void CYSFControl::writeJSONRF(nlohmann::json& json, const char* action, const unsigned char* source, unsigned char dgid) @@ -1354,9 +1352,7 @@ void CYSFControl::writeJSONNet(nlohmann::json& json, const char* action) assert(action != NULL); json["timestamp"] = CUtils::createTimestamp(); - - json["source"] = "network"; - json["action"] = action; + json["action"] = action; } void CYSFControl::writeJSONNet(nlohmann::json& json, const char* action, const unsigned char* source, unsigned char dgid) diff --git a/schema.json b/schema.json index 2d10c0a..4ab3e94 100644 --- a/schema.json +++ b/schema.json @@ -39,6 +39,33 @@ "required": ["timestamp"] }, + "RSSI" : { + "type": "object", + "timestamp": {"$ref": "#/$defs/timestamp"}, + "mode": {"$ref": "#/$defs/mmdvm_mode"}, + "slot": {"$ref": "#/$defs/dmr_slot"}, + "value": {"$ref": "#/$defs/rssi"}, + "required": ["timestamp", "mode", "value"] + }, + + "BER" : { + "type": "object", + "timestamp": {"$ref": "#/$defs/timestamp"}, + "mode": {"$ref": "#/$defs/mmdvm_mode"}, + "slot": {"$ref": "#/$defs/dmr_slot"}, + "value": {"$ref": "#/$defs/ber"}, + "required": ["timestamp", "mode", "value"] + }, + + "Text" : { + "type": "object", + "timestamp": {"$ref": "#/$defs/timestamp"}, + "mode": {"$ref": "#/$defs/mmdvm_mode"}, + "slot": {"$ref": "#/$defs/dmr_slot"}, + "value": {"type": "string"}, + "required": ["timestamp", "mode", "value"] + }, + "D-Star": { "type": "object", "timestamp": {"$ref": "#/$defs/timestamp"}, @@ -56,7 +83,7 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "source", "action"] + "required": ["timestamp", "action"] }, "DMR": { @@ -79,7 +106,7 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "slot", "source", "action"] + "required": ["timestamp", "slot", "action"] }, "YSF": { @@ -99,7 +126,7 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "source", "action"] + "required": ["timestamp", "action"] }, "P25": { @@ -119,7 +146,7 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "source", "action"] + "required": ["timestamp", "action"] }, "NXDN": { @@ -138,7 +165,7 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "source", "action"] + "required": ["timestamp", "action"] }, "POCSAG": { @@ -190,6 +217,6 @@ "max": {"$ref": "#/$defs/rssi"}, "ave": {"$ref": "#/$defs/rssi"} }, - "required": ["timestamp", "source", "action"] + "required": ["timestamp", "action"] } }