TOBI SignalServer  0.1
tobiss::SerialPortBase Class Reference

This class wrapps boost::asio::serial_port. More...

#include <serial_port_base.h>

+ Inheritance diagram for tobiss::SerialPortBase:
+ Collaboration diagram for tobiss::SerialPortBase:

Data Structures

class  AsioSerialPortTypeNames

Protected Member Functions

 SerialPortBase (boost::asio::io_service &io)
 Constructor.
virtual ~SerialPortBase ()
 Destructor.
void setPortName (const std::string &name)
 Set the name of the used serial port (/dev/ttyS1,S2,... or COM1, COM2, ...).
void open ()
void close ()
void setBaudRate (const unsigned int rate)
void setFlowControl (const std::string &type)
void setParity (const std::string &type)
void setStopBits (const std::string &bits)
void setCharacterSize (const unsigned int size)
template<typename T >
void sync_read (std::vector< T > &values)
 Synchronous read until "values" is full.
template<typename T >
void sync_read (std::vector< T > &values, unsigned int bytes_to_receive)
 Synchronous read at least "bytes_to_receive".
template<typename T >
void async_read (std::vector< T > &values)
 Asynchronous read until "values" is full.
template<typename T >
void async_read (std::vector< T > &values, unsigned int bytes_to_receive)
 Asynchronous read at least "bytes_to_receive".
template<typename T >
void sync_write (std::vector< T > &values)
 Synchronous write "values".
template<typename T >
void async_write (std::vector< T > &values)
 Asynchronous write "values".
std::string getSerialPortName ()
bool isDataAvailable ()
bool wasDataWritten ()

Private Member Functions

void handleAsyncRead (const boost::system::error_code &error, std::size_t bytes_transferred)
void handleAsyncWrite (const boost::system::error_code &error, std::size_t bytes_transferred)

Private Attributes

boost::asio::serial_port serial_port_
std::string port_name_
bool data_available_
bool data_written_
unsigned int baud_rate_
unsigned int flow_control_type_
unsigned int parity_
unsigned int stop_bits_
unsigned int character_size_
AsioSerialPortTypeNamesasio_types_

Detailed Description

This class wrapps boost::asio::serial_port.

SerialPortBase is a base class wrapping boost asios serial_port class. It provides synchronous and asynchronous operations to send and receive data.

Definition at line 66 of file serial_port_base.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables