#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 () | |
Public Member Functions inherited from segwayrmp::RMPIO | |
void | cancel () |
void | getPacket (Packet &packet) |
bool | isConnected () |
RMPIO () | |
void | sendPacket (Packet &packet) |
Private Attributes | |
int | baudrate |
bool | configured |
std::string | port |
serial::Serial | serial_port |
Additional Inherited Members | |
Protected Member Functions inherited from segwayrmp::RMPIO | |
unsigned char | computeChecksum (unsigned char *usb_packet) |
void | fillBuffer () |
Protected Attributes inherited from segwayrmp::RMPIO | |
bool | canceled |
bool | connected |
std::vector< unsigned char > | data_buffer |
Provides a serial based interface for reading and writing packets.
Definition at line 49 of file rmp_serial.h.
SerialRMPIO::SerialRMPIO | ( | ) |
Constructs the SerialRMPIO object.
Definition at line 9 of file rmp_serial.cc.
SerialRMPIO::~SerialRMPIO | ( | ) |
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.
|
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.
|
virtual |
Disconnects from the serial port if it is open.
Implements segwayrmp::RMPIO.
Definition at line 41 of file rmp_serial.cc.
|
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.
|
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.
|
private |
Definition at line 97 of file rmp_serial.h.
|
private |
Definition at line 94 of file rmp_serial.h.
|
private |
Definition at line 96 of file rmp_serial.h.
|
private |
Definition at line 99 of file rmp_serial.h.