Simplify the JSON creation, remove duplication of effort.

This commit is contained in:
Jonathan Naylor
2022-12-29 16:01:27 +00:00
parent 5c12bbb7b0
commit 38a6dbbdeb
2 changed files with 59 additions and 100 deletions

View File

@@ -32,6 +32,8 @@
#include <string>
#include <nlohmann/json.hpp>
class CM17Control {
public:
CM17Control(const std::string& callsign, unsigned int can, bool selfOnly, bool allowEncryption, CM17Network* network, CDisplay* display, unsigned int timeout, bool duplex, CRSSIInterpolator* rssiMapper);
@@ -109,6 +111,10 @@ private:
void writeJSON(const char* action, RPT_NET_STATE state, const std::string& source, const std::string& dest);
void writeJSON(const char* action, RPT_NET_STATE state, const std::string& source, const std::string& dest, float duration);
void writeJSON(nlohmann::json& json, const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest);
void writeJSON(nlohmann::json& json, const char* action, RPT_RF_STATE state, const std::string& source, const std::string& dest, float duration, float ber);
void writeJSON(nlohmann::json& json, const char* action, RPT_NET_STATE state, const std::string& source, const std::string& dest);
bool openFile();
bool writeFile(const unsigned char* data);
void closeFile();