Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
mavconn::MAVConnTCPServer Class Reference

TCP server interface. More...

#include <tcp.h>

Inheritance diagram for mavconn::MAVConnTCPServer:
Inheritance graph
[legend]

Public Member Functions

void close () override
 Close connection. More...
 
void connect (const ReceivedCb &cb_handle_message, const ClosedCb &cb_handle_closed_port=ClosedCb()) override
 Establish connection, automatically called by open_url() More...
 
IOStat get_iostat () override
 
mavlink::mavlink_status_t get_status () override
 
bool is_open () override
 
 MAVConnTCPServer (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)
 
void send_bytes (const uint8_t *bytes, size_t length) override
 Send raw bytes (for some quirks) More...
 
void send_message (const mavlink::mavlink_message_t *message) override
 Send message (mavlink_message_t) More...
 
void send_message (const mavlink::Message &message, const uint8_t source_compid) override
 Send message (child of mavlink::Message) More...
 
virtual ~MAVConnTCPServer ()
 
- Public Member Functions inherited from mavconn::MAVConnInterface
uint8_t get_component_id ()
 
Protocol get_protocol_version ()
 
uint8_t get_system_id ()
 
 MAVConnInterface (uint8_t system_id=1, uint8_t component_id=MAV_COMP_ID_UDP_BRIDGE)
 
virtual void send_message (const mavlink::Message &message)
 Send message (child of mavlink::Message) More...
 
void send_message_ignore_drop (const mavlink::mavlink_message_t *message)
 Send message and ignore possible drop due to Tx queue limit. More...
 
void send_message_ignore_drop (const mavlink::Message &message)
 Send message and ignore possible drop due to Tx queue limit. More...
 
void send_message_ignore_drop (const mavlink::Message &message, const uint8_t src_compid)
 Send message and ignore possible drop due to Tx queue limit. More...
 
void set_component_id (uint8_t compid)
 
void set_protocol_version (Protocol pver)
 
void set_system_id (uint8_t sysid)
 

Static Public Attributes

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

Private Member Functions

void client_closed (std::weak_ptr< MAVConnTCPClient > weak_instp)
 
void do_accept ()
 

Private Attributes

boost::asio::ip::tcp::acceptor acceptor
 
boost::asio::ip::tcp::endpoint bind_ep
 
std::list< std::shared_ptr< MAVConnTCPClient > > client_list
 
boost::asio::io_service io_service
 
std::thread io_thread
 
std::unique_ptr< boost::asio::io_service::work > io_work
 
std::atomic< bool > is_destroying
 
std::recursive_mutex mutex
 

Additional Inherited Members

- Public Types inherited from mavconn::MAVConnInterface
using ClosedCb = std::function< void(void)>
 
using ConstPtr = std::shared_ptr< MAVConnInterface const >
 
using Ptr = std::shared_ptr< MAVConnInterface >
 
using ReceivedCb = std::function< void(const mavlink::mavlink_message_t *message, const Framing framing)>
 
using WeakPtr = std::weak_ptr< MAVConnInterface >
 
- Static Public Member Functions inherited from mavconn::MAVConnInterface
static std::vector< std::string > get_known_dialects ()
 
static Ptr open_url (std::string url, uint8_t system_id=1, uint8_t component_id=MAV_COMP_ID_UDP_BRIDGE, const ReceivedCb &cb_handle_message=ReceivedCb(), const ClosedCb &cb_handle_closed_port=ClosedCb())
 Construct connection from URL. More...
 
static Ptr open_url_no_connect (std::string url, uint8_t system_id=1, uint8_t component_id=MAV_COMP_ID_UDP_BRIDGE)
 version of open_url() which do not perform connect() More...
 
- Public Attributes inherited from mavconn::MAVConnInterface
ReceivedCb message_received_cb
 Message receive callback. More...
 
ClosedCb port_closed_cb
 Port closed notification callback. More...
 
- Protected Member Functions inherited from mavconn::MAVConnInterface
mavlink::mavlink_message_tget_buffer_p ()
 
mavlink::mavlink_status_tget_status_p ()
 
void iostat_rx_add (size_t bytes)
 
void iostat_tx_add (size_t bytes)
 
void log_recv (const char *pfx, mavlink::mavlink_message_t &msg, Framing framing)
 
void log_send (const char *pfx, const mavlink::mavlink_message_t *msg)
 
void log_send_obj (const char *pfx, const mavlink::Message &msg)
 
void parse_buffer (const char *pfx, uint8_t *buf, const size_t bufsize, size_t bytes_received)
 
- Protected Attributes inherited from mavconn::MAVConnInterface
uint8_t comp_id
 Connection Component Id. More...
 
size_t conn_id
 Channel number used for logging. More...
 
uint8_t sys_id
 Connection System Id. More...
 
- Static Protected Attributes inherited from mavconn::MAVConnInterface
static constexpr size_t MAX_PACKET_SIZE = MAVLINK_MAX_PACKET_LEN + 16
 Maximum mavlink packet size + some extra bytes for padding. More...
 
static constexpr size_t MAX_TXQ_SIZE = 1000
 Maximum count of transmission buffers. More...
 
static std::unordered_map< mavlink::msgid_t, const mavlink::mavlink_msg_entry_t * > message_entries {}
 This map merge all dialect mavlink_msg_entry_t structs. Needed for packet parser. More...
 

Detailed Description

TCP server interface.

Note
IPv4 only

Definition at line 97 of file tcp.h.


The documentation for this class was generated from the following files:


libmavconn
Author(s): Vladimir Ermakov
autogenerated on Tue Jun 13 2023 02:17:45