\section{ost::Serial\-Port Class Reference} \label{classost_1_1_serial_port}\index{ost::SerialPort@{ost::SerialPort}} The serial port is an internal class which is attached to and then serviced by a specified {\bf Serial\-Service}{\rm (p.\,\pageref{classost_1_1_serial_service})} thread.base class for thread pool serviced serial I/O. {\tt \#include $<$serial.h$>$} Inheritance diagram for ost::Serial\-Port::\begin{figure}[H] \begin{center} \leavevmode \includegraphics[height=2cm]{classost_1_1_serial_port} \end{center} \end{figure} \subsection*{Public Member Functions} \begin{CompactItemize} \item void {\bf set\-Timer} ({\bf timeout\_\-t} timeout=0) \begin{CompactList}\small\item\em Derived set\-Timer to notify the service thread pool of changes in expected timeout. \item\end{CompactList}\item void {\bf inc\-Timer} ({\bf timeout\_\-t} timeout) \begin{CompactList}\small\item\em Derived inc\-Timer to notify the service thread pool of a change in expected timeout. \item\end{CompactList}\end{CompactItemize} \subsection*{Protected Member Functions} \begin{CompactItemize} \item {\bf Serial\-Port} ({\bf Serial\-Service} $\ast$svc, const char $\ast$name) \begin{CompactList}\small\item\em Construct a tty serial port for a named serial device. \item\end{CompactList}\item virtual {\bf $\sim$Serial\-Port} () \begin{CompactList}\small\item\em Disconnect the {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} Port from the service pool thread and shutdown the port. \item\end{CompactList}\item void {\bf set\-Detect\-Pending} (bool) \begin{CompactList}\small\item\em Used to indicate if the service thread should monitor pending data for us. \item\end{CompactList}\item bool {\bf get\-Detect\-Pending} (void) const \begin{CompactList}\small\item\em Get the current state of the Detect\-Pending flag. \item\end{CompactList}\item void {\bf set\-Detect\-Output} (bool) \begin{CompactList}\small\item\em Used to indicate if output ready monitoring should be performed by the service thread. \item\end{CompactList}\item bool {\bf get\-Detect\-Output} (void) const \begin{CompactList}\small\item\em Get the current state of the Detect\-Output flag. \item\end{CompactList}\item virtual void {\bf expired} (void) \begin{CompactList}\small\item\em Called by the service thread when the objects timer has expired. \item\end{CompactList}\item virtual void {\bf pending} (void) \begin{CompactList}\small\item\em Called by the service thread when input data is pending for this tty port. \item\end{CompactList}\item virtual void {\bf disconnect} (void) \begin{CompactList}\small\item\em Called by the service thread when an exception has occured such as a hangup. \item\end{CompactList}\item int {\bf output} (void $\ast$buf, int len) \begin{CompactList}\small\item\em Transmit \char`\"{}send\char`\"{} data to the serial port. \item\end{CompactList}\item virtual void {\bf output} (void) \begin{CompactList}\small\item\em Perform when output is available for sending data. \item\end{CompactList}\item int {\bf input} (void $\ast$buf, int len) \begin{CompactList}\small\item\em Receive \char`\"{}input\char`\"{} for pending data from the serial port. \item\end{CompactList}\end{CompactItemize} \subsection*{Friends} \begin{CompactItemize} \item class {\bf Serial\-Service} \end{CompactItemize} \subsection{Detailed Description} The serial port is an internal class which is attached to and then serviced by a specified {\bf Serial\-Service}{\rm (p.\,\pageref{classost_1_1_serial_service})} thread.base class for thread pool serviced serial I/O. Derived versions of this class offer specific functionality such as serial integration protocols. The TTYPort and TTYService classes are used to form thread-pool serviced serial I/O protocol sets. These can be used when one has a large number of serial devices to manage, and a single (or limited number of) thread(s) can then be used to service the tty port objects present. Each tty port supports a timer control and several virtual methods that the service thread can call when events occur. This model provides for \char`\"{}callback\char`\"{} event management, whereby the service thread performs a \char`\"{}callback\char`\"{} into the port object when events occur. Specific events supported include the expiration of a TTYPort timer, pending input data waiting to be read, and \char`\"{}sighup\char`\"{} connection breaks. \begin{Desc} \item[Author:]David Sugar $<${\tt dyfet@ostel.com}$>$ \end{Desc} \subsection{Constructor \& Destructor Documentation} \index{ost::SerialPort@{ost::Serial\-Port}!SerialPort@{SerialPort}} \index{SerialPort@{SerialPort}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}ost::Serial\-Port::Serial\-Port ({\bf Serial\-Service} $\ast$ {\em svc}, const char $\ast$ {\em name})\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_serial_port_8e281b17e996c4f5eb18bdbb9a0b3e4b} Construct a tty serial port for a named serial device. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em svc}]pool thread object. \item[{\em name}]of tty port. \end{description} \end{Desc} \index{ost::SerialPort@{ost::Serial\-Port}!~SerialPort@{$\sim$SerialPort}} \index{~SerialPort@{$\sim$SerialPort}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual ost::Serial\-Port::$\sim$Serial\-Port ()\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_serial_port_1c4a6f8cd51e17f153a0575c1036a8a5} Disconnect the {\bf Serial}{\rm (p.\,\pageref{classost_1_1_serial})} Port from the service pool thread and shutdown the port. \subsection{Member Function Documentation} \index{ost::SerialPort@{ost::Serial\-Port}!disconnect@{disconnect}} \index{disconnect@{disconnect}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Serial\-Port::disconnect (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_serial_port_c56f59989b9b11b094064e70eef6a681} Called by the service thread when an exception has occured such as a hangup. \index{ost::SerialPort@{ost::Serial\-Port}!expired@{expired}} \index{expired@{expired}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Serial\-Port::expired (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_serial_port_5a0f7222d19dc7f97ebbd7fd471f39ac} Called by the service thread when the objects timer has expired. \index{ost::SerialPort@{ost::Serial\-Port}!getDetectOutput@{getDetectOutput}} \index{getDetectOutput@{getDetectOutput}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Serial\-Port::get\-Detect\-Output (void) const\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_serial_port_eeb3b9dbdaaa73b0c2960d332f80207c} Get the current state of the Detect\-Output flag. \index{ost::SerialPort@{ost::Serial\-Port}!getDetectPending@{getDetectPending}} \index{getDetectPending@{getDetectPending}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool ost::Serial\-Port::get\-Detect\-Pending (void) const\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_serial_port_85cd2f84d0117820545694ff4e122912} Get the current state of the Detect\-Pending flag. \index{ost::SerialPort@{ost::Serial\-Port}!incTimer@{incTimer}} \index{incTimer@{incTimer}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial\-Port::inc\-Timer ({\bf timeout\_\-t} {\em timeout})}\label{classost_1_1_serial_port_4fa45b7494efbcd0c1b28a724f93b6b3} Derived inc\-Timer to notify the service thread pool of a change in expected timeout. This allows {\bf Serial\-Service}{\rm (p.\,\pageref{classost_1_1_serial_service})} to reschedule all timers. Reimplemented from {\bf ost::Timer\-Port} {\rm (p.\,\pageref{classost_1_1_timer_port_b2c732120c3bb09e8d38a87b7443906d})}.\index{ost::SerialPort@{ost::Serial\-Port}!input@{input}} \index{input@{input}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Serial\-Port::input (void $\ast$ {\em buf}, int {\em len})\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_serial_port_eb0db8bb689d4610e91ce81f68dfd590} Receive \char`\"{}input\char`\"{} for pending data from the serial port. This is not a public member since it's meant to support internal protocols rather than direct external access to the device. \begin{Desc} \item[Returns:]number of bytes received. \end{Desc} \begin{Desc} \item[Parameters:] \begin{description} \item[{\em buf}]address of buffer to input. \item[{\em len}]of input buffer used. \end{description} \end{Desc} \index{ost::SerialPort@{ost::Serial\-Port}!output@{output}} \index{output@{output}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Serial\-Port::output (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_serial_port_fc68b51175f68493f644af5f3a5d8985} Perform when output is available for sending data. \index{ost::SerialPort@{ost::Serial\-Port}!output@{output}} \index{output@{output}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}int ost::Serial\-Port::output (void $\ast$ {\em buf}, int {\em len})\hspace{0.3cm}{\tt [inline, protected]}}\label{classost_1_1_serial_port_2ace6514780e229ea0ac7dff9778583e} Transmit \char`\"{}send\char`\"{} data to the serial port. This is not public since it's meant to support internal protocols rather than direct public access to the device. \begin{Desc} \item[Returns:]number of bytes send. \end{Desc} \begin{Desc} \item[Parameters:] \begin{description} \item[{\em buf}]address of buffer to send. \item[{\em len}]of bytes to send. \end{description} \end{Desc} \index{ost::SerialPort@{ost::Serial\-Port}!pending@{pending}} \index{pending@{pending}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void ost::Serial\-Port::pending (void)\hspace{0.3cm}{\tt [protected, virtual]}}\label{classost_1_1_serial_port_47facdf73be726e440d39872130bf5b2} Called by the service thread when input data is pending for this tty port. Effected by set\-Packet\-Input and by set\-Line\-Input. \index{ost::SerialPort@{ost::Serial\-Port}!setDetectOutput@{setDetectOutput}} \index{setDetectOutput@{setDetectOutput}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial\-Port::set\-Detect\-Output (bool)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_serial_port_247a1b23aa9b819dadd3f671f5cbbdb9} Used to indicate if output ready monitoring should be performed by the service thread. \index{ost::SerialPort@{ost::Serial\-Port}!setDetectPending@{setDetectPending}} \index{setDetectPending@{setDetectPending}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial\-Port::set\-Detect\-Pending (bool)\hspace{0.3cm}{\tt [protected]}}\label{classost_1_1_serial_port_b12b5f15481bf49b32e76a740c61ae6c} Used to indicate if the service thread should monitor pending data for us. \index{ost::SerialPort@{ost::Serial\-Port}!setTimer@{setTimer}} \index{setTimer@{setTimer}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}void ost::Serial\-Port::set\-Timer ({\bf timeout\_\-t} {\em timeout} = {\tt 0})}\label{classost_1_1_serial_port_eb008981e1a1d2eff230b231c3ce5d9c} Derived set\-Timer to notify the service thread pool of changes in expected timeout. This allows {\bf Serial\-Service}{\rm (p.\,\pageref{classost_1_1_serial_service})} to reschedule all timers. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em timeout}]in milliseconds. \end{description} \end{Desc} Reimplemented from {\bf ost::Timer\-Port} {\rm (p.\,\pageref{classost_1_1_timer_port_32b59a072fe60d94251a53579b3ca17f})}. \subsection{Friends And Related Function Documentation} \index{ost::SerialPort@{ost::Serial\-Port}!SerialService@{SerialService}} \index{SerialService@{SerialService}!ost::SerialPort@{ost::Serial\-Port}} \subsubsection{\setlength{\rightskip}{0pt plus 5cm}friend class {\bf Serial\-Service}\hspace{0.3cm}{\tt [friend]}}\label{classost_1_1_serial_port_a8c4721865365c59db66755ea23bc4fb} The documentation for this class was generated from the following file:\begin{CompactItemize} \item {\bf serial.h}\end{CompactItemize}