38 #include <boost/asio.hpp> 39 #include <protobuf_comm/client.h> 41 #include <msgs/MachineInfo.pb.h> 48 static bool quit =
false;
52 signal_handler(
const boost::system::error_code& error,
int signum)
73 handle_message(uint16_t comp_id, uint16_t msg_type,
74 std::shared_ptr<google::protobuf::Message> msg)
76 printf(
"Received message of type %u\n", msg_type);
87 main(
int argc,
char **argv)
89 boost::asio::io_service io_service;
91 boost::asio::deadline_timer timer_(io_service);
92 boost::asio::deadline_timer reconnect_timer_(io_service);
93 boost::asio::deadline_timer attmsg_timer_(io_service);
94 boost::asio::deadline_timer blink_timer_(io_service);
105 boost::asio::signal_set signals(io_service, SIGINT, SIGTERM);
108 signals.async_wait(signal_handler);
116 google::protobuf::ShutdownProtobufLibrary();
boost::signals2::signal< void(uint16_t, uint16_t, std::shared_ptr< google::protobuf::Message >)> & signal_received()
Signal that is invoked when a message has been received.
void async_connect(const char *host, unsigned short port)
Asynchronous connect.
boost::signals2::signal< void()> & signal_connected()
Signal that is invoked when the connection has been established.
Stream client for protobuf message transmission.