8 #include <boost/asio.hpp>
26 void write(std::string msg);
29 void write(
char *buffer,
int length);
32 void write(
unsigned char *buffer,
int length);
42 char*
read(
int numBytes);
56 boost::asio::serial_port
port;
char read()
Reads a single byte from the serial port.
boost::asio::serial_port port
std::string readln()
Reads bytes from the serial port until or is found.
SerialPort(std::string device, int baud)
The constructor takes in the path to the port (eg. "/dev/ttyUSB0") and a baud rate for the connection...
bool isOpen()
Returns true if the serial port is connected and open.
void write(std::string msg)
Writes the given string to the serial port.
std::string devicePath()
Returns the path to the device this port is connected to.
boost::asio::io_service ioservice
Helper class to simplify interfacing with serial port hardware.