aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-06-04 11:58:10 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-06-05 11:52:31 +0200
commit91d3ea135ec27934a9b7f1c47b4ff3431a400ea3 (patch)
tree9cab032e00f4076615d851704cc0d91e0176ca30
parent03c961beb7ed4dbaae09f7d901d08d3464337d07 (diff)
downloaddabmod-91d3ea135ec27934a9b7f1c47b4ff3431a400ea3.tar.gz
dabmod-91d3ea135ec27934a9b7f1c47b4ff3431a400ea3.tar.bz2
dabmod-91d3ea135ec27934a9b7f1c47b4ff3431a400ea3.zip
Make ZMQ return JSON for the list command
-rw-r--r--src/RemoteControl.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp
index 72fbb54..3940ecd 100644
--- a/src/RemoteControl.cpp
+++ b/src/RemoteControl.cpp
@@ -451,7 +451,23 @@ void RemoteControllerZmq::process()
size_t cohort_size = rcs.controllables.size();
for (auto &controllable : rcs.controllables) {
std::stringstream ss;
- ss << controllable->get_rc_name();
+ ss << "{ \"name\": \"" << controllable->get_rc_name() << "\"," <<
+ " \"params\": { ";
+
+ list< vector<string> > params = controllable->get_parameter_descriptions();
+ size_t i = 0;
+ for (auto &param : params) {
+ if (i > 0) {
+ ss << ", ";
+ }
+
+ ss << "\"" << param[0] << "\": " <<
+ "\"" << param[1] << "\"";
+
+ i++;
+ }
+
+ ss << " } }";
std::string msg_s = ss.str();