Class MAVConnSerial

Inheritance Relationships

Base Types

  • public mavconn::MAVConnInterface (Class MAVConnInterface)

  • public std::enable_shared_from_this< MAVConnSerial >

Class Documentation

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

Serial interface.

Public Functions

MAVConnSerial(uint8_t system_id = 1, uint8_t component_id = MAV_COMP_ID_UDP_BRIDGE, std::string device = DEFAULT_DEVICE, unsigned baudrate = DEFAULT_BAUDRATE, bool hwflow = false)

Open and run serial link.

Parameters:
  • device[in] TTY device path

  • baudrate[in] serial baudrate

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

Public Static Attributes

static constexpr auto DEFAULT_DEVICE = "/dev/ttyACM0"
static constexpr auto DEFAULT_BAUDRATE = 57600