void MAVConnSerial::do_write(bool check_tx_state) { if (check_tx_state && tx_in_progress) return; lock_guard lock(mutex); if (tx_q.empty()) return; tx_in_progress = true; MsgBuffer *buf = tx_q.front(); serial_dev.async_write_some( buffer(buf->dpos(), buf->nbytes()), boost::bind(&MAVConnSerial::async_write_end, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }
void MAVConnUDP::do_sendto(bool check_tx_state) { if (check_tx_state && tx_in_progress) return; lock_guard lock(mutex); if (tx_q.empty()) return; tx_in_progress = true; MsgBuffer *buf = tx_q.front(); socket.async_send_to( buffer(buf->dpos(), buf->nbytes()), remote_ep, boost::bind(&MAVConnUDP::async_sendto_end, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }