Public Member Functions | Private Attributes | List of all members
SimpleSerial Class Reference

SimpleSerial class. More...

#include <serialcom_boost.h>

Public Member Functions

std::string readLine ()
 
 SimpleSerial (std::string port, unsigned int baud_rate)
 
void writeString (std::string s)
 

Private Attributes

boost::asio::io_service io
 
boost::asio::serial_port serial
 

Detailed Description

SimpleSerial class.

This class provides simple read and write functions for serial ports.

Definition at line 43 of file serialcom_boost.h.

Constructor & Destructor Documentation

SimpleSerial::SimpleSerial ( std::string  port,
unsigned int  baud_rate 
)
inline

Constructor.

Parameters
portdevice name, example "/dev/ttyUSB0" or "COM4"
baud_ratecommunication speed, example 9600 or 115200
Exceptions
boost::system::system_errorif cannot open the serial device

Definition at line 56 of file serialcom_boost.h.

Member Function Documentation

std::string SimpleSerial::readLine ( )
inline

Blocks until a line is received from the serial device. Eventual '
' or '
' characters at the end of the string are removed.

Returns
a string containing the received line
Exceptions
boost::system::system_erroron failure

Definition at line 77 of file serialcom_boost.h.

void SimpleSerial::writeString ( std::string  s)
inline

Write a string to the serial device.

Parameters
sstring to write
Exceptions
boost::system::system_erroron failure

Definition at line 66 of file serialcom_boost.h.

Member Data Documentation

boost::asio::io_service SimpleSerial::io
private

Definition at line 46 of file serialcom_boost.h.

boost::asio::serial_port SimpleSerial::serial
private

Definition at line 47 of file serialcom_boost.h.


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


serialcom
Author(s): Ricardo Pascoal
autogenerated on Mon Mar 2 2015 01:32:52