#include <serial_device.h>
Public Member Functions | |
bool | checkIfStillThere () |
void | closePort () |
bool | FlushInBuffer () |
bool | FlushOutBuffer () |
unsigned char | GetChar () |
void | GetString (std::string &rxstr) |
void | GetStringWithEndline (std::string &rxstr) |
int | openPort (std::string, int, int, int) |
int | PutString (std::string) |
SerialDevice () | |
standard includes | |
~SerialDevice () | |
Private Attributes | |
int | fd_ |
Definition at line 6 of file serial_device.h.
Definition at line 20 of file serial_device.cpp.
bool SerialDevice::checkIfStillThere | ( | ) |
Definition at line 126 of file serial_device.cpp.
void SerialDevice::closePort | ( | ) |
Definition at line 121 of file serial_device.cpp.
bool SerialDevice::FlushInBuffer | ( | ) |
Definition at line 171 of file serial_device.cpp.
bool SerialDevice::FlushOutBuffer | ( | ) |
Definition at line 180 of file serial_device.cpp.
unsigned char SerialDevice::GetChar | ( | ) |
Definition at line 188 of file serial_device.cpp.
void SerialDevice::GetString | ( | std::string & | rxstr | ) |
Definition at line 141 of file serial_device.cpp.
void SerialDevice::GetStringWithEndline | ( | std::string & | rxstr | ) |
Definition at line 156 of file serial_device.cpp.
int SerialDevice::openPort | ( | std::string | device, |
int | baud, | ||
int | Parity, | ||
int | StopBits | ||
) |
inserts '/dev/' infront of device name
attempt to open the serial device
open(2) returns <0 if the port could NOT be opened
linux serial port stuff
sets serial port baudrate
for input
for output
adjust stop bits
set data to 8-bit
load configuration. tcsetattr(3) returns <0 if error
Canonical mode
load configuration. tcsetattr(3) returns <0 if error
alles richtig!
Definition at line 29 of file serial_device.cpp.
int SerialDevice::PutString | ( | std::string | str | ) |
write(3) returns the number of bytes that were actually written
Definition at line 131 of file serial_device.cpp.
int SerialDevice::fd_ [private] |
Definition at line 31 of file serial_device.h.