Class MAVConnTCPServer

Inheritance Relationships

Base Types

  • public mavconn::MAVConnInterface (Class MAVConnInterface)

  • public std::enable_shared_from_this< MAVConnTCPServer >

Class Documentation

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

TCP server interface.

Note

IPv4 only

Public Functions

MAVConnTCPServer(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)
Parameters:
  • [id] – server_addr bind host

  • [id] – server_port bind port

virtual ~MAVConnTCPServer()
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)

virtual mavlink::mavlink_status_t get_status() override
virtual IOStat get_iostat() override
inline virtual bool is_open() override

Public Static Attributes

static constexpr auto DEFAULT_BIND_HOST = "localhost"
static constexpr auto DEFAULT_BIND_PORT = 5760