MIRA
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
SerialPort Class Reference

This class acts as a wrapper to boost::asio::serial_port. More...

#include <communication/SerialPort.h>

Classes

class  Baudrate
 An internal class for handling the baudrate. More...
 

Public Types

typedef boost::asio::serial_port::parity Parity
 
typedef boost::asio::serial_port::stop_bits StopBits
 
typedef boost::asio::serial_port::flow_control FlowControl
 
typedef boost::asio::serial_port::character_size CharacterSize
 

Public Member Functions

 SerialPort (boost::asio::io_service &service, const std::string &device, uint32 baudrate)
 Construct a new serial port with the given I/O service. More...
 
virtual ~SerialPort ()
 The destructor. More...
 
 operator boost::asio::serial_port & ()
 conversion to boost::asio::serial_port More...
 
 operator const boost::asio::serial_port & () const
 conversion to boost::asio::serial_port More...
 
boost::asio::serial_port & port ()
 Access to the underlying boost::asio::serial_port object. More...
 
const boost::asio::serial_port & port () const
 Access to the underlying boost::asio::serial_port object. More...
 
SerialPortsetBaudrate (uint32 rate)
 Set a new baudrate. More...
 
SerialPortsetParity (Parity::type parity)
 Set a new parity. More...
 
SerialPortsetStopBits (StopBits::type stopbits)
 Set a new stop bits configuration. More...
 
SerialPortsetDataBits (uint32 databits)
 Set a new data bits configuration. More...
 
SerialPortsetFlowControl (FlowControl::type flowcontrol)
 Set a new flow control (handshake) configuration. More...
 

Protected Attributes

boost::asio::serial_port mSerialPort
 The underlying boost::asio::serial_port object. More...
 

Detailed Description

This class acts as a wrapper to boost::asio::serial_port.

It provides the usage of non standard baud rates via its Baudrate class. Supported baud rates are:

Member Typedef Documentation

◆ Parity

typedef boost::asio::serial_port::parity Parity

◆ StopBits

typedef boost::asio::serial_port::stop_bits StopBits

◆ FlowControl

typedef boost::asio::serial_port::flow_control FlowControl

◆ CharacterSize

typedef boost::asio::serial_port::character_size CharacterSize

Constructor & Destructor Documentation

◆ SerialPort()

SerialPort ( boost::asio::io_service &  service,
const std::string &  device,
uint32  baudrate 
)
inline

Construct a new serial port with the given I/O service.

Parameters
[in]serviceThe I/O service object.
[in]deviceThe device name of the serial port.
[in]baudrateThe requested baudrate.

◆ ~SerialPort()

virtual ~SerialPort ( )
inlinevirtual

The destructor.

Member Function Documentation

◆ operator boost::asio::serial_port &()

operator boost::asio::serial_port & ( )
inline

conversion to boost::asio::serial_port

◆ operator const boost::asio::serial_port &()

operator const boost::asio::serial_port & ( ) const
inline

conversion to boost::asio::serial_port

◆ port() [1/2]

boost::asio::serial_port& port ( )
inline

Access to the underlying boost::asio::serial_port object.

◆ port() [2/2]

const boost::asio::serial_port& port ( ) const
inline

Access to the underlying boost::asio::serial_port object.

◆ setBaudrate()

SerialPort& setBaudrate ( uint32  rate)
inline

Set a new baudrate.

◆ setParity()

SerialPort& setParity ( Parity::type  parity)
inline

Set a new parity.

◆ setStopBits()

SerialPort& setStopBits ( StopBits::type  stopbits)
inline

Set a new stop bits configuration.

◆ setDataBits()

SerialPort& setDataBits ( uint32  databits)
inline

Set a new data bits configuration.

◆ setFlowControl()

SerialPort& setFlowControl ( FlowControl::type  flowcontrol)
inline

Set a new flow control (handshake) configuration.

Member Data Documentation

◆ mSerialPort

boost::asio::serial_port mSerialPort
protected

The underlying boost::asio::serial_port object.


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