#include <rmp_serial.h>
Public Member Functions | |
void | configure (std::string port, int baudrate) |
void | connect () |
void | disconnect () |
int | read (unsigned char *buffer, int size) |
SerialRMPIO () | |
int | write (unsigned char *buffer, int size) |
~SerialRMPIO () | |
Private Attributes | |
int | baudrate |
bool | configured |
std::string | port |
serial::Serial | serial_port |
Provides a serial based interface for reading and writing packets.
Definition at line 49 of file rmp_serial.h.
Constructs the SerialRMPIO object.
Definition at line 9 of file rmp_serial.cc.
Definition at line 13 of file rmp_serial.cc.
void SerialRMPIO::configure | ( | std::string | port, |
int | baudrate | ||
) |
Configures the serial port.
port | The com port identifier like '/dev/ttyUSB0' on POSIX and like 'COM1' on windows. |
baudrate | The speed of the serial communication. |
Definition at line 17 of file rmp_serial.cc.
void SerialRMPIO::connect | ( | ) | [virtual] |
Connects to the serial port if it has been configured. Can throw ConnectionFailedException.
Implements segwayrmp::RMPIO.
Definition at line 23 of file rmp_serial.cc.
void SerialRMPIO::disconnect | ( | ) | [virtual] |
Disconnects from the serial port if it is open.
Implements segwayrmp::RMPIO.
Definition at line 41 of file rmp_serial.cc.
int SerialRMPIO::read | ( | unsigned char * | buffer, |
int | size | ||
) | [virtual] |
Read Function, reads from the serial port.
buffer | An unsigned char array for data to be read into. |
size | The amount of data to be read. |
Implements segwayrmp::RMPIO.
Definition at line 49 of file rmp_serial.cc.
int SerialRMPIO::write | ( | unsigned char * | buffer, |
int | size | ||
) | [virtual] |
Write Function, writes to the serial port.
buffer | An unsigned char array of data to be written. |
size | The amount of data to be written. |
Implements segwayrmp::RMPIO.
Definition at line 53 of file rmp_serial.cc.
int segwayrmp::SerialRMPIO::baudrate [private] |
Definition at line 97 of file rmp_serial.h.
bool segwayrmp::SerialRMPIO::configured [private] |
Definition at line 94 of file rmp_serial.h.
std::string segwayrmp::SerialRMPIO::port [private] |
Definition at line 96 of file rmp_serial.h.
serial::Serial segwayrmp::SerialRMPIO::serial_port [private] |
Definition at line 99 of file rmp_serial.h.