Public Member Functions | Private Member Functions | Private Attributes | List of all members
mavrosflight::MavlinkSerial Class Reference

#include <mavlink_serial.h>

Inheritance diagram for mavrosflight::MavlinkSerial:
Inheritance graph
[legend]

Public Member Functions

 MavlinkSerial (std::string port, int baud_rate)
 Instantiates the class and begins communication on the specified serial port. More...
 
 ~MavlinkSerial ()
 Stops communication and closes the serial port before the object is destroyed. More...
 
- Public Member Functions inherited from mavrosflight::MavlinkComm
void close ()
 Stops communication and closes the port. More...
 
 MavlinkComm ()
 Instantiates the class and begins communication on the specified serial port. More...
 
void open ()
 Opens the port and begins communication. More...
 
void register_mavlink_listener (MavlinkListenerInterface *const listener)
 Register a listener for mavlink messages. More...
 
void send_message (const mavlink_message_t &msg)
 Send a mavlink message. More...
 
void unregister_mavlink_listener (MavlinkListenerInterface *const listener)
 Unregister a listener for mavlink messages. More...
 
 ~MavlinkComm ()
 Stops communication and closes the serial port before the object is destroyed. More...
 

Private Member Functions

virtual void do_async_read (const boost::asio::mutable_buffers_1 &buffer, boost::function< void(const boost::system::error_code &, size_t)> handler)
 Initiate an asynchronous read operation. More...
 
virtual void do_async_write (const boost::asio::const_buffers_1 &buffer, boost::function< void(const boost::system::error_code &, size_t)> handler)
 Initialize an asynchronous write operation. More...
 
virtual void do_close ()
 
virtual void do_open ()
 
virtual bool is_open ()
 

Private Attributes

int baud_rate_
 
std::string port_
 
boost::asio::serial_port serial_port_
 boost serial port object More...
 

Additional Inherited Members

- Protected Attributes inherited from mavrosflight::MavlinkComm
boost::asio::io_service io_service_
 boost io service provider More...
 

Detailed Description

Definition at line 49 of file mavlink_serial.h.

Constructor & Destructor Documentation

mavrosflight::MavlinkSerial::MavlinkSerial ( std::string  port,
int  baud_rate 
)

Instantiates the class and begins communication on the specified serial port.

Parameters
portName of the serial port (e.g. "/dev/ttyUSB0")
baud_rateSerial communication baud rate

Definition at line 44 of file mavlink_serial.cpp.

mavrosflight::MavlinkSerial::~MavlinkSerial ( )

Stops communication and closes the serial port before the object is destroyed.

Definition at line 52 of file mavlink_serial.cpp.

Member Function Documentation

void mavrosflight::MavlinkSerial::do_async_read ( const boost::asio::mutable_buffers_1 &  buffer,
boost::function< void(const boost::system::error_code &, size_t)>  handler 
)
privatevirtual

Initiate an asynchronous read operation.

Implements mavrosflight::MavlinkComm.

Definition at line 84 of file mavlink_serial.cpp.

void mavrosflight::MavlinkSerial::do_async_write ( const boost::asio::const_buffers_1 &  buffer,
boost::function< void(const boost::system::error_code &, size_t)>  handler 
)
privatevirtual

Initialize an asynchronous write operation.

Parameters
check_write_stateIf true, only start another write operation if a write sequence is not already running

Implements mavrosflight::MavlinkComm.

Definition at line 90 of file mavlink_serial.cpp.

void mavrosflight::MavlinkSerial::do_close ( )
privatevirtual

Implements mavrosflight::MavlinkComm.

Definition at line 79 of file mavlink_serial.cpp.

void mavrosflight::MavlinkSerial::do_open ( )
privatevirtual

Implements mavrosflight::MavlinkComm.

Definition at line 62 of file mavlink_serial.cpp.

bool mavrosflight::MavlinkSerial::is_open ( )
privatevirtual

Implements mavrosflight::MavlinkComm.

Definition at line 57 of file mavlink_serial.cpp.

Member Data Documentation

int mavrosflight::MavlinkSerial::baud_rate_
private

Definition at line 93 of file mavlink_serial.h.

std::string mavrosflight::MavlinkSerial::port_
private

Definition at line 92 of file mavlink_serial.h.

boost::asio::serial_port mavrosflight::MavlinkSerial::serial_port_
private

boost serial port object

Definition at line 90 of file mavlink_serial.h.


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


rosflight
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:09:29