From 91d3ea135ec27934a9b7f1c47b4ff3431a400ea3 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 4 Jun 2018 11:58:10 +0200 Subject: Make ZMQ return JSON for the list command --- src/RemoteControl.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') 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 > params = controllable->get_parameter_descriptions(); + size_t i = 0; + for (auto ¶m : params) { + if (i > 0) { + ss << ", "; + } + + ss << "\"" << param[0] << "\": " << + "\"" << param[1] << "\""; + + i++; + } + + ss << " } }"; std::string msg_s = ss.str(); -- cgit v1.2.3