CallbackAsyncSerial Class Reference

Asynchronous serial class with read callback Asynchronous serial class with read callback. User code can write data from one thread, and read data will be reported through a callback called from a separate thred. More...

#include <AsyncSerial.h>

Inheritance diagram for CallbackAsyncSerial:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CallbackAsyncSerial (const std::string &devname, unsigned int baud_rate, boost::asio::serial_port_base::parity opt_parity=boost::asio::serial_port_base::parity(boost::asio::serial_port_base::parity::none), boost::asio::serial_port_base::character_size opt_csize=boost::asio::serial_port_base::character_size(8), boost::asio::serial_port_base::flow_control opt_flow=boost::asio::serial_port_base::flow_control(boost::asio::serial_port_base::flow_control::none), boost::asio::serial_port_base::stop_bits opt_stop=boost::asio::serial_port_base::stop_bits(boost::asio::serial_port_base::stop_bits::one))
 CallbackAsyncSerial ()
void clearCallback ()
void setCallback (const boost::function< void(const char *, size_t) > &callback)
virtual ~CallbackAsyncSerial ()

Detailed Description

Asynchronous serial class with read callback Asynchronous serial class with read callback. User code can write data from one thread, and read data will be reported through a callback called from a separate thred.

Definition at line 252 of file AsyncSerial.h.


Constructor & Destructor Documentation

CallbackAsyncSerial::CallbackAsyncSerial (  ) 

Definition at line 713 of file AsyncSerial.cpp.

CallbackAsyncSerial::CallbackAsyncSerial ( const std::string &  devname,
unsigned int  baud_rate,
boost::asio::serial_port_base::parity  opt_parity = boost::asio::serial_port_base::parity(boost::asio::serial_port_base::parity::none),
boost::asio::serial_port_base::character_size  opt_csize = boost::asio::serial_port_base::character_size(8),
boost::asio::serial_port_base::flow_control  opt_flow = boost::asio::serial_port_base::flow_control(boost::asio::serial_port_base::flow_control::none),
boost::asio::serial_port_base::stop_bits  opt_stop = boost::asio::serial_port_base::stop_bits(boost::asio::serial_port_base::stop_bits::one) 
)

Opens a serial device.

Parameters:
devname serial device name, example "/dev/ttyS0" or "COM1"
baud_rate serial baud rate
opt_parity serial parity, default none
opt_csize serial character size, default 8bit
opt_flow serial flow control, default none
opt_stop serial stop bits, default 1
Exceptions:
boost::system::system_error if cannot open the serial device
CallbackAsyncSerial::~CallbackAsyncSerial (  )  [virtual]

Definition at line 744 of file AsyncSerial.cpp.


Member Function Documentation

void CallbackAsyncSerial::clearCallback (  ) 

Removes the callback. Any data received after this function call will be lost.

Definition at line 739 of file AsyncSerial.cpp.

void CallbackAsyncSerial::setCallback ( const boost::function< void(const char *, size_t) > &  callback  ) 

Set the read callback, the callback will be called from a thread owned by the CallbackAsyncSerial class when data arrives from the serial port.

Parameters:
callback the receive callback

Definition at line 731 of file AsyncSerial.cpp.


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


pressure_cells
Author(s): Emilio Estrelinha
autogenerated on Wed Jul 23 04:34:41 2014