nidas  v1.2-1520
Classes | Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
nidas::util::Termios Class Reference

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
 

Detailed Description

A class providing get/set methods into a termios structure.

Member Typedef Documentation

Member Enumeration Documentation

HARDWARE flow control is CTSRTS.

SOFTWARE is Xon/Xoff.

Enumerator
NOFLOWCONTROL 
HARDWARE 
SOFTWARE 
Enumerator
NONE 
ODD 
EVEN 

Constructor & Destructor Documentation

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.

virtual nidas::util::Termios::~Termios ( )
inlinevirtual

Member Function Documentation

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().

cc_t* nidas::util::Termios::cc ( )
inline

References _tio.

tcflag_t& nidas::util::Termios::cflag ( )
inline

References _tio.

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 openPort().

Termios::flowcontrol Termios::getFlowControl ( ) const

References _tio, HARDWARE, NOFLOWCONTROL, and SOFTWARE.

Referenced by getFlowControlString().

std::string Termios::getFlowControlString ( ) const
tcflag_t nidas::util::Termios::getIflag ( ) const
inline

References _tio.

bool Termios::getLocal ( ) const

References _tio.

tcflag_t nidas::util::Termios::getOflag ( ) const
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().

tcflag_t& nidas::util::Termios::iflag ( )
inline

References _tio.

Referenced by GPS_SetClock::run().

tcflag_t& nidas::util::Termios::lflag ( )
inline

References _tio.

Referenced by GPS_SetClock::run().

tcflag_t& nidas::util::Termios::oflag ( )
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)
void Termios::setRaw ( bool  val)

Sets termios options for raw or non-raw(cooked) mode.

Parameters
valfalse 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)
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.

Member Data Documentation

unsigned char nidas::util::Termios::_rawlen
private
unsigned char nidas::util::Termios::_rawtimeout
private
struct termios nidas::util::Termios::_tio
private
Termios::baudtable Termios::bauds
static

Referenced by getBaudRate(), and setBaudRate().


The documentation for this class was generated from the following files: