27 const boost::property_tree::ptree &cfg,
30 , bus_push_(ctx,
zmqpp::socket_type::push)
31 , controller_(ctx,
zmqpp::socket_type::router)
33 std::string bind_str =
35 config_.get_child(
"module_config").get<std::string>(
"ipc_endpoint");
37 INFO(
"Binding to: " << bind_str);
38 bus_push_.connect(
"inproc://zmq-bus-pull");
45 INFO(
"COMMAND AVAILABLE");
52 msg >> identity >> str;
68 std::string gpio_name;
70 *str >> gpio_name >> cmd;
71 DEBUG(
"GPIO CMD: " << gpio_name <<
", " << cmd);
74 bus_push_.send(zmqpp::message() << (
"S_" + gpio_name) <<
"ON");
76 else if (cmd ==
"OFF")
78 bus_push_.send(zmqpp::message() << (
"S_" + gpio_name) <<
"OFF");
80 else if (cmd ==
"INT")
82 bus_push_.send(zmqpp::message() << std::string(
"S_INT:" + gpio_name));
The instrumentation expose some internal of the program through IPC.
Base class for module implementation.
zmqpp::reactor reactor_
The reactor object we poll() on in the main loop.
std::shared_ptr< CoreUtils > CoreUtilsPtr
zmqpp::socket controller_
IPC ROUTER socket.
boost::property_tree::ptree config_
The configuration tree passed to the start_module function.
void handle_gpio_command(zmqpp::message *str)
InstrumentationModule(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)