Remove the unneeded source from the JSON except for the start of the transmission.

This commit is contained in:
Jonathan Naylor
2023-06-09 17:24:07 +01:00
parent 8d941db7b1
commit cf161dbd3d
10 changed files with 55 additions and 42 deletions

View File

@@ -2295,7 +2295,7 @@ void CDMRSlot::writeJSONRF(const char* action)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
WriteJSON("DMR", json); WriteJSON("DMR", json);
} }
@@ -2344,7 +2344,7 @@ void CDMRSlot::writeJSONRF(const char* action, float duration, float ber)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
@@ -2358,7 +2358,7 @@ void CDMRSlot::writeJSONRF(const char* action, float duration, float ber, unsign
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
@@ -2379,7 +2379,7 @@ void CDMRSlot::writeJSONNet(const char* action)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "network", action); writeJSON(json, action);
WriteJSON("DMR", json); WriteJSON("DMR", json);
} }
@@ -2428,7 +2428,7 @@ void CDMRSlot::writeJSONNet(const char* action, float duration, float loss, floa
nlohmann::json json; nlohmann::json json;
writeJSON(json, "network", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["loss"] = loss; json["loss"] = loss;
@@ -2437,13 +2437,11 @@ void CDMRSlot::writeJSONNet(const char* action, float duration, float loss, floa
WriteJSON("DMR", json); 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); assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["source"] = source;
json["action"] = action; json["action"] = action;
json["slot"] = int(m_slotNo); json["slot"] = int(m_slotNo);
} }

View File

@@ -174,7 +174,7 @@ private:
void writeJSONNet(const char* action, float duration, float loss, float ber); 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 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); void writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId);
}; };

View File

@@ -1423,7 +1423,6 @@ void CDStarControl::writeJSONNet(const char* action, float duration, float loss)
json["duration"] = duration; json["duration"] = duration;
json["loss"] = loss; json["loss"] = loss;
json["source"] = "network";
json["action"] = action; json["action"] = action;
WriteJSON("D-Star", json); WriteJSON("D-Star", json);
@@ -1438,7 +1437,6 @@ void CDStarControl::writeJSONRF(nlohmann::json& json, const char* action, float
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
json["source"] = "rf";
json["action"] = action; json["action"] = action;
} }

View File

@@ -995,7 +995,6 @@ void CM17Control::writeJSONRF(nlohmann::json& json, const char* action)
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["source"] = "rf";
json["action"] = action; json["action"] = action;
} }
@@ -1043,7 +1042,6 @@ void CM17Control::writeJSONNet(nlohmann::json& json, const char* action)
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["source"] = "network";
json["action"] = action; json["action"] = action;
} }

View File

@@ -1176,7 +1176,7 @@ void CNXDNControl::writeJSONRF(const char* action, float duration, float ber)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
@@ -1190,7 +1190,7 @@ void CNXDNControl::writeJSONRF(const char* action, float duration, float ber, un
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
@@ -1211,7 +1211,7 @@ void CNXDNControl::writeJSONNet(const char* action)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "network", action); writeJSON(json, action);
WriteJSON("NXDN", json); WriteJSON("NXDN", json);
} }
@@ -1246,21 +1246,19 @@ void CNXDNControl::writeJSONNet(const char* action, float duration)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "network", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
WriteJSON("NXDN", json); 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); assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["source"] = source; json["action"] = action;
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) void CNXDNControl::writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned short srcId, const std::string& srcInfo, bool grp, unsigned short dstId)

View File

@@ -112,7 +112,7 @@ private:
void writeJSONNet(const char* action); void writeJSONNet(const char* action);
void writeJSONNet(const char* action, float duration); 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); void writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned short srcId, const std::string& srcInfo, bool grp, unsigned short dstId);
}; };

View File

@@ -1230,7 +1230,7 @@ void CP25Control::writeJSONRF(const char* action, float duration, float ber)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
@@ -1244,7 +1244,7 @@ void CP25Control::writeJSONRF(const char* action, float duration, float ber, uns
nlohmann::json json; nlohmann::json json;
writeJSON(json, "rf", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["ber"] = ber; json["ber"] = ber;
@@ -1276,7 +1276,7 @@ void CP25Control::writeJSONNet(const char* action, float duration, float loss)
nlohmann::json json; nlohmann::json json;
writeJSON(json, "network", action); writeJSON(json, action);
json["duration"] = duration; json["duration"] = duration;
json["loss"] = loss; json["loss"] = loss;
@@ -1284,13 +1284,11 @@ void CP25Control::writeJSONNet(const char* action, float duration, float loss)
WriteJSON("P25", json); 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); assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["source"] = source;
json["action"] = action; json["action"] = action;
} }

View File

@@ -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, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId);
void writeJSONNet(const char* action, float duration, float loss); 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); void writeJSON(nlohmann::json& json, const char* source, const char* action, unsigned int srcId, const std::string& srcInfo, bool grp, unsigned int dstId);
}; };

View File

@@ -1330,9 +1330,7 @@ void CYSFControl::writeJSONRF(nlohmann::json& json, const char* action)
assert(action != NULL); assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["action"] = action;
json["source"] = "rf";
json["action"] = action;
} }
void CYSFControl::writeJSONRF(nlohmann::json& json, const char* action, const unsigned char* source, unsigned char dgid) 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); assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp(); json["timestamp"] = CUtils::createTimestamp();
json["action"] = action;
json["source"] = "network";
json["action"] = action;
} }
void CYSFControl::writeJSONNet(nlohmann::json& json, const char* action, const unsigned char* source, unsigned char dgid) void CYSFControl::writeJSONNet(nlohmann::json& json, const char* action, const unsigned char* source, unsigned char dgid)

View File

@@ -39,6 +39,33 @@
"required": ["timestamp"] "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": { "D-Star": {
"type": "object", "type": "object",
"timestamp": {"$ref": "#/$defs/timestamp"}, "timestamp": {"$ref": "#/$defs/timestamp"},
@@ -56,7 +83,7 @@
"max": {"$ref": "#/$defs/rssi"}, "max": {"$ref": "#/$defs/rssi"},
"ave": {"$ref": "#/$defs/rssi"} "ave": {"$ref": "#/$defs/rssi"}
}, },
"required": ["timestamp", "source", "action"] "required": ["timestamp", "action"]
}, },
"DMR": { "DMR": {
@@ -79,7 +106,7 @@
"max": {"$ref": "#/$defs/rssi"}, "max": {"$ref": "#/$defs/rssi"},
"ave": {"$ref": "#/$defs/rssi"} "ave": {"$ref": "#/$defs/rssi"}
}, },
"required": ["timestamp", "slot", "source", "action"] "required": ["timestamp", "slot", "action"]
}, },
"YSF": { "YSF": {
@@ -99,7 +126,7 @@
"max": {"$ref": "#/$defs/rssi"}, "max": {"$ref": "#/$defs/rssi"},
"ave": {"$ref": "#/$defs/rssi"} "ave": {"$ref": "#/$defs/rssi"}
}, },
"required": ["timestamp", "source", "action"] "required": ["timestamp", "action"]
}, },
"P25": { "P25": {
@@ -119,7 +146,7 @@
"max": {"$ref": "#/$defs/rssi"}, "max": {"$ref": "#/$defs/rssi"},
"ave": {"$ref": "#/$defs/rssi"} "ave": {"$ref": "#/$defs/rssi"}
}, },
"required": ["timestamp", "source", "action"] "required": ["timestamp", "action"]
}, },
"NXDN": { "NXDN": {
@@ -138,7 +165,7 @@
"max": {"$ref": "#/$defs/rssi"}, "max": {"$ref": "#/$defs/rssi"},
"ave": {"$ref": "#/$defs/rssi"} "ave": {"$ref": "#/$defs/rssi"}
}, },
"required": ["timestamp", "source", "action"] "required": ["timestamp", "action"]
}, },
"POCSAG": { "POCSAG": {
@@ -190,6 +217,6 @@
"max": {"$ref": "#/$defs/rssi"}, "max": {"$ref": "#/$defs/rssi"},
"ave": {"$ref": "#/$defs/rssi"} "ave": {"$ref": "#/$defs/rssi"}
}, },
"required": ["timestamp", "source", "action"] "required": ["timestamp", "action"]
} }
} }