1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
.TH "SerialPort" 3 "19 Jul 2003" "CommonC++" \" -*- nroff -*-
.ad l
.nh
.SH NAME
SerialPort \- The serial port is an internal class which is attached to and then serviced by a specified \fBSerialService\fP thread. base class for thread pool serviced serial I/O.
.SH SYNOPSIS
.br
.PP
\fC#include <serial.h>\fP
.PP
Inherits \fBSerial\fP, and \fBTimerPort\fP.
.PP
.SS "Public Methods"
.in +1c
.ti -1c
.RI "void \fBsetTimer\fP (\fBtimeout_t\fP timeout=0)"
.br
.RI "\fIDerived setTimer to notify the service thread pool of changes in expected timeout.\fP"
.ti -1c
.RI "void \fBincTimer\fP (\fBtimeout_t\fP timeout)"
.br
.RI "\fIDerived incTimer to notify the service thread pool of a change in expected timeout.\fP"
.in -1c
.SS "Protected Methods"
.in +1c
.ti -1c
.RI "\fBSerialPort\fP (\fBSerialService\fP *svc, const char *name)"
.br
.RI "\fIConstruct a tty serial port for a named serial device.\fP"
.ti -1c
.RI "virtual \fB~SerialPort\fP ()"
.br
.RI "\fIDisconnect the \fBSerial\fP Port from the service pool thread and shutdown the port.\fP"
.ti -1c
.RI "void \fBsetDetectPending\fP (bool)"
.br
.RI "\fIUsed to indicate if the service thread should monitor pending data for us.\fP"
.ti -1c
.RI "bool \fBgetDetectPending\fP (void) const"
.br
.RI "\fIGet the current state of the DetectPending flag.\fP"
.ti -1c
.RI "void \fBsetDetectOutput\fP (bool)"
.br
.RI "\fIUsed to indicate if output ready monitoring should be performed by the service thread.\fP"
.ti -1c
.RI "bool \fBgetDetectOutput\fP (void) const"
.br
.RI "\fIGet the current state of the DetectOutput flag.\fP"
.ti -1c
.RI "virtual void \fBexpired\fP (void)"
.br
.RI "\fICalled by the service thread when the objects timer has expired.\fP"
.ti -1c
.RI "virtual void \fBpending\fP (void)"
.br
.RI "\fICalled by the service thread when input data is pending for this tty port.\fP"
.ti -1c
.RI "virtual void \fBdisconnect\fP (void)"
.br
.RI "\fICalled by the service thread when an exception has occured such as a hangup.\fP"
.ti -1c
.RI "int \fBoutput\fP (void *buf, int len)"
.br
.RI "\fITransmit 'send' data to the serial port.\fP"
.ti -1c
.RI "virtual void \fBoutput\fP (void)"
.br
.RI "\fIPerform when output is available for sending data.\fP"
.ti -1c
.RI "int \fBinput\fP (void *buf, int len)"
.br
.RI "\fIReceive 'input' for pending data from the serial port.\fP"
.in -1c
.SS "Friends"
.in +1c
.ti -1c
.RI "class \fBSerialService\fP"
.br
.in -1c
.SH "DETAILED DESCRIPTION"
.PP
The serial port is an internal class which is attached to and then serviced by a specified \fBSerialService\fP thread. base class for thread pool serviced serial I/O.
.PP
Derived versions of this class offer specific functionality such as serial integration protocols.
.PP
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.
.PP
\fBAuthor: \fP
.in +1c
David Sugar <dyfet@ostel.com>
.PP
.SH "CONSTRUCTOR & DESTRUCTOR DOCUMENTATION"
.PP
.SS "SerialPort::SerialPort (\fBSerialService\fP * svc, const char * name)\fC [protected]\fP"
.PP
Construct a tty serial port for a named serial device.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIsvc\fP\fP
pool thread object.
.TP
\fB\fIname\fP\fP
of tty port.
.SS "virtual SerialPort::~SerialPort ()\fC [protected, virtual]\fP"
.PP
Disconnect the \fBSerial\fP Port from the service pool thread and shutdown the port.
.PP
.SH "MEMBER FUNCTION DOCUMENTATION"
.PP
.SS "virtual void SerialPort::disconnect (void)\fC [inline, protected, virtual]\fP"
.PP
Called by the service thread when an exception has occured such as a hangup.
.PP
.SS "virtual void SerialPort::expired (void)\fC [inline, protected, virtual]\fP"
.PP
Called by the service thread when the objects timer has expired.
.PP
.SS "bool SerialPort::getDetectOutput (void) const\fC [inline, protected]\fP"
.PP
Get the current state of the DetectOutput flag.
.PP
.SS "bool SerialPort::getDetectPending (void) const\fC [inline, protected]\fP"
.PP
Get the current state of the DetectPending flag.
.PP
.SS "void SerialPort::incTimer (\fBtimeout_t\fP timeout)"
.PP
Derived incTimer to notify the service thread pool of a change in expected timeout.
.PP
This allows \fBSerialService\fP to reschedule all timers.
.PP
Reimplemented from \fBTimerPort\fP.
.SS "int SerialPort::input (void * buf, int len)\fC [inline, protected]\fP"
.PP
Receive 'input' for pending data from the serial port.
.PP
This is not a public member since it's meant to support internal protocols rather than direct external access to the device.
.PP
\fBReturns: \fP
.in +1c
number of bytes received.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIbuf\fP\fP
address of buffer to input.
.TP
\fB\fIlen\fP\fP
of input buffer used.
.SS "virtual void SerialPort::output (void)\fC [inline, protected, virtual]\fP"
.PP
Perform when output is available for sending data.
.PP
.SS "int SerialPort::output (void * buf, int len)\fC [inline, protected]\fP"
.PP
Transmit 'send' data to the serial port.
.PP
This is not public since it's meant to support internal protocols rather than direct public access to the device.
.PP
\fBReturns: \fP
.in +1c
number of bytes send.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fIbuf\fP\fP
address of buffer to send.
.TP
\fB\fIlen\fP\fP
of bytes to send.
.SS "virtual void SerialPort::pending (void)\fC [inline, protected, virtual]\fP"
.PP
Called by the service thread when input data is pending for this tty port.
.PP
Effected by setPacketInput and by setLineInput.
.SS "void SerialPort::setDetectOutput (bool)\fC [protected]\fP"
.PP
Used to indicate if output ready monitoring should be performed by the service thread.
.PP
.SS "void SerialPort::setDetectPending (bool)\fC [protected]\fP"
.PP
Used to indicate if the service thread should monitor pending data for us.
.PP
.SS "void SerialPort::setTimer (\fBtimeout_t\fP timeout = 0)"
.PP
Derived setTimer to notify the service thread pool of changes in expected timeout.
.PP
This allows \fBSerialService\fP to reschedule all timers.
.PP
\fBParameters: \fP
.in +1c
.TP
\fB\fItimeout\fP\fP
in milliseconds.
.PP
Reimplemented from \fBTimerPort\fP.
.SH "FRIENDS AND RELATED FUNCTION DOCUMENTATION"
.PP
.SS "friend class SerialService\fC [friend]\fP"
.PP
.SH "AUTHOR"
.PP
Generated automatically by Doxygen for CommonC++ from the source code.
|