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

Class providing a method to parse a string into a Termios. More...

#include <SerialOptions.h>

Public Member Functions

 SerialOptions () throw (ParseException)
 
 ~SerialOptions ()
 
void parse (const std::string &input) throw (ParseException)
 Parse a string into a Termios object. More...
 
const TermiosgetTermios () const
 
std::string toString () const
 

Static Public Member Functions

static const char * usage ()
 

Private Attributes

regex_t _compRegex
 
int _compileResult
 
int _nmatch
 
Termios _termios
 

Static Private Attributes

static const char * _regexpression
 

Detailed Description

Class providing a method to parse a string into a Termios.

An example of a parseable string is: 9600n81lncnc : 9600 baud, no parity, local, no flow control
\

Constructor & Destructor Documentation

SerialOptions::SerialOptions ( )
throw (ParseException
)
SerialOptions::~SerialOptions ( )

Member Function Documentation

const Termios& nidas::util::SerialOptions::getTermios ( ) const
inline

References _termios.

Referenced by SensorSimApp::main(), openPort(), and TeeTTy::run().

void SerialOptions::parse ( const std::string &  input)
throw (ParseException
)

Parse a string into a Termios object.

The format of the string is as follows, with no spaces between the values: baud parity data stop local_modem flow_control raw_cooked newline_opts

baud: 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, etc bits/sec parity: n=none, o=odd, e=even data: number of data bits, 8 or 7 stop: number of stop bits, 1 or 2 local_modem: l=local (ignore carrier detect), m=modem (monitor CD) flow_control: n=none, h=hardware (CTS/RTS), s=software (XON/XOFF) raw_cooked: r=raw (no change to input or output characters, binary data) c=cooked (scan input and output for special characters) newline_opts: input option followed by output option, and is only necessary if "cooked" option is enabled. input option: n=convert input carriage-return (CR) to new-line (NL) c=convert input NL to CR d=discard input CRs x=no change to CRs output option: n=convert output CR to NL c=convert output NL to CR x=no change to CR Example: 9600n81lncnc : 9600 baud, no parity, local, no flow control cooked, convert input CR->NL, output NL->CR (unix terminal)

References nidas::util::Termios::EVEN, nidas::util::Termios::HARDWARE, nidas::util::Termios::NOFLOWCONTROL, nidas::util::Termios::NONE, nidas::util::Termios::ODD, and nidas::util::Termios::SOFTWARE.

Referenced by SensorSimApp::main(), openPort(), and TeeTTy::parseRunstring().

string SerialOptions::toString ( ) const
const char * SerialOptions::usage ( )
static

Member Data Documentation

int nidas::util::SerialOptions::_compileResult
private
regex_t nidas::util::SerialOptions::_compRegex
private
int nidas::util::SerialOptions::_nmatch
private
const char * SerialOptions::_regexpression
staticprivate
Initial value:
=
"^([0-9]+)([neo])([78])([12])([lm])([nhs])([rc])([ncdx][ncx])?$"
Termios nidas::util::SerialOptions::_termios
private

Referenced by getTermios().


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