38 #ifndef ASYNC_COMM_SERIAL_H 39 #define ASYNC_COMM_SERIAL_H 43 #include <boost/asio.hpp> 44 #include <boost/function.hpp> 66 Serial(std::string port,
unsigned int baud_rate,
MessageHandler& message_handler = default_message_handler_);
78 bool is_open()
override;
79 bool do_init()
override;
80 void do_close()
override;
81 void do_async_read(
const boost::asio::mutable_buffers_1 &buffer,
82 boost::function<
void(
const boost::system::error_code&,
size_t)> handler)
override;
83 void do_async_write(
const boost::asio::const_buffers_1 &buffer,
84 boost::function<
void(
const boost::system::error_code&,
size_t)> handler)
override;
87 unsigned int baud_rate_;
89 boost::asio::serial_port serial_port_;
94 #endif // ASYNC_COMM_SERIAL_H Asynchronous communication class for a serial port.
Abstract base class for an asynchronous communication port.
Abstract base class for message handler.
Serial(std::string port, unsigned int baud_rate, MessageHandler &message_handler=default_message_handler_)
Open a serial port.
bool set_baud_rate(unsigned int baud_rate)
Set serial port baud rate.