nidas v1.2.3
|
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. | |
Termios (const struct termios *) | |
Construct from an existing struct termios. | |
Termios (int fd, const std::string &devname) | |
Construct from an opened serial port. | |
virtual | ~Termios () |
void | apply (int fd, const std::string &devname) |
Set the termios options on a serial port. | |
void | set (const struct termios *) |
Set all Termios parameters from the contents of struct termios. | |
const struct termios * | get () |
Get a const pointer to the internal struct termios. | |
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. | |
int | getDataBits () const |
void | setStopBits (int val) |
Set number of stop bits, to 1 or 2. | |
int | getStopBits () const |
void | setLocal (bool val) |
If local, then ignore carrier detect modem control line. | |
bool | getLocal () const |
void | setFlowControl (flowcontrol val) |
Set flow control to NOFLOWCONTROL, HARDWARE or SOFTWARE. | |
flowcontrol | getFlowControl () const |
std::string | getFlowControlString () const |
void | setRaw (bool val) |
Sets termios options for raw or non-raw(cooked) mode. | |
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.
Termios::Termios | ( | int | fd, |
const std::string & | devname ) |
Construct from an opened serial port.
IOException |
References _rawlen, _rawtimeout, _tio, and fd.
|
inlinevirtual |
void Termios::apply | ( | int | fd, |
const std::string & | devname ) |
Set the termios options on a serial port.
IOException |
Referenced by nidas::core::SerialPortIODevice::applyTermios(), nidas::util::SerialPort::applyTermios(), and nidas::util::SerialPort::open().
|
inline |
References _tio.
|
inline |
References _tio.
const struct termios * Termios::get | ( | ) |
Get a const pointer to the internal struct termios.
References _tio.
int Termios::getBaudRate | ( | ) | const |
int Termios::getDataBits | ( | ) | const |
References _tio.
Referenced by nidas::core::SerialPortIODevice::getUsecsPerByte(), nidas::dynld::ModbusRTU::open(), and nidas::util::SerialOptions::toString().
Termios::flowcontrol Termios::getFlowControl | ( | ) | const |
References _tio, HARDWARE, NOFLOWCONTROL, and SOFTWARE.
Referenced by getFlowControlString(), and nidas::util::SerialOptions::toString().
std::string Termios::getFlowControlString | ( | ) | const |
References getFlowControl(), HARDWARE, NOFLOWCONTROL, and SOFTWARE.
|
inline |
References _tio.
Referenced by nidas::util::SerialOptions::toString().
bool Termios::getLocal | ( | ) | const |
References _tio.
Referenced by nidas::util::SerialOptions::toString().
|
inline |
References _tio.
Referenced by nidas::util::SerialOptions::toString().
Termios::parity Termios::getParity | ( | ) | const |
References _tio, EVEN, NONE, and ODD.
Referenced by getParityString(), nidas::core::SerialPortIODevice::getUsecsPerByte(), nidas::dynld::ModbusRTU::open(), and nidas::util::SerialOptions::toString().
std::string Termios::getParityString | ( | ) | const |
References EVEN, getParity(), NONE, and ODD.
bool Termios::getRaw | ( | ) | const |
References _tio.
Referenced by nidas::util::SerialOptions::toString().
unsigned char Termios::getRawLength | ( | ) | const |
References _tio.
unsigned char Termios::getRawTimeout | ( | ) | const |
References _tio.
int Termios::getStopBits | ( | ) | const |
References _tio.
Referenced by nidas::core::SerialPortIODevice::getUsecsPerByte(), nidas::dynld::ModbusRTU::open(), and nidas::util::SerialOptions::toString().
|
inline |
References _tio.
Referenced by nidas::util::SerialOptions::parse().
|
inline |
References _tio.
|
inline |
References _tio.
Referenced by nidas::util::SerialOptions::parse().
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 | ) |
References _tio, bauds, and rate.
Referenced by nidas::core::RemoteSerialConnection::doEscCmds(), nidas::core::SerialSensor::fromDOMElement(), nidas::util::SerialOptions::parse(), Garmin::run(), and GPS_SetClock::run().
void Termios::setDataBits | ( | int | val | ) |
Set number of data bits to 5,6,7 or 8.
References _tio.
Referenced by nidas::core::SerialSensor::fromDOMElement(), and nidas::util::SerialOptions::parse().
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::util::SerialOptions::parse().
void Termios::setLocal | ( | bool | val | ) |
If local, then ignore carrier detect modem control line.
References _tio.
Referenced by nidas::util::SerialOptions::parse().
void Termios::setParity | ( | enum parity | val | ) |
References _tio, EVEN, NONE, and ODD.
Referenced by nidas::core::SerialSensor::fromDOMElement(), and nidas::util::SerialOptions::parse().
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 nidas::util::SerialOptions::parse(), nidas::core::SerialPortIODevice::SerialPortIODevice(), 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 nidas::core::SerialPortIODevice::SerialPortIODevice(), 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::core::SerialSensor::fromDOMElement(), and nidas::util::SerialOptions::parse().
|
private |
Referenced by set(), setDefaultTermios(), setRaw(), setRawLength(), Termios(), and Termios().
|
private |
Referenced by set(), setDefaultTermios(), setRaw(), setRawTimeout(), Termios(), and Termios().
|
private |
Referenced by apply(), 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(), Termios(), and Termios().
|
static |
Referenced by getBaudRate(), and setBaudRate().