#include <IOInterfaceSerial.h>
Inheritance diagram for IOInterfaceSerial:
Public Member Functions | |
IOInterfaceSerial (IOInterfaceList *iolist, const std::string &device="", int baudrate=9600) | |
Constructor. | |
virtual void | OnBeforeClose () |
Called before a reset. | |
virtual void | OnAfterOpen () |
Called after a reset. | |
virtual void | OnAfterOpenError () |
Called after a reset. | |
std::string | GetDevice () const |
Returns the device. | |
int | GetBaudRate () const |
Returns the baud rate. | |
bool | GetTermiosLocalMode () const |
Returns the termios local mode flags. | |
void | SetDevice (const std::string &device) |
Sets the device. The new device is used after the next Reopen() or Open() call. | |
void | SetBaudRate (int baudrate) |
Sets the baud rate. The new baud rate is used after the next Reopen() or Open() call. | |
void | SetTermiosLocalMode (int mode) |
Sets the ICANON flag. The new setting is used after the next Reopen() or Open() call. | |
bool | Open () |
Opens the serial port if it is closed. Returns true if the serial port was successfully opened or if it was open already. Note that calling Open() on an open device won't do anything. Call Reopen() if you want to close and open it again. | |
bool | Close () |
Closes the serial port if it is open. Returns true if the serial port was successfully closed or if it was closed already. | |
bool | Reopen () |
Closes (if necessary) and opens the serial port. Returns true if the serial port has been opened. | |
Protected Member Functions | |
unsigned long | BaudRateConstant (int baudrate) |
Converts a baud rate into a baud rate constant. |
This implements an IOInterface for a serial port (usually /dev/ttyS*).