SimpleSerial class.
More...
#include <serialcom_boost.h>
|
boost::asio::io_service | io |
|
boost::asio::serial_port | serial |
|
SimpleSerial class.
This class provides simple read and write functions for serial ports.
Definition at line 43 of file serialcom_boost.h.
SimpleSerial::SimpleSerial |
( |
std::string |
port, |
|
|
unsigned int |
baud_rate |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
port | device name, example "/dev/ttyUSB0" or "COM4" |
baud_rate | communication speed, example 9600 or 115200 |
- Exceptions
-
boost::system::system_error | if cannot open the serial device |
Definition at line 56 of file serialcom_boost.h.
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_error | on 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
-
- Exceptions
-
boost::system::system_error | on failure |
Definition at line 66 of file serialcom_boost.h.
boost::asio::io_service SimpleSerial::io |
|
private |
boost::asio::serial_port SimpleSerial::serial |
|
private |
The documentation for this class was generated from the following file: