From d779b0d1e2b91b066966907491a3c9a311fd5a2e Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Sun, 15 Jan 2023 18:42:26 +0000 Subject: [PATCH] Simplify the POCSAG JSON interface. --- POCSAGControl.cpp | 10 ++++++++-- POCSAGControl.h | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/POCSAGControl.cpp b/POCSAGControl.cpp index 2313e55..75a263c 100644 --- a/POCSAGControl.cpp +++ b/POCSAGControl.cpp @@ -588,8 +588,11 @@ void CPOCSAGControl::decodeROT1(const std::string& in, unsigned int start, std:: out += in.at(i) - 1U; } -void CPOCSAGControl::writeJSON(const std::string& source, unsigned int ric, const std::string& functional) +void CPOCSAGControl::writeJSON(const char* source, unsigned int ric, const char* functional) { + assert(source != NULL); + assert(functional != NULL); + nlohmann::json json; json["timestamp"] = CUtils::createTimestamp(); @@ -600,8 +603,11 @@ void CPOCSAGControl::writeJSON(const std::string& source, unsigned int ric, cons WriteJSON("POCSAG", json); } -void CPOCSAGControl::writeJSON(const std::string& source, unsigned int ric, const std::string& functional, const std::string& message) +void CPOCSAGControl::writeJSON(const char* source, unsigned int ric, const char* functional, const std::string& message) { + assert(source != NULL); + assert(functional != NULL); + nlohmann::json json; json["timestamp"] = CUtils::createTimestamp(); diff --git a/POCSAGControl.h b/POCSAGControl.h index e85d4ae..aa9077b 100644 --- a/POCSAGControl.h +++ b/POCSAGControl.h @@ -88,8 +88,8 @@ private: void decodeROT1(const std::string& in, unsigned int start, std::string& out) const; - void writeJSON(const std::string& source, unsigned int ric, const std::string& functional); - void writeJSON(const std::string& source, unsigned int ric, const std::string& functional, const std::string& message); + void writeJSON(const char* source, unsigned int ric, const char* functional); + void writeJSON(const char* source, unsigned int ric, const char* functional, const std::string& message); }; #endif