Robotics Library  0.7.0
Public Types | Public Member Functions | Private Attributes | List of all members
rl::hal::Serial Class Reference

#include <Serial.h>

Inheritance diagram for rl::hal::Serial:
Inheritance graph
[legend]

Public Types

enum  BaudRate {
  BAUDRATE_110BPS, BAUDRATE_300BPS, BAUDRATE_600BPS, BAUDRATE_1200BPS,
  BAUDRATE_2400BPS, BAUDRATE_4800BPS, BAUDRATE_9600BPS, BAUDRATE_19200BPS,
  BAUDRATE_38400BPS, BAUDRATE_57600BPS, BAUDRATE_115200BPS, BAUDRATE_230400BPS,
  BAUDRATE_460800BPS, BAUDRATE_500000BPS, BAUDRATE_576000BPS, BAUDRATE_921600BPS,
  BAUDRATE_1000000BPS, BAUDRATE_1152000BPS, BAUDRATE_1500000BPS, BAUDRATE_2000000BPS,
  BAUDRATE_2500000BPS, BAUDRATE_3000000BPS, BAUDRATE_3500000BPS, BAUDRATE_4000000BPS
}
 
enum  DataBits { DATABITS_5BITS, DATABITS_6BITS, DATABITS_7BITS, DATABITS_8BITS }
 
enum  FlowControl { FLOWCONTROL_OFF, FLOWCONTROL_RTSCTS, FLOWCONTROL_XONXOFF }
 
enum  Parity { PARITY_EVENPARITY, PARITY_NOPARITY, PARITY_ODDPARITY }
 
enum  StopBits { STOPBITS_1BIT, STOPBITS_2BITS }
 

Public Member Functions

 Serial (const ::std::string &filename, const BaudRate &baudRate=BAUDRATE_9600BPS, const DataBits &dataBits=DATABITS_8BITS, const FlowControl &flowControl=FLOWCONTROL_OFF, const Parity &parity=PARITY_NOPARITY, const StopBits &stopBits=STOPBITS_1BIT, const int &flags=O_RDWR|O_NONBLOCK|O_NOCTTY)
 
virtual ~Serial ()
 
void changeParameters ()
 
void close ()
 
void doBreak (const bool &doOn)
 
void doDtr (const bool &doOn)
 
void doModemStatus (bool &ctsOn, bool &dsrOn, bool &riOn, bool &dcdOn)
 
void doRts (const bool &doOn)
 
void flush (const bool &read, const bool &write)
 
const BaudRategetBaudRate () const
 
const DataBitsgetDataBits () const
 
const ::std::string & getFilename () const
 
const FlowControlgetFlowControl () const
 
const ParitygetParity () const
 
const StopBitsgetStopBits () const
 
void open ()
 
::std::size_t read (void *buf, const ::std::size_t &count)
 
::std::size_t select (const bool &read, const bool &write, const ::std::chrono::nanoseconds &timeout)
 
void setBaudRate (const BaudRate &baudRate)
 
void setDataBits (const DataBits &dataBits)
 
void setFilename (const ::std::string &filename)
 
void setFlowControl (const FlowControl &flowControl)
 
void setParity (const Parity &parity)
 
void setStopBits (const StopBits &stopBits)
 
::std::size_t write (const void *buf, const ::std::size_t &count)
 
- Public Member Functions inherited from rl::hal::Com
 Com ()
 
virtual ~Com ()
 
bool isConnected () const
 

Private Attributes

BaudRate baudRate
 
struct termios current
 
DataBits dataBits
 
int fd
 
::std::string filename
 
int flags
 
FlowControl flowControl
 
Parity parity
 
struct termios restore
 
StopBits stopBits
 

Additional Inherited Members

- Protected Member Functions inherited from rl::hal::Com
void setConnected (const bool &connected)
 

Member Enumeration Documentation

◆ BaudRate

Enumerator
BAUDRATE_110BPS 

110 bps.

BAUDRATE_300BPS 

300 bps.

BAUDRATE_600BPS 

600 bps.

BAUDRATE_1200BPS 

1,200 bps.

BAUDRATE_2400BPS 

2,400 bps.

BAUDRATE_4800BPS 

4,800 bps.

BAUDRATE_9600BPS 

9,600 bps.

BAUDRATE_19200BPS 

19,200 bps.

BAUDRATE_38400BPS 

38,400 bps.

BAUDRATE_57600BPS 

57,600 bps.

BAUDRATE_115200BPS 

115,200 bps.

BAUDRATE_230400BPS 

230,400 bps.

BAUDRATE_460800BPS 

460,800 bps.

BAUDRATE_500000BPS 

500,000 bps.

BAUDRATE_576000BPS 

576,000 bps.

BAUDRATE_921600BPS 

921,600 bps.

BAUDRATE_1000000BPS 

1,000,000 bps.

BAUDRATE_1152000BPS 

1,152000 bps.

BAUDRATE_1500000BPS 

1,500,000 bps.

BAUDRATE_2000000BPS 

2,000,000 bps.

BAUDRATE_2500000BPS 

2,500,000 bps.

BAUDRATE_3000000BPS 

3,000,000 bps.

BAUDRATE_3500000BPS 

3,500,000 bps.

BAUDRATE_4000000BPS 

4,000,000 bps.

◆ DataBits

Enumerator
DATABITS_5BITS 

5 data bits.

DATABITS_6BITS 

6 data bits.

DATABITS_7BITS 

7 data bits.

DATABITS_8BITS 

8 data bits.

◆ FlowControl

Enumerator
FLOWCONTROL_OFF 

No flow control.

FLOWCONTROL_RTSCTS 

Hardware flow control (RTS/CTS).

FLOWCONTROL_XONXOFF 

Software flow control (XON/XOFF).

◆ Parity

Enumerator
PARITY_EVENPARITY 

Even parity.

PARITY_NOPARITY 

No parity.

PARITY_ODDPARITY 

Odd parity.

◆ StopBits

Enumerator
STOPBITS_1BIT 

1 stop bit.

STOPBITS_2BITS 

2 stop bits.

Constructor & Destructor Documentation

◆ Serial()

rl::hal::Serial::Serial ( const ::std::string &  filename,
const BaudRate baudRate = BAUDRATE_9600BPS,
const DataBits dataBits = DATABITS_8BITS,
const FlowControl flowControl = FLOWCONTROL_OFF,
const Parity parity = PARITY_NOPARITY,
const StopBits stopBits = STOPBITS_1BIT,
const int &  flags = O_RDWR | O_NONBLOCK | O_NOCTTY 
)

◆ ~Serial()

rl::hal::Serial::~Serial ( )
virtual

Member Function Documentation

◆ changeParameters()

void rl::hal::Serial::changeParameters ( )

◆ close()

void rl::hal::Serial::close ( )
virtual

Implements rl::hal::Com.

◆ doBreak()

void rl::hal::Serial::doBreak ( const bool &  doOn)

◆ doDtr()

void rl::hal::Serial::doDtr ( const bool &  doOn)

◆ doModemStatus()

void rl::hal::Serial::doModemStatus ( bool &  ctsOn,
bool &  dsrOn,
bool &  riOn,
bool &  dcdOn 
)

◆ doRts()

void rl::hal::Serial::doRts ( const bool &  doOn)

◆ flush()

void rl::hal::Serial::flush ( const bool &  read,
const bool &  write 
)

◆ getBaudRate()

const Serial::BaudRate & rl::hal::Serial::getBaudRate ( ) const

◆ getDataBits()

const Serial::DataBits & rl::hal::Serial::getDataBits ( ) const

◆ getFilename()

const ::std::string & rl::hal::Serial::getFilename ( ) const

◆ getFlowControl()

const Serial::FlowControl & rl::hal::Serial::getFlowControl ( ) const

◆ getParity()

const Serial::Parity & rl::hal::Serial::getParity ( ) const

◆ getStopBits()

const Serial::StopBits & rl::hal::Serial::getStopBits ( ) const

◆ open()

void rl::hal::Serial::open ( )
virtual

Implements rl::hal::Com.

◆ read()

std::size_t rl::hal::Serial::read ( void *  buf,
const ::std::size_t &  count 
)

◆ select()

std::size_t rl::hal::Serial::select ( const bool &  read,
const bool &  write,
const ::std::chrono::nanoseconds &  timeout 
)

◆ setBaudRate()

void rl::hal::Serial::setBaudRate ( const BaudRate baudRate)

◆ setDataBits()

void rl::hal::Serial::setDataBits ( const DataBits dataBits)

◆ setFilename()

void rl::hal::Serial::setFilename ( const ::std::string &  filename)

◆ setFlowControl()

void rl::hal::Serial::setFlowControl ( const FlowControl flowControl)

◆ setParity()

void rl::hal::Serial::setParity ( const Parity parity)

◆ setStopBits()

void rl::hal::Serial::setStopBits ( const StopBits stopBits)

◆ write()

std::size_t rl::hal::Serial::write ( const void *  buf,
const ::std::size_t &  count 
)

Member Data Documentation

◆ baudRate

BaudRate rl::hal::Serial::baudRate
private

◆ current

struct termios rl::hal::Serial::current
private

◆ dataBits

DataBits rl::hal::Serial::dataBits
private

◆ fd

int rl::hal::Serial::fd
private

◆ filename

::std::string rl::hal::Serial::filename
private

◆ flags

int rl::hal::Serial::flags
private

◆ flowControl

FlowControl rl::hal::Serial::flowControl
private

◆ parity

Parity rl::hal::Serial::parity
private

◆ restore

struct termios rl::hal::Serial::restore
private

◆ stopBits

StopBits rl::hal::Serial::stopBits
private

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