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;
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);
}

View File

@@ -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);
};

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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,20 +1246,18 @@ 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;
}

View File

@@ -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);
};

View File

@@ -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;
}

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, 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);
};

View File

@@ -1330,8 +1330,6 @@ void CYSFControl::writeJSONRF(nlohmann::json& json, const char* action)
assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp();
json["source"] = "rf";
json["action"] = action;
}
@@ -1354,8 +1352,6 @@ void CYSFControl::writeJSONNet(nlohmann::json& json, const char* action)
assert(action != NULL);
json["timestamp"] = CUtils::createTimestamp();
json["source"] = "network";
json["action"] = action;
}

View File

@@ -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"]
}
}