Class MAVConnUDP

Inheritance Relationships

Base Types

Class Documentation

class MAVConnUDP : public mavconn::MAVConnInterface, public std::enable_shared_from_this<MAVConnUDP>

UDP interface.

Note

IPv4 only

Public Functions

MAVConnUDP(uint8_t system_id = 1, uint8_t component_id = MAV_COMP_ID_UDP_BRIDGE, std::string bind_host = DEFAULT_BIND_HOST, uint16_t bind_port = DEFAULT_BIND_PORT, std::string remote_host = DEFAULT_REMOTE_HOST, uint16_t remote_port = DEFAULT_REMOTE_PORT)
Parameters:
  • [id] – bind_host bind host

  • [id] – bind_port bind port

  • [id] – remote_host remote host (optional)

  • [id] – remote_port remote port (optional)

virtual ~MAVConnUDP()
virtual void connect(const ReceivedCb &cb_handle_message, const ClosedCb &cb_handle_closed_port = ClosedCb()) override

Establish connection, automatically called by open_url()

virtual void close() override

Close connection.

Send message (mavlink_message_t)

Can be used to forward messages from other connection channel.

Note

Does not do finalization!

Throws:

std::length_error – On exceeding Tx queue limit (MAX_TXQ_SIZE)

Parameters:

*message[in] not changed

virtual void send_message(const mavlink::Message &message, const uint8_t source_compid) override

Send message (child of mavlink::Message)

Does serialization inside. System ID = from this object. Component ID passed by argument.

Throws:

std::length_error – On exceeding Tx queue limit (MAX_TXQ_SIZE)

Parameters:
  • &message[in] not changed

  • src_compid[in] sets the component ID of the message source

virtual void send_bytes(const uint8_t *bytes, size_t length) override

Send raw bytes (for some quirks)

Throws:

std::length_error – On exceeding Tx queue limit (MAX_TXQ_SIZE)

inline virtual bool is_open() override
std::string get_remote_endpoint() const

Public Static Attributes

static constexpr auto DEFAULT_BIND_HOST = "localhost"
static constexpr auto DEFAULT_BIND_PORT = 14555
static constexpr auto DEFAULT_REMOTE_HOST = ""
static constexpr auto DEFAULT_REMOTE_PORT = 14550
static constexpr auto BROADCAST_REMOTE_HOST = "***i want broadcast***"

Markers for broadcast modes. Not valid domain names.

static constexpr auto PERMANENT_BROADCAST_REMOTE_HOST = "***permanent broadcast***"