Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 742

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

\section{ost::Serial Class Reference}
\label{classost_1_1_serial}\index{ost::Serial@{ost::Serial}}
The {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} class is used as the base for all serial I/O services under APE.base class for all serial I/O services.  


{\tt \#include $<$serial.h$>$}

Inheritance diagram for ost::Serial::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3cm]{classost_1_1_serial}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef enum {\bf Error} {\bf Error}
\item 
typedef enum {\bf Flow} {\bf Flow}
\item 
typedef enum {\bf Parity} {\bf Parity}
\item 
typedef enum {\bf Pending} {\bf Pending}
\item 
enum {\bf Error} \{ \par
{\bf err\-Success} =  0, 
{\bf err\-Open\-No\-Tty}, 
{\bf err\-Open\-Failed}, 
{\bf err\-Speed\-Invalid}, 
\par
{\bf err\-Flow\-Invalid}, 
{\bf err\-Parity\-Invalid}, 
{\bf err\-Charsize\-Invalid}, 
{\bf err\-Stopbits\-Invalid}, 
\par
{\bf err\-Option\-Invalid}, 
{\bf err\-Resource\-Failure}, 
{\bf err\-Output}, 
{\bf err\-Input}, 
\par
{\bf err\-Timeout}, 
{\bf err\-Extended}
 \}
\item 
enum {\bf Flow} \{ {\bf flow\-None}, 
{\bf flow\-Soft}, 
{\bf flow\-Hard}, 
{\bf flow\-Both}
 \}
\item 
enum {\bf Parity} \{ {\bf parity\-None}, 
{\bf parity\-Odd}, 
{\bf parity\-Even}
 \}
\item 
enum {\bf Pending} \{ {\bf pending\-Input}, 
{\bf pending\-Output}, 
{\bf pending\-Error}
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
virtual {\bf $\sim$Serial} ()
\begin{CompactList}\small\item\em The serial base class may be \char`\"{}thrown\char`\"{} as a result on an error, and the \char`\"{}catcher\char`\"{} may then choose to destory the object. \item\end{CompactList}\item 
{\bf Serial} \& {\bf operator=} (const {\bf Serial} \&from)
\begin{CompactList}\small\item\em {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} ports may also be duplecated by the assignment operator. \item\end{CompactList}\item 
{\bf Error} {\bf set\-Speed} (unsigned long speed)
\begin{CompactList}\small\item\em Set serial port speed for both input and output. \item\end{CompactList}\item 
{\bf Error} {\bf set\-Char\-Bits} (int bits)
\begin{CompactList}\small\item\em Set character size. \item\end{CompactList}\item 
{\bf Error} {\bf set\-Parity} ({\bf Parity} parity)
\begin{CompactList}\small\item\em Set parity mode. \item\end{CompactList}\item 
{\bf Error} {\bf set\-Stop\-Bits} (int bits)
\begin{CompactList}\small\item\em Set number of stop bits. \item\end{CompactList}\item 
{\bf Error} {\bf set\-Flow\-Control} ({\bf Flow} flow)
\begin{CompactList}\small\item\em Set flow control. \item\end{CompactList}\item 
void {\bf toggle\-DTR} ({\bf timeout\_\-t} millisec)
\begin{CompactList}\small\item\em Set the DTR mode off momentarily. \item\end{CompactList}\item 
void {\bf send\-Break} (void)
\begin{CompactList}\small\item\em Send the \char`\"{}break\char`\"{} signal. \item\end{CompactList}\item 
{\bf Error} {\bf get\-Error\-Number} (void)
\begin{CompactList}\small\item\em Often used by a \char`\"{}catch\char`\"{} to fetch the last error of a thrown serial. \item\end{CompactList}\item 
char $\ast$ {\bf get\-Error\-String} (void)
\begin{CompactList}\small\item\em Often used by a \char`\"{}catch\char`\"{} to fetch the user set error string of a thrown serial. \item\end{CompactList}\item 
int {\bf get\-Buffer\-Size} (void)
\begin{CompactList}\small\item\em Get the \char`\"{}buffer\char`\"{} size for buffered operations. \item\end{CompactList}\item 
virtual bool {\bf is\-Pending} ({\bf Pending} pend, {\bf timeout\_\-t} timeout=TIMEOUT\_\-INF)
\begin{CompactList}\small\item\em Get the status of pending operations. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf open} (const char $\ast$fname)
\begin{CompactList}\small\item\em Opens the serial device. \item\end{CompactList}\item 
void {\bf close} (void)
\begin{CompactList}\small\item\em Closes the serial device. \item\end{CompactList}\item 
virtual int {\bf a\-Read} (char $\ast$Data, const int Length)
\begin{CompactList}\small\item\em Reads from serial device. \item\end{CompactList}\item 
virtual int {\bf a\-Write} (const char $\ast$Data, const int Length)
\begin{CompactList}\small\item\em Writes to serial device. \item\end{CompactList}\item 
{\bf Error} {\bf error} ({\bf Error} error, char $\ast$errstr=NULL)
\begin{CompactList}\small\item\em This service is used to throw all serial errors which usually occur during the serial constructor. \item\end{CompactList}\item 
void {\bf error} (char $\ast$err)
\begin{CompactList}\small\item\em This service is used to thow application defined serial errors where the application specific error code is a string. \item\end{CompactList}\item 
void {\bf set\-Error} (bool enable)
\begin{CompactList}\small\item\em This method is used to turn the error handler on or off for \char`\"{}throwing\char`\"{} execptions by manipulating the thrown flag. \item\end{CompactList}\item 
int {\bf set\-Packet\-Input} (int size, unsigned char btimer=0)
\begin{CompactList}\small\item\em Set packet read mode and \char`\"{}size\char`\"{} of packet read buffer. \item\end{CompactList}\item 
int {\bf set\-Line\-Input} (char newline=13, char nl1=0)
\begin{CompactList}\small\item\em Set \char`\"{}line buffering\char`\"{} read mode and specifies the newline character to be used in seperating line records. \item\end{CompactList}\item 
void {\bf restore} (void)
\begin{CompactList}\small\item\em Restore serial device to the original settings at time of open. \item\end{CompactList}\item 
void {\bf flush\-Input} (void)
\begin{CompactList}\small\item\em Used to flush the input waiting queue. \item\end{CompactList}\item 
void {\bf flush\-Output} (void)
\begin{CompactList}\small\item\em Used to flush any pending output data. \item\end{CompactList}\item 
void {\bf wait\-Output} (void)
\begin{CompactList}\small\item\em Used to wait until all output has been sent. \item\end{CompactList}\item 
void {\bf end\-Serial} (void)
\begin{CompactList}\small\item\em Used as the default destructor for ending serial I/O services. \item\end{CompactList}\item 
void {\bf init\-Config} (void)
\begin{CompactList}\small\item\em Used to initialize a newly opened serial file handle. \item\end{CompactList}\item 
{\bf Serial} ()
\begin{CompactList}\small\item\em This allows later ttystream class to open and close a serial device. \item\end{CompactList}\item 
{\bf Serial} (const char $\ast$name)
\begin{CompactList}\small\item\em A serial object may be constructed from a named file on the file system. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
{\bf HANDLE} {\bf dev}
\item 
int {\bf bufsize}
\end{CompactItemize}


\subsection{Detailed Description}
The {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} class is used as the base for all serial I/O services under APE.base class for all serial I/O services. 

A serial is a system serial port that is used either for line or packet based data input. {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} ports may also be \char`\"{}streamable\char`\"{} in a derived form.

Common C++ serial I/O classes are used to manage serial devices and implement serial device protocols. From the point of view of Common C++, serial devices are supported by the underlying Posix specified \char`\"{}termios\char`\"{} call interface.

The serial I/O base class is used to hold a descriptor to a serial device and to provide an exception handling interface for all serial I/O classes. The base class is also used to specify serial I/O properties such as communication speed, flow control, data size, and parity. The \char`\"{}Serial\char`\"{} base class is not itself directly used in application development, however.

Common C++ {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} I/O is itself divided into two conceptual modes; frame oriented and line oriented I/O. Both frame and line oriented I/O makes use of the ability of the underlying tty driver to buffer data and return \char`\"{}ready\char`\"{} status from when select either a specified number of bytes or newline record has been reached by manipulating termios c\_\-cc fields appropriately. This provides some advantage in that a given thread servicing a serial port can block and wait rather than have to continually poll or read each and every byte as soon as it appears at the serial port.

\begin{Desc}
\item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc}




\subsection{Member Typedef Documentation}
\index{ost::Serial@{ost::Serial}!Error@{Error}}
\index{Error@{Error}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef enum {\bf Error} {\bf ost::Serial::Error}}\label{classost_1_1_serial_1955d3954338199da7165a4beb7c9703}


\index{ost::Serial@{ost::Serial}!Flow@{Flow}}
\index{Flow@{Flow}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef enum {\bf Flow} {\bf ost::Serial::Flow}}\label{classost_1_1_serial_032e8d67ca5a8f64a5cd348e1cba423d}


\index{ost::Serial@{ost::Serial}!Parity@{Parity}}
\index{Parity@{Parity}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef enum {\bf Parity} {\bf ost::Serial::Parity}}\label{classost_1_1_serial_f7aab47de333eecc51d76a551dcd81db}


\index{ost::Serial@{ost::Serial}!Pending@{Pending}}
\index{Pending@{Pending}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}typedef enum {\bf Pending} {\bf ost::Serial::Pending}}\label{classost_1_1_serial_7acdd43b4d1766daa58bbb49352dd942}




\subsection{Member Enumeration Documentation}
\index{ost::Serial@{ost::Serial}!Error@{Error}}
\index{Error@{Error}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf ost::Serial::Error}}\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{errSuccess@{errSuccess}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errSuccess@{errSuccess}}\item[{\em 
err\-Success\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a34649740d28eb35e78818af6d54350c3fd597d}
}]\index{errOpenNoTty@{errOpenNoTty}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errOpenNoTty@{errOpenNoTty}}\item[{\em 
err\-Open\-No\-Tty\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497dea5750f4c5d011d5c543b373a2cf230}
}]\index{errOpenFailed@{errOpenFailed}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errOpenFailed@{errOpenFailed}}\item[{\em 
err\-Open\-Failed\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497ef0ca060f94b5db0608bf3ceeaaedbee}
}]\index{errSpeedInvalid@{errSpeedInvalid}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errSpeedInvalid@{errSpeedInvalid}}\item[{\em 
err\-Speed\-Invalid\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a3464975fa6a9e68cb29ec15f600c22fb424c9a}
}]\index{errFlowInvalid@{errFlowInvalid}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errFlowInvalid@{errFlowInvalid}}\item[{\em 
err\-Flow\-Invalid\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497936c7e7aedb62d8c3654192f96b0c1b5}
}]\index{errParityInvalid@{errParityInvalid}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errParityInvalid@{errParityInvalid}}\item[{\em 
err\-Parity\-Invalid\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497dc409d6ffee22d17e7646bfce2d50b8e}
}]\index{errCharsizeInvalid@{errCharsizeInvalid}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errCharsizeInvalid@{errCharsizeInvalid}}\item[{\em 
err\-Charsize\-Invalid\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497280b96416b3ad39f1142f6918267bf5f}
}]\index{errStopbitsInvalid@{errStopbitsInvalid}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errStopbitsInvalid@{errStopbitsInvalid}}\item[{\em 
err\-Stopbits\-Invalid\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a3464975b6b13043d4c239acbdbcfb0b53ece92}
}]\index{errOptionInvalid@{errOptionInvalid}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errOptionInvalid@{errOptionInvalid}}\item[{\em 
err\-Option\-Invalid\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a34649756ec86c7748b88f2e61e7cb2aa6313d0}
}]\index{errResourceFailure@{errResourceFailure}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errResourceFailure@{errResourceFailure}}\item[{\em 
err\-Resource\-Failure\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497ac71caec475b2c8e77061d486f000b04}
}]\index{errOutput@{errOutput}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errOutput@{errOutput}}\item[{\em 
err\-Output\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497461e080df6f82ec6017226cba19a92b2}
}]\index{errInput@{errInput}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errInput@{errInput}}\item[{\em 
err\-Input\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a3464973f81ba432a4ff8864033a355bd1ffccd}
}]\index{errTimeout@{errTimeout}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errTimeout@{errTimeout}}\item[{\em 
err\-Timeout\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a346497c64e00c5dee4d6ac546856dc8135ccd9}
}]\index{errExtended@{errExtended}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!errExtended@{errExtended}}\item[{\em 
err\-Extended\label{classost_1_1_serial_2f1bcf165447d5ed96093b6c8a34649771b4964c5c550da322e19ae8fdb0b190}
}]\end{description}
\end{Desc}

\index{ost::Serial@{ost::Serial}!Flow@{Flow}}
\index{Flow@{Flow}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf ost::Serial::Flow}}\label{classost_1_1_serial_269fc64928cd10bae2fe8a2eefab6303}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{flowNone@{flowNone}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!flowNone@{flowNone}}\item[{\em 
flow\-None\label{classost_1_1_serial_269fc64928cd10bae2fe8a2eefab6303200f49e5ec47a4060706a210148af629}
}]\index{flowSoft@{flowSoft}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!flowSoft@{flowSoft}}\item[{\em 
flow\-Soft\label{classost_1_1_serial_269fc64928cd10bae2fe8a2eefab630340e097623df09f0aa335e2316eba1893}
}]\index{flowHard@{flowHard}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!flowHard@{flowHard}}\item[{\em 
flow\-Hard\label{classost_1_1_serial_269fc64928cd10bae2fe8a2eefab63037b1222095085ca00a08988a849c0d78f}
}]\index{flowBoth@{flowBoth}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!flowBoth@{flowBoth}}\item[{\em 
flow\-Both\label{classost_1_1_serial_269fc64928cd10bae2fe8a2eefab630374c00e3f9dd79bb8493f5fc87bd73b81}
}]\end{description}
\end{Desc}

\index{ost::Serial@{ost::Serial}!Parity@{Parity}}
\index{Parity@{Parity}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf ost::Serial::Parity}}\label{classost_1_1_serial_54bdc2b3ce16dbf3542785ef69188f7c}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{parityNone@{parityNone}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!parityNone@{parityNone}}\item[{\em 
parity\-None\label{classost_1_1_serial_54bdc2b3ce16dbf3542785ef69188f7cc6e7991c8940f35aed8d547ac1455e0c}
}]\index{parityOdd@{parityOdd}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!parityOdd@{parityOdd}}\item[{\em 
parity\-Odd\label{classost_1_1_serial_54bdc2b3ce16dbf3542785ef69188f7cb31e527b4644ba0f4b08f14a016e54c2}
}]\index{parityEven@{parityEven}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!parityEven@{parityEven}}\item[{\em 
parity\-Even\label{classost_1_1_serial_54bdc2b3ce16dbf3542785ef69188f7cc99c7fdd2af17159f785e878edd1f221}
}]\end{description}
\end{Desc}

\index{ost::Serial@{ost::Serial}!Pending@{Pending}}
\index{Pending@{Pending}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf ost::Serial::Pending}}\label{classost_1_1_serial_74fbabfe1dcbaebf6e484af11dd6d8b7}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{pendingInput@{pendingInput}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!pendingInput@{pendingInput}}\item[{\em 
pending\-Input\label{classost_1_1_serial_74fbabfe1dcbaebf6e484af11dd6d8b7252411555c5a7db1682c762f3acc5ad5}
}]\index{pendingOutput@{pendingOutput}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!pendingOutput@{pendingOutput}}\item[{\em 
pending\-Output\label{classost_1_1_serial_74fbabfe1dcbaebf6e484af11dd6d8b7a13e15f4121356d33e5b9c7485b6a6b5}
}]\index{pendingError@{pendingError}!ost::Serial@{ost::Serial}}\index{ost::Serial@{ost::Serial}!pendingError@{pendingError}}\item[{\em 
pending\-Error\label{classost_1_1_serial_74fbabfe1dcbaebf6e484af11dd6d8b7d738f8c83dd497aeff2d639ba86bb84c}
}]\end{description}
\end{Desc}



\subsection{Constructor \& Destructor Documentation}
\index{ost::Serial@{ost::Serial}!Serial@{Serial}}
\index{Serial@{Serial}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Serial::Serial ()\hspace{0.3cm}{\tt  [inline, protected]}}\label{classost_1_1_serial_2cc577c5c283fa23edf6efeaf5617829}


This allows later ttystream class to open and close a serial device. 

\index{ost::Serial@{ost::Serial}!Serial@{Serial}}
\index{Serial@{Serial}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Serial::Serial (const char $\ast$ {\em name})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_b34bbb6966918cb639e1003b7c1f2cb1}


A serial object may be constructed from a named file on the file system. 

This named device must be \char`\"{}isatty()\char`\"{}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em name}]of file. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!~Serial@{$\sim$Serial}}
\index{~Serial@{$\sim$Serial}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Serial::$\sim$Serial ()\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_serial_a62d1da910fb5454abb936a1c1b362c7}


The serial base class may be \char`\"{}thrown\char`\"{} as a result on an error, and the \char`\"{}catcher\char`\"{} may then choose to destory the object. 

By assuring the socket base class is a virtual destructor, we can assure the full object is properly terminated. 

\subsection{Member Function Documentation}
\index{ost::Serial@{ost::Serial}!aRead@{aRead}}
\index{aRead@{aRead}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int ost::Serial::a\-Read (char $\ast$ {\em Data}, const int {\em Length})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classost_1_1_serial_a7054a38f90bed8943c8bf4ac63b09da}


Reads from serial device. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em Data}]Point to character buffer to receive data. Buffers MUST be at least Length + 1 bytes in size. \item[{\em Length}]{\bf Number}{\rm (p.\,\pageref{classost_1_1_number})} of bytes to read. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!aWrite@{aWrite}}
\index{aWrite@{aWrite}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual int ost::Serial::a\-Write (const char $\ast$ {\em Data}, const int {\em Length})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classost_1_1_serial_0a5f8409773d746095a959e636c50e46}


Writes to serial device. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em Data}]Point to character buffer containing data to write. Buffers MUST \item[{\em Length}]{\bf Number}{\rm (p.\,\pageref{classost_1_1_number})} of bytes to write. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!close@{close}}
\index{close@{close}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::close (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_b58a9efec4fffc41b7f0618734a549e0}


Closes the serial device. 



Reimplemented in {\bf ost::ttystream} {\rm (p.\,\pageref{classost_1_1ttystream_4c27b39599ec7550606bd6e3cdcbb6d7})}.\index{ost::Serial@{ost::Serial}!endSerial@{endSerial}}
\index{endSerial@{endSerial}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::end\-Serial (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_f318b426ad5f606f86b2c39bee5889b4}


Used as the default destructor for ending serial I/O services. 

It will restore the port to it's original state. \index{ost::Serial@{ost::Serial}!error@{error}}
\index{error@{error}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::error (char $\ast$ {\em err})\hspace{0.3cm}{\tt  [inline, protected]}}\label{classost_1_1_serial_a27ac2ed46bf90a4bab62ecbc19febb6}


This service is used to thow application defined serial errors where the application specific error code is a string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em err}]string or message to pass. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!error@{error}}
\index{error@{error}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::error ({\bf Error} {\em error}, char $\ast$ {\em errstr} = {\tt NULL})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_2b2d756a0e1c789c4cb3c49e85f5a77b}


This service is used to throw all serial errors which usually occur during the serial constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em error}]defined serial error id. \item[{\em errstr}]string or message to optionally pass. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!flushInput@{flushInput}}
\index{flushInput@{flushInput}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::flush\-Input (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_1c5990d5a0f551835809a975a51fb985}


Used to flush the input waiting queue. 

\index{ost::Serial@{ost::Serial}!flushOutput@{flushOutput}}
\index{flushOutput@{flushOutput}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::flush\-Output (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_cda1f30842b905cb2d624332c58702be}


Used to flush any pending output data. 

\index{ost::Serial@{ost::Serial}!getBufferSize@{getBufferSize}}
\index{getBufferSize@{getBufferSize}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Serial::get\-Buffer\-Size (void)\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_serial_e6d478bbdac8593181fc64eb66106815}


Get the \char`\"{}buffer\char`\"{} size for buffered operations. 

This can be used when setting packet or line read modes to determine how many bytes to wait for in a given read call.

\begin{Desc}
\item[Returns:]number of bytes used for buffering. \end{Desc}
\index{ost::Serial@{ost::Serial}!getErrorNumber@{getErrorNumber}}
\index{getErrorNumber@{getErrorNumber}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::get\-Error\-Number (void)\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_serial_c8d9a9eedecf7dc42f53e8c852e9e6d3}


Often used by a \char`\"{}catch\char`\"{} to fetch the last error of a thrown serial. 

\begin{Desc}
\item[Returns:]error numbr of last Error. \end{Desc}
\index{ost::Serial@{ost::Serial}!getErrorString@{getErrorString}}
\index{getErrorString@{getErrorString}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ ost::Serial::get\-Error\-String (void)\hspace{0.3cm}{\tt  [inline]}}\label{classost_1_1_serial_0d67fb60e34c7a725f4494adaa11c0c9}


Often used by a \char`\"{}catch\char`\"{} to fetch the user set error string of a thrown serial. 

\begin{Desc}
\item[Returns:]string for error message. \end{Desc}
\index{ost::Serial@{ost::Serial}!initConfig@{initConfig}}
\index{initConfig@{initConfig}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::init\-Config (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_64916fc49030cc114f4785ad4c33166d}


Used to initialize a newly opened serial file handle. 

You should set serial properties and DTR manually before first use. \index{ost::Serial@{ost::Serial}!isPending@{isPending}}
\index{isPending@{isPending}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool ost::Serial::is\-Pending ({\bf Pending} {\em pend}, {\bf timeout\_\-t} {\em timeout} = {\tt TIMEOUT\_\-INF})\hspace{0.3cm}{\tt  [virtual]}}\label{classost_1_1_serial_80501f19b1e225c87f2de484b220f737}


Get the status of pending operations. 

This can be used to examine if input or output is waiting, or if an error has occured on the serial device.

\begin{Desc}
\item[Returns:]true if ready, false if timeout. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pend}]ready check to perform. \item[{\em timeout}]in milliseconds. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!open@{open}}
\index{open@{open}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::open (const char $\ast$ {\em fname})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_ab0033a3ce6c142a4882f05187ff2749}


Opens the serial device. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fname}]Pathname of device to open \end{description}
\end{Desc}


Reimplemented in {\bf ost::ttystream} {\rm (p.\,\pageref{classost_1_1ttystream_9cd5bb27aace9c143b78af37330179e8})}.\index{ost::Serial@{ost::Serial}!operator=@{operator=}}
\index{operator=@{operator=}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Serial}\& ost::Serial::operator= (const {\bf Serial} \& {\em from})}\label{classost_1_1_serial_1afd56643caecf083babbffc5ed13b97}


{\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} ports may also be duplecated by the assignment operator. 

\index{ost::Serial@{ost::Serial}!restore@{restore}}
\index{restore@{restore}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::restore (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_024e1b908a4e77f392292a8fe5bb6236}


Restore serial device to the original settings at time of open. 

\index{ost::Serial@{ost::Serial}!sendBreak@{sendBreak}}
\index{sendBreak@{sendBreak}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::send\-Break (void)}\label{classost_1_1_serial_e33c36f64a9debb8ac54712c31313938}


Send the \char`\"{}break\char`\"{} signal. 

\index{ost::Serial@{ost::Serial}!setCharBits@{setCharBits}}
\index{setCharBits@{setCharBits}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::set\-Char\-Bits (int {\em bits})}\label{classost_1_1_serial_e1c79b3d42f3b21700f270c0300377ea}


Set character size. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bits}]character size to use (usually 7 or 8). \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!setError@{setError}}
\index{setError@{setError}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::set\-Error (bool {\em enable})\hspace{0.3cm}{\tt  [inline, protected]}}\label{classost_1_1_serial_1d6cbc8147a6f77c01f3b2b7cb5a39d1}


This method is used to turn the error handler on or off for \char`\"{}throwing\char`\"{} execptions by manipulating the thrown flag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]true to enable handler. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!setFlowControl@{setFlowControl}}
\index{setFlowControl@{setFlowControl}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::set\-Flow\-Control ({\bf Flow} {\em flow})}\label{classost_1_1_serial_5ce3b5a9498490a1cc753fb69f114c75}


Set flow control. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em flow}]control mode. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!setLineInput@{setLineInput}}
\index{setLineInput@{setLineInput}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Serial::set\-Line\-Input (char {\em newline} = {\tt 13}, char {\em nl1} = {\tt 0})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_8d239a3a6ab2cb7253e3eb3fe0618bd3}


Set \char`\"{}line buffering\char`\"{} read mode and specifies the newline character to be used in seperating line records. 

is\-Pending can then be used to wait for an entire line of input.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em newline}]newline character. \item[{\em nl1}]EOL2 control character. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]size of conical input buffer. \end{Desc}
\index{ost::Serial@{ost::Serial}!setPacketInput@{setPacketInput}}
\index{setPacketInput@{setPacketInput}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Serial::set\-Packet\-Input (int {\em size}, unsigned char {\em btimer} = {\tt 0})\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_fb14afa31f6d737cabc0c336198c3d88}


Set packet read mode and \char`\"{}size\char`\"{} of packet read buffer. 

This sets VMIN to x. VTIM is normally set to \char`\"{}0\char`\"{} so that \char`\"{}is\-Pending()\char`\"{} can wait for an entire packet rather than just the first byte.

\begin{Desc}
\item[Returns:]actual buffer size set. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em size}]of packet read request. \item[{\em btimer}]optional inter-byte data packet timeout. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!setParity@{setParity}}
\index{setParity@{setParity}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::set\-Parity ({\bf Parity} {\em parity})}\label{classost_1_1_serial_5aca9ba379188e65978eb04d298985ab}


Set parity mode. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em parity}]mode. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!setSpeed@{setSpeed}}
\index{setSpeed@{setSpeed}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::set\-Speed (unsigned long {\em speed})}\label{classost_1_1_serial_c7f91aed2cc1f843d8ece7200fe55df4}


Set serial port speed for both input and output. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em speed}]to select. 0 signifies modem \char`\"{}hang up\char`\"{}. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!setStopBits@{setStopBits}}
\index{setStopBits@{setStopBits}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Error} ost::Serial::set\-Stop\-Bits (int {\em bits})}\label{classost_1_1_serial_eea4eb6923c07efe9c4be85f826c452e}


Set number of stop bits. 

\begin{Desc}
\item[Returns:]0 on success. \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bits}]stop bits. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!toggleDTR@{toggleDTR}}
\index{toggleDTR@{toggleDTR}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::toggle\-DTR ({\bf timeout\_\-t} {\em millisec})}\label{classost_1_1_serial_420bf5d2edc4bf8bce52149afd7b0bfb}


Set the DTR mode off momentarily. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em millisec}]number of milliseconds. \end{description}
\end{Desc}
\index{ost::Serial@{ost::Serial}!waitOutput@{waitOutput}}
\index{waitOutput@{waitOutput}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial::wait\-Output (void)\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_d70726a0a7513c758036ade5241a8ddd}


Used to wait until all output has been sent. 



\subsection{Member Data Documentation}
\index{ost::Serial@{ost::Serial}!bufsize@{bufsize}}
\index{bufsize@{bufsize}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int {\bf ost::Serial::bufsize}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_6b974da21c9bdaf38d745c7cb533bd4c}


\index{ost::Serial@{ost::Serial}!dev@{dev}}
\index{dev@{dev}!ost::Serial@{ost::Serial}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf HANDLE} {\bf ost::Serial::dev}\hspace{0.3cm}{\tt  [protected]}}\label{classost_1_1_serial_0f2dc5d07e275ab632df9630d4d7ad45}




The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
{\bf serial.h}\end{CompactItemize}