nidas
v1.2-1520
|
A class providing get/set methods into a termios structure. More...
#include <Termios.h>
Classes | |
struct | baudtable |
Public Types | |
enum | parity { NONE, ODD, EVEN } |
enum | flowcontrol { NOFLOWCONTROL, HARDWARE, SOFTWARE } |
HARDWARE flow control is CTSRTS. More... | |
typedef enum flowcontrol | flowcontrol |
Public Member Functions | |
Termios () | |
Default constructor: 9600 n81, no flow control, canonical input, output. More... | |
Termios (const struct termios *) | |
Construct from an existing struct termios. More... | |
throw (IOException) | |
Construct from an opened serial port. More... | |
virtual | ~Termios () |
void | apply (int fd, const std::string &devname) throw (IOException) |
Set the termios options on a serial port. More... | |
void | set (const struct termios *) |
Set all Termios parameters from the contents of struct termios. More... | |
struct termios * | get () |
Get a const pointer to the internal struct termios. More... | |
bool | setBaudRate (int val) |
int | getBaudRate () const |
void | setParity (enum parity val) |
parity | getParity () const |
std::string | getParityString () const |
void | setDataBits (int val) |
Set number of data bits to 5,6,7 or 8. More... | |
int | getDataBits () const |
void | setStopBits (int val) |
Set number of stop bits, to 1 or 2. More... | |
int | getStopBits () const |
void | setLocal (bool val) |
If local, then ignore carrier detect modem control line. More... | |
bool | getLocal () const |
void | setFlowControl (flowcontrol val) |
Set flow control to NOFLOWCONTROL, HARDWARE or SOFTWARE. More... | |
flowcontrol | getFlowControl () const |
std::string | getFlowControlString () const |
void | setRaw (bool val) |
Sets termios options for raw or non-raw(cooked) mode. More... | |
bool | getRaw () const |
void | setRawLength (unsigned char val) |
unsigned char | getRawLength () const |
void | setRawTimeout (unsigned char val) |
unsigned char | getRawTimeout () const |
tcflag_t & | iflag () |
tcflag_t & | oflag () |
tcflag_t & | cflag () |
tcflag_t & | lflag () |
cc_t * | cc () |
tcflag_t | getIflag () const |
tcflag_t | getOflag () const |
void | setDefaultTermios () |
Static Public Attributes | |
static struct nidas::util::Termios::baudtable | bauds [] |
Private Attributes | |
struct termios | _tio |
unsigned char | _rawlen |
unsigned char | _rawtimeout |
A class providing get/set methods into a termios structure.
typedef enum flowcontrol nidas::util::Termios::flowcontrol |
Termios::Termios | ( | ) |
Default constructor: 9600 n81, no flow control, canonical input, output.
References setDefaultTermios().
Termios::Termios | ( | const struct termios * | termios_p | ) |
Construct from an existing struct termios.
References _rawlen, _rawtimeout, and _tio.
|
inlinevirtual |
void Termios::apply | ( | int | fd, |
const std::string & | devname | ||
) | |||
throw | ( | IOException | |
) |
Set the termios options on a serial port.
References fd.
Referenced by nidas::core::SerialPortIODevice::applyTermios(), nidas::util::SerialPort::applyTermios(), TeeTTy::run(), and TeeI2C::run().
|
inline |
References _tio.
|
inline |
References _tio.
struct termios * Termios::get | ( | ) |
Get a const pointer to the internal struct termios.
References _tio.
int Termios::getBaudRate | ( | ) | const |
References _tio, bauds, and nidas::util::Termios::baudtable::rate.
Referenced by nidas::dynld::isff::SE_GOESXmtr::getXmtrClockDelay(), and openPort().
int Termios::getDataBits | ( | ) | const |
References _tio.
Referenced by openPort().
Termios::flowcontrol Termios::getFlowControl | ( | ) | const |
References _tio, HARDWARE, NOFLOWCONTROL, and SOFTWARE.
Referenced by getFlowControlString().
std::string Termios::getFlowControlString | ( | ) | const |
References getFlowControl(), HARDWARE, NOFLOWCONTROL, and SOFTWARE.
|
inline |
References _tio.
bool Termios::getLocal | ( | ) | const |
References _tio.
|
inline |
References _tio.
Termios::parity Termios::getParity | ( | ) | const |
References _tio, EVEN, NONE, and ODD.
Referenced by getParityString().
std::string Termios::getParityString | ( | ) | const |
References EVEN, getParity(), NONE, and ODD.
bool Termios::getRaw | ( | ) | const |
References _tio.
Referenced by TeeTTy::run().
unsigned char Termios::getRawLength | ( | ) | const |
References _tio.
unsigned char Termios::getRawTimeout | ( | ) | const |
References _tio.
int Termios::getStopBits | ( | ) | const |
References _tio.
Referenced by openPort().
|
inline |
References _tio.
Referenced by GPS_SetClock::run().
|
inline |
References _tio.
Referenced by GPS_SetClock::run().
|
inline |
References _tio.
Referenced by GPS_SetClock::run().
void Termios::set | ( | const struct termios * | termios_p | ) |
Set all Termios parameters from the contents of struct termios.
References _rawlen, _rawtimeout, and _tio.
bool Termios::setBaudRate | ( | int | val | ) |
void Termios::setDataBits | ( | int | val | ) |
Set number of data bits to 5,6,7 or 8.
References _tio.
Referenced by nidas::dynld::isff::GOESXmtr::fromDOMElement(), and nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr().
void Termios::setDefaultTermios | ( | ) |
References _rawlen, _rawtimeout, and _tio.
Referenced by Termios().
void Termios::setFlowControl | ( | flowcontrol | val | ) |
Set flow control to NOFLOWCONTROL, HARDWARE or SOFTWARE.
References _tio, HARDWARE, NOFLOWCONTROL, and SOFTWARE.
Referenced by nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr().
void Termios::setLocal | ( | bool | val | ) |
If local, then ignore carrier detect modem control line.
References _tio.
Referenced by nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr().
void Termios::setParity | ( | enum parity | val | ) |
References _tio, EVEN, NONE, and ODD.
Referenced by nidas::dynld::isff::GOESXmtr::fromDOMElement(), and nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr().
void Termios::setRaw | ( | bool | val | ) |
Sets termios options for raw or non-raw(cooked) mode.
val | false sets the serial port for "cooked" mode, where canonical processing is applied to input lines, and output lines are post-processed before transmission. Input carriage returns are converted to newlines, and output newlines are converted to carriage returns. For other conversions, the appropriate bits (IGNCR, INLCR, ICRNL, ONLCR, OCRNL) from termios.h should be set in iflag() and oflag() after the call to setRaw(). true sets the serial port for "raw" mode, where canonical input and post output processing are not performed. THE VMIN and VTIME members of c_cc are set to getRawLength() and getRawTimeout() respectfully. |
References _rawlen, _rawtimeout, and _tio.
Referenced by openPort(), Garmin::run(), TeeTTy::run(), TeeI2C::run(), nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr(), nidas::core::SerialPortIODevice::SerialPortIODevice(), and nidas::core::SerialSensor::SerialSensor().
void Termios::setRawLength | ( | unsigned char | val | ) |
void Termios::setRawTimeout | ( | unsigned char | val | ) |
References _rawtimeout, and _tio.
Referenced by openPort(), Garmin::run(), nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr(), nidas::core::SerialPortIODevice::SerialPortIODevice(), and nidas::core::SerialSensor::SerialSensor().
void Termios::setStopBits | ( | int | val | ) |
Set number of stop bits, to 1 or 2.
References _tio.
Referenced by nidas::dynld::isff::GOESXmtr::fromDOMElement(), and nidas::dynld::isff::SE_GOESXmtr::SE_GOESXmtr().
nidas::util::Termios::throw | ( | IOException | ) |
Construct from an opened serial port.
|
private |
Referenced by set(), setDefaultTermios(), setRaw(), setRawLength(), and Termios().
|
private |
Referenced by set(), setDefaultTermios(), setRaw(), setRawTimeout(), and Termios().
|
private |
Referenced by cc(), cflag(), get(), getBaudRate(), getDataBits(), getFlowControl(), getIflag(), getLocal(), getOflag(), getParity(), getRaw(), getRawLength(), getRawTimeout(), getStopBits(), iflag(), lflag(), oflag(), set(), setBaudRate(), setDataBits(), setDefaultTermios(), setFlowControl(), setLocal(), setParity(), setRaw(), setRawLength(), setRawTimeout(), setStopBits(), and Termios().
|
static |
Referenced by getBaudRate(), and setBaudRate().