#include <SerialDevice.h>
Public Member Functions | |
void | closeDevice () |
bool | isOpen () const |
void | openDevice (int oflag=O_RDWR|O_NOCTTY|O_NONBLOCK) |
void | printTermiosAttr () const |
bool | readAvailable (timeval timeout) const |
int | readDevice (char *buffer, size_t size, std::string terminalChars=std::string("\r\n")) const |
SerialDevice () | |
SerialDevice (const std::string &deviceName_, bool autoOpen=true, int oflag=O_RDWR|O_NOCTTY|O_NONBLOCK) | |
bool | setTermiosAttr (tcflag_t c_iflag, tcflag_t c_oflag, tcflag_t c_cflag, tcflag_t c_lflag, speed_t ispeed=BUNDEF, speed_t ospeed=BUNDEF, int optionalOptions=TCSAFLUSH) |
bool | setTermiosAttrCFlag (tcflag_t c_cflag, int optionalOptions=TCSAFLUSH) |
bool | setTermiosAttrIFlag (tcflag_t c_iflag, int optionalOptions=TCSAFLUSH) |
bool | setTermiosAttrLFlag (tcflag_t c_lflag, int optionalOptions=TCSAFLUSH) |
bool | setTermiosAttrOFlag (tcflag_t c_oflag, int optionalOptions=TCSAFLUSH) |
bool | setTermiosAttrSpeed (speed_t ispeed, speed_t ospeed, int optionalOptions=TCSAFLUSH) |
int | writeDevice (const void *buffer, size_t size) throw (SerialException) |
virtual | ~SerialDevice () |
Protected Attributes | |
struct termios | deviceAttr |
int | deviceFD |
std::string | deviceName |
boost::mutex | readMutex |
boost::mutex | writeMutex |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const SerialDevice &device) |
std::string & | operator<< (std::string &string, const SerialDevice &device) |
std::istream & | operator>> (std::istream &stream, SerialDevice &device) |
std::string & | operator>> (std::string &string, SerialDevice &device) |
Definition at line 34 of file SerialDevice.h.
Definition at line 22 of file SerialDevice.cpp.
TELEKYB_NAMESPACE::SerialDevice::SerialDevice | ( | const std::string & | deviceName_, |
bool | autoOpen = true , |
||
int | oflag = O_RDWR | O_NOCTTY | O_NONBLOCK |
||
) |
Definition at line 28 of file SerialDevice.cpp.
TELEKYB_NAMESPACE::SerialDevice::~SerialDevice | ( | ) | [virtual] |
Definition at line 37 of file SerialDevice.cpp.
Reimplemented in TELEKYB_NAMESPACE::ThreadedSerialDevice.
Definition at line 84 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::isOpen | ( | ) | const |
Definition at line 96 of file SerialDevice.cpp.
void TELEKYB_NAMESPACE::SerialDevice::openDevice | ( | int | oflag = O_RDWR | O_NOCTTY | O_NONBLOCK | ) |
Reimplemented in TELEKYB_NAMESPACE::ThreadedSerialDevice.
Definition at line 42 of file SerialDevice.cpp.
void TELEKYB_NAMESPACE::SerialDevice::printTermiosAttr | ( | ) | const |
Definition at line 291 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::readAvailable | ( | timeval | timeout | ) | const |
Definition at line 101 of file SerialDevice.cpp.
int TELEKYB_NAMESPACE::SerialDevice::readDevice | ( | char * | buffer, |
size_t | size, | ||
std::string | terminalChars = std::string("\r\n") |
||
) | const |
Definition at line 120 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::setTermiosAttr | ( | tcflag_t | c_iflag, |
tcflag_t | c_oflag, | ||
tcflag_t | c_cflag, | ||
tcflag_t | c_lflag, | ||
speed_t | ispeed = BUNDEF , |
||
speed_t | ospeed = BUNDEF , |
||
int | optionalOptions = TCSAFLUSH |
||
) |
Definition at line 199 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::setTermiosAttrCFlag | ( | tcflag_t | c_cflag, |
int | optionalOptions = TCSAFLUSH |
||
) |
Definition at line 254 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::setTermiosAttrIFlag | ( | tcflag_t | c_iflag, |
int | optionalOptions = TCSAFLUSH |
||
) |
Definition at line 230 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::setTermiosAttrLFlag | ( | tcflag_t | c_lflag, |
int | optionalOptions = TCSAFLUSH |
||
) |
Definition at line 266 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::setTermiosAttrOFlag | ( | tcflag_t | c_oflag, |
int | optionalOptions = TCSAFLUSH |
||
) |
Definition at line 242 of file SerialDevice.cpp.
bool TELEKYB_NAMESPACE::SerialDevice::setTermiosAttrSpeed | ( | speed_t | ispeed, |
speed_t | ospeed, | ||
int | optionalOptions = TCSAFLUSH |
||
) |
Definition at line 278 of file SerialDevice.cpp.
int TELEKYB_NAMESPACE::SerialDevice::writeDevice | ( | const void * | buffer, |
size_t | size | ||
) | throw (SerialException) |
Definition at line 159 of file SerialDevice.cpp.
std::ostream& operator<< | ( | std::ostream & | stream, |
const SerialDevice & | device | ||
) | [friend] |
Definition at line 140 of file SerialDevice.cpp.
std::string& operator<< | ( | std::string & | string, |
const SerialDevice & | device | ||
) | [friend] |
Definition at line 146 of file SerialDevice.cpp.
std::istream& operator>> | ( | std::istream & | stream, |
SerialDevice & | device | ||
) | [friend] |
Definition at line 181 of file SerialDevice.cpp.
std::string& operator>> | ( | std::string & | string, |
SerialDevice & | device | ||
) | [friend] |
Definition at line 187 of file SerialDevice.cpp.
struct termios TELEKYB_NAMESPACE::SerialDevice::deviceAttr [protected] |
Definition at line 39 of file SerialDevice.h.
int TELEKYB_NAMESPACE::SerialDevice::deviceFD [protected] |
Definition at line 38 of file SerialDevice.h.
std::string TELEKYB_NAMESPACE::SerialDevice::deviceName [protected] |
Definition at line 36 of file SerialDevice.h.
boost::mutex TELEKYB_NAMESPACE::SerialDevice::readMutex [mutable, protected] |
Definition at line 42 of file SerialDevice.h.
boost::mutex TELEKYB_NAMESPACE::SerialDevice::writeMutex [protected] |
Definition at line 43 of file SerialDevice.h.