From 0a17f5cf27e221b680617e2c522306d27bd6f141 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 1 Aug 2015 15:37:48 +0200 Subject: Refactor ZMQ RC and add list and show commands --- src/RemoteControl.h | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'src/RemoteControl.h') diff --git a/src/RemoteControl.h b/src/RemoteControl.h index 1b5e447..0a4848f 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -306,9 +306,9 @@ class RemoteControllerZmq : public BaseRemoteController { RemoteControllerZmq(std::string endpoint) : m_running(true), m_fault(false), - m_child_thread(&RemoteControllerZmq::process, this), m_zmqContext(1), - m_endpoint(endpoint) { } + m_endpoint(endpoint), + m_child_thread(&RemoteControllerZmq::process, this) { } ~RemoteControllerZmq() { m_running = false; @@ -330,9 +330,9 @@ class RemoteControllerZmq : public BaseRemoteController { private: void restart_thread(); - void recv_all(zmq::socket_t* pSocket, std::vector &message); - void send_ok_reply(zmq::socket_t *pSocket); - void send_fail_reply(zmq::socket_t *pSocket, const std::string &error); + void recv_all(zmq::socket_t &pSocket, std::vector &message); + void send_ok_reply(zmq::socket_t &pSocket); + void send_fail_reply(zmq::socket_t &pSocket, const std::string &error); void process(); @@ -360,19 +360,37 @@ class RemoteControllerZmq : public BaseRemoteController { return controllable->set_parameter(param, value); } + std::list< std::vector > + get_param_list_values_(std::string name) { + RemoteControllable* controllable = get_controllable_(name); + + std::list< std::vector > allparams; + std::list params = controllable->get_supported_parameters(); + for (std::list::iterator it = params.begin(); + it != params.end(); ++it) { + std::vector item; + item.push_back(*it); + item.push_back(controllable->get_parameter(*it)); + + allparams.push_back(item); + } + return allparams; + } + + bool m_running; /* This is set to true if a fault occurred */ bool m_fault; boost::thread m_restarter_thread; - boost::thread m_child_thread; + zmq::context_t m_zmqContext; /* This controller commands the controllables in the cohort */ std::list m_cohort; - zmq::context_t m_zmqContext; std::string m_endpoint; + boost::thread m_child_thread; }; #endif -- cgit v1.2.3