<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ost::SerialPort class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Generated by Doxygen 1.2.10 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center> <hr><h1>ost::SerialPort Class Reference</h1>The serial port is an internal class which is attached to and then serviced by a specified <a class="el" href="classost_1_1_serial_service.html">SerialService</a> thread. base class for thread pool serviced serial I/O. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="serial_8h-source.html">serial.h</a>></code> <p> <p>Inheritance diagram for ost::SerialPort:: <p><center><img src="classost_1_1_serial_port.gif" usemap="#ost::SerialPort_map" border="0"></center> <map name="ost::SerialPort_map"> <area href="classost_1_1_serial.html" alt="ost::Serial" shape="rect" coords="0,0,90,24"> <area href="classost_1_1_timer_port.html" alt="ost::TimerPort" shape="rect" coords="100,0,190,24"> </map> <a href="classost_1_1_serial_port-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td colspan=2><br><h2>Public Methods</h2></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#a0">setTimer</a> (<a class="el" href="thread_8h.html#a11">timeout_t</a> timeout=0)</td></tr> <tr><td> </td><td><font size=-1><em>Derived setTimer to notify the service thread pool of changes in expected timeout.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#a1">incTimer</a> (<a class="el" href="thread_8h.html#a11">timeout_t</a> timeout)</td></tr> <tr><td> </td><td><font size=-1><em>Derived incTimer to notify the service thread pool of a change in expected timeout.</em> <a href="#a1">More...</a><em></em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Protected Methods</h2></td></tr> <tr><td nowrap align=right valign=top> </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b0">SerialPort</a> (<a class="el" href="classost_1_1_serial_service.html">SerialService</a> *svc, const char *name)</td></tr> <tr><td> </td><td><font size=-1><em>Construct a tty serial port for a named serial device.</em> <a href="#b0">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b1">~SerialPort</a> ()</td></tr> <tr><td> </td><td><font size=-1><em>Disconnect the <a class="el" href="classost_1_1_serial.html">Serial</a> Port from the service pool thread and shutdown the port.</em> <a href="#b1">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b2">setDetectPending</a> (bool)</td></tr> <tr><td> </td><td><font size=-1><em>Used to indicate if the service thread should monitor pending data for us.</em> <a href="#b2">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b3">getDetectPending</a> (void) const</td></tr> <tr><td> </td><td><font size=-1><em>Get the current state of the DetectPending flag.</em> <a href="#b3">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b4">setDetectOutput</a> (bool)</td></tr> <tr><td> </td><td><font size=-1><em>Used to indicate if output ready monitoring should be performed by the service thread.</em> <a href="#b4">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>bool </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b5">getDetectOutput</a> (void) const</td></tr> <tr><td> </td><td><font size=-1><em>Get the current state of the DetectOutput flag.</em> <a href="#b5">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b6">Expired</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Called by the service thread when the objects timer has expired.</em> <a href="#b6">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b7">Pending</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Called by the service thread when input data is pending for this tty port.</em> <a href="#b7">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b8">Disconnect</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Called by the service thread when an exception has occured such as a hangup.</em> <a href="#b8">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b9">Output</a> (void *buf, int len)</td></tr> <tr><td> </td><td><font size=-1><em>Transmit "send" data to the serial port.</em> <a href="#b9">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>virtual void </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b10">Output</a> (void)</td></tr> <tr><td> </td><td><font size=-1><em>Perform when output is available for sending data.</em> <a href="#b10">More...</a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#b11">Input</a> (void *buf, int len)</td></tr> <tr><td> </td><td><font size=-1><em>Receive "input" for pending data from the serial port.</em> <a href="#b11">More...</a><em></em></font><br><br></td></tr> <tr><td colspan=2><br><h2>Friends</h2></td></tr> <tr><td nowrap align=right valign=top>class </td><td valign=bottom><a class="el" href="classost_1_1_serial_port.html#l0">SerialService</a></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> The serial port is an internal class which is attached to and then serviced by a specified <a class="el" href="classost_1_1_serial_service.html">SerialService</a> thread. base class for thread pool serviced serial I/O. <p> Derived versions of this class offer specific functionality such as serial integration protocols. <p> 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 "callback" event management, whereby the service thread performs a "callback" 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 "sighup" connection breaks. <p> <dl compact><dt><b> Author: </b><dd> David Sugar <<a href="mailto:dyfet@ostel.com">dyfet@ostel.com</a>> </dl> <p> <hr><h2>Constructor & Destructor Documentation</h2> <a name="b0" doxytag="ost::SerialPort::SerialPort"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> ost::SerialPort::SerialPort </td> <td class="md">( </td> <td class="md"><a class="el" href="classost_1_1_serial_service.html">SerialService</a> *</td> <td class="mdname"> <em>svc</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">const char *</td> <td class="mdname"> <em>name</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Construct a tty serial port for a named serial device. <p> <dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>svc </em> </td><td> pool thread object. </td></tr> <tr><td valign=top><em>name </em> </td><td> of tty port. </td></tr> </table> </dl> </td> </tr> </table> <a name="b1" doxytag="ost::SerialPort::~SerialPort"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual ost::SerialPort::~SerialPort </td> <td class="md">( </td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [protected, virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Disconnect the <a class="el" href="classost_1_1_serial.html">Serial</a> Port from the service pool thread and shutdown the port. <p> </td> </tr> </table> <hr><h2>Member Function Documentation</h2> <a name="b8" doxytag="ost::SerialPort::Disconnect"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual void ost::SerialPort::Disconnect </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [inline, protected, virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Called by the service thread when an exception has occured such as a hangup. <p> </td> </tr> </table> <a name="b6" doxytag="ost::SerialPort::Expired"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual void ost::SerialPort::Expired </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [inline, protected, virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Called by the service thread when the objects timer has expired. <p> </td> </tr> </table> <a name="b11" doxytag="ost::SerialPort::Input"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int ost::SerialPort::Input </td> <td class="md">( </td> <td class="md">void *</td> <td class="mdname"> <em>buf</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">int</td> <td class="mdname"> <em>len</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline, protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Receive "input" for pending data from the serial port. <p> This is not a public member since it's meant to support internal protocols rather than direct external access to the device. <p> <dl compact><dt><b> Returns: </b><dd> number of bytes received. </dl><dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>address </em> </td><td> of buffer to input. </td></tr> <tr><td valign=top><em>len </em> </td><td> of input buffer used. </td></tr> </table> </dl> </td> </tr> </table> <a name="b10" doxytag="ost::SerialPort::Output"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual void ost::SerialPort::Output </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [inline, protected, virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Perform when output is available for sending data. <p> </td> </tr> </table> <a name="b9" doxytag="ost::SerialPort::Output"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int ost::SerialPort::Output </td> <td class="md">( </td> <td class="md">void *</td> <td class="mdname"> <em>buf</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md">int</td> <td class="mdname"> <em>len</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"><code> [inline, protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Transmit "send" data to the serial port. <p> This is not public since it's meant to support internal protocols rather than direct public access to the device. <p> <dl compact><dt><b> Returns: </b><dd> number of bytes send. </dl><dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>address </em> </td><td> of buffer to send. </td></tr> <tr><td valign=top><em>len </em> </td><td> of bytes to send. </td></tr> </table> </dl> </td> </tr> </table> <a name="b7" doxytag="ost::SerialPort::Pending"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> virtual void ost::SerialPort::Pending </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [inline, protected, virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Called by the service thread when input data is pending for this tty port. <p> Effected by setPacketInput and by setLineInput. </td> </tr> </table> <a name="b5" doxytag="ost::SerialPort::getDetectOutput"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool ost::SerialPort::getDetectOutput </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"> const<code> [inline, protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Get the current state of the DetectOutput flag. <p> </td> </tr> </table> <a name="b3" doxytag="ost::SerialPort::getDetectPending"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> bool ost::SerialPort::getDetectPending </td> <td class="md">( </td> <td class="md">void</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"> const<code> [inline, protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Get the current state of the DetectPending flag. <p> </td> </tr> </table> <a name="a1" doxytag="ost::SerialPort::incTimer"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void ost::SerialPort::incTimer </td> <td class="md">( </td> <td class="md"><a class="el" href="thread_8h.html#a11">timeout_t</a></td> <td class="mdname1"> <em>timeout</em> </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Derived incTimer to notify the service thread pool of a change in expected timeout. <p> This allows <a class="el" href="classost_1_1_serial_service.html">SerialService</a> to reschedule all timers. <p> Reimplemented from <a class="el" href="classost_1_1_timer_port.html#a2">ost::TimerPort</a>. </td> </tr> </table> <a name="b4" doxytag="ost::SerialPort::setDetectOutput"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void ost::SerialPort::setDetectOutput </td> <td class="md">( </td> <td class="md">bool</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Used to indicate if output ready monitoring should be performed by the service thread. <p> </td> </tr> </table> <a name="b2" doxytag="ost::SerialPort::setDetectPending"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void ost::SerialPort::setDetectPending </td> <td class="md">( </td> <td class="md">bool</td> <td class="mdname1"> </td> <td class="md">) </td> <td class="md"><code> [protected]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Used to indicate if the service thread should monitor pending data for us. <p> </td> </tr> </table> <a name="a0" doxytag="ost::SerialPort::setTimer"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void ost::SerialPort::setTimer </td> <td class="md">( </td> <td class="md"><a class="el" href="thread_8h.html#a11">timeout_t</a></td> <td class="mdname1"> <em>timeout</em> = 0 </td> <td class="md">) </td> <td class="md"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Derived setTimer to notify the service thread pool of changes in expected timeout. <p> This allows <a class="el" href="classost_1_1_serial_service.html">SerialService</a> to reschedule all timers.<dl compact><dt><b> Parameters: </b><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>timeout </em> </td><td> in milliseconds. </td></tr> </table> </dl> <p> Reimplemented from <a class="el" href="classost_1_1_timer_port.html#a1">ost::TimerPort</a>. </td> </tr> </table> <hr><h2>Friends And Related Function Documentation</h2> <a name="l0" doxytag="ost::SerialPort::SerialService"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> friend class SerialService<code> [friend]</code> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> </td> </tr> </table> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="serial_8h-source.html">serial.h</a></ul> <hr><address><small>Generated at Fri Jan 4 18:51:50 2002 for CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.gif" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.10 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2001</small></address> </body> </html>