diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-01 15:37:48 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2015-08-01 15:37:48 +0200 |
commit | 0a17f5cf27e221b680617e2c522306d27bd6f141 (patch) | |
tree | 58cc2be79f223cb9bbe3de1afe460eb1af7e58e6 /src/RemoteControl.h | |
parent | 98b07e76c56bced3f6466d87941ed3409ea22d5f (diff) | |
download | dabmod-0a17f5cf27e221b680617e2c522306d27bd6f141.tar.gz dabmod-0a17f5cf27e221b680617e2c522306d27bd6f141.tar.bz2 dabmod-0a17f5cf27e221b680617e2c522306d27bd6f141.zip |
Refactor ZMQ RC and add list and show commands
Diffstat (limited to 'src/RemoteControl.h')
-rw-r--r-- | src/RemoteControl.h | 32 |
1 files changed, 25 insertions, 7 deletions
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<std::string> &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<std::string> &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<std::string> > + get_param_list_values_(std::string name) { + RemoteControllable* controllable = get_controllable_(name); + + std::list< std::vector<std::string> > allparams; + std::list<std::string> params = controllable->get_supported_parameters(); + for (std::list<std::string>::iterator it = params.begin(); + it != params.end(); ++it) { + std::vector<std::string> 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<RemoteControllable*> m_cohort; - zmq::context_t m_zmqContext; std::string m_endpoint; + boost::thread m_child_thread; }; #endif |