Skeletal Animation Multithread Face
|
#include <serial_com.h>
Public Member Functions | |
SerialCOM (std::string port, unsigned int baud_rate) | |
Constructor. More... | |
void | writeString (std::string s) |
Write a string to the serial device. More... | |
std::string | readLine (void) |
Blocks until a line is received from the serial device. More... | |
void | initialize_stream (int iter=3) |
Setup up stream by reading the values a couple times first. More... | |
Private Attributes | |
boost::asio::io_service | io |
Boost io service. More... | |
boost::asio::serial_port | serial |
Boost serial port handle. More... | |
Class SerialCOM.
This class handles all the serial communication between the PC and the exoskeleton board. It's based on boost::asio. See https://www.boost.org/doc/libs/1_75_0/doc/html/boost_asio.html.
Definition at line 12 of file serial_com.h.
|
inline |
Constructor.
Constructor.
port | device name, example "/dev/ttyUSB0" or "COM4". |
baud_rate | communication speed, example 9600 or 115200. |
boost::system::system_error | if cannot open the serial device. |
Definition at line 23 of file serial_com.h.
void SerialCOM::initialize_stream | ( | int | iter = 3 | ) |
Setup up stream by reading the values a couple times first.
iter | Number of times to read for warming up. |
Definition at line 45 of file serial_com.cpp.
std::string SerialCOM::readLine | ( | void | ) |
Blocks until a line is received from the serial device.
Blocks until a line is received from the serial device. Eventual '
' or '\r
' characters at the end of the string are removed.
boost::system::system_error | on failure. |
Definition at line 19 of file serial_com.cpp.
void SerialCOM::writeString | ( | std::string | s | ) |
Write a string to the serial device.
Write a string to the serial device.
s | string to write. |
boost::system::system_error | on failure. |
Definition at line 8 of file serial_com.cpp.
|
private |
Boost io service.
Definition at line 40 of file serial_com.h.
|
private |
Boost serial port handle.
Definition at line 43 of file serial_com.h.