aboutsummaryrefslogtreecommitdiffstats
path: root/lib/RemoteControl.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2023-03-31 14:31:32 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2023-03-31 14:31:32 +0200
commitae70341365e27d766c8530924209fc4826036aea (patch)
treeb18247e0b96b45b6f74b66d0ab5b5d69bb63f143 /lib/RemoteControl.h
parentfe19871f8ee362f65d194b864eb989618b994e58 (diff)
downloaddabmod-ae70341365e27d766c8530924209fc4826036aea.tar.gz
dabmod-ae70341365e27d766c8530924209fc4826036aea.tar.bz2
dabmod-ae70341365e27d766c8530924209fc4826036aea.zip
Add JSON output to RC
Diffstat (limited to 'lib/RemoteControl.h')
-rw-r--r--lib/RemoteControl.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/RemoteControl.h b/lib/RemoteControl.h
index 2358b3a..4bc3b68 100644
--- a/lib/RemoteControl.h
+++ b/lib/RemoteControl.h
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2019
+ Copyright (C) 2023
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
@@ -36,6 +36,8 @@
#endif
#include <list>
+#include <unordered_map>
+#include <variant>
#include <map>
#include <memory>
#include <string>
@@ -113,13 +115,16 @@ class RemoteControllable {
}
/* Base function to set parameters. */
- virtual void set_parameter(
- const std::string& parameter,
- const std::string& value) = 0;
+ virtual void set_parameter(const std::string& parameter, const std::string& value) = 0;
/* Getting a parameter always returns a string. */
virtual const std::string get_parameter(const std::string& parameter) const = 0;
+ using value_t = std::variant<std::string, double, size_t, ssize_t, bool, std::nullopt_t>;
+ using map_t = std::unordered_map<std::string, value_t>;
+
+ virtual const map_t get_all_values() const = 0;
+
protected:
std::string m_rc_name;
std::list< std::vector<std::string> > m_parameters;
@@ -135,6 +140,7 @@ class RemoteControllers {
void check_faults();
std::list< std::vector<std::string> > get_param_list_values(const std::string& name);
std::string get_param(const std::string& name, const std::string& param);
+ std::string get_params_json(const std::string& name);
void set_param(
const std::string& name,