24 #ifndef GOBY_MIDDLEWARE_IO_MAVLINK_SERIAL_H
25 #define GOBY_MIDDLEWARE_IO_MAVLINK_SERIAL_H
29 #include <boost/asio/buffer.hpp>
30 #include <boost/asio/completion_condition.hpp>
31 #include <boost/asio/read.hpp>
32 #include <boost/system/error_code.hpp>
64 PubSubLayer subscribe_layer,
template <
class>
class ThreadType>
66 line_in_group, line_out_group, publish_layer, subscribe_layer,
67 detail::SerialThread<line_in_group, line_out_group, publish_layer, subscribe_layer, ThreadType>,
92 void async_read()
override;
103 subscribe_layer, ThreadType>::async_read()
105 boost::asio::async_read(
106 this->mutable_serial_port(), boost::asio::buffer(this->buffer()),
107 boost::asio::transfer_at_least(1),
108 [
this](
const boost::system::error_code& ec, std::size_t bytes_transferred) {
109 if (!ec && bytes_transferred > 0)
111 this->try_parse(bytes_transferred);
116 this->handle_read_error(ec);