21 #include <boost/asio.hpp> 32 public std::enable_shared_from_this<MAVConnUDP> {
49 std::string bind_host = DEFAULT_BIND_HOST,
unsigned short bind_port = DEFAULT_BIND_PORT,
50 std::string remote_host = DEFAULT_REMOTE_HOST,
unsigned short remote_port = DEFAULT_REMOTE_PORT);
53 void close()
override;
55 void send_message(
const mavlink::mavlink_message_t *message)
override;
57 void send_bytes(
const uint8_t *bytes,
size_t length)
override;
67 std::unique_ptr<boost::asio::io_service::work>
io_work;
79 std::deque<MsgBuffer>
tx_q;
80 std::array<uint8_t, MsgBuffer::MAX_SIZE>
rx_buf;
std::string get_remote_endpoint() const
boost::asio::ip::udp::endpoint bind_ep
static constexpr auto DEFAULT_BIND_HOST
MAVConnUDP(uint8_t system_id=1, uint8_t component_id=MAV_COMP_ID_UDP_BRIDGE, std::string bind_host=DEFAULT_BIND_HOST, unsigned short bind_port=DEFAULT_BIND_PORT, std::string remote_host=DEFAULT_REMOTE_HOST, unsigned short remote_port=DEFAULT_REMOTE_PORT)
void send_bytes(const uint8_t *bytes, size_t length) override
Send raw bytes (for some quirks)
static constexpr auto DEFAULT_BIND_PORT
static constexpr auto MAV_COMP_ID_UDP_BRIDGE
Same as mavlink::common::MAV_COMPONENT::COMP_ID_UDP_BRIDGE.
boost::asio::ip::udp::endpoint remote_ep
Generic mavlink interface.
std::deque< MsgBuffer > tx_q
std::array< uint8_t, MsgBuffer::MAX_SIZE > rx_buf
static constexpr auto BROADCAST_REMOTE_HOST
Markers for broadcast modes. Not valid domain names.
MAVConn message buffer class (internal)
static constexpr auto DEFAULT_REMOTE_PORT
void close() override
Close connection.
boost::asio::ip::udp::endpoint last_remote_ep
static constexpr auto PERMANENT_BROADCAST_REMOTE_HOST
boost::asio::ip::udp::socket socket
std::atomic< bool > remote_exists
std::atomic< bool > tx_in_progress
void do_sendto(bool check_tx_state)
std::unique_ptr< boost::asio::io_service::work > io_work
boost::asio::io_service io_service
void send_message(const mavlink::mavlink_message_t *message) override
Send message (mavlink_message_t)
boost::asio::ip::udp::endpoint recv_ep
static constexpr auto DEFAULT_REMOTE_HOST
std::recursive_mutex mutex