Google

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SerialPort Class Reference

The serial port is an internal class which is attached to and then serviced by a specified SerialService thread. base class for thread pool serviced serial I/O. More...

#include <serial.h>

Inheritance diagram for SerialPort:

Serial TimerPort List of all members.

Public Methods

void setTimer (timeout_t timeout = 0)
 Derived setTimer to notify the service thread pool of changes in expected timeout. More...

void incTimer (timeout_t timeout)
 Derived incTimer to notify the service thread pool of a change in expected timeout. More...


Protected Methods

 SerialPort (SerialService *svc, const char *name)
 Construct a tty serial port for a named serial device. More...

virtual ~SerialPort ()
 Disconnect the Serial Port from the service pool thread and shutdown the port.

void setDetectPending ( bool )
 Used to indicate if the service thread should monitor pending data for us.

bool getDetectPending ( void ) const
 Get the current state of the DetectPending flag.

void setDetectOutput ( bool )
 Used to indicate if output ready monitoring should be performed by the service thread.

bool getDetectOutput ( void ) const
 Get the current state of the DetectOutput flag.

virtual void Expired (void)
 Called by the service thread when the objects timer has expired.

virtual void Pending (void)
 Called by the service thread when input data is pending for this tty port. More...

virtual void Disconnect (void)
 Called by the service thread when an exception has occured such as a hangup.

int Output (void *buf, int len)
 Transmit "send" data to the serial port. More...

virtual void Output (void)
 Perform when output is available for sending data.

int Input (void *buf, int len)
 Receive "input" for pending data from the serial port. More...


Friends

class  SerialService

Detailed Description

The serial port is an internal class which is attached to and then serviced by a specified SerialService 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 "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.

Author(s):
David Sugar <dyfet@ostel.com>


Constructor & Destructor Documentation

SerialPort::SerialPort ( SerialService * svc,
const char * name ) [protected]
 

Construct a tty serial port for a named serial device.

Parameters:
svc   pool thread object.
name   of tty port.

SerialPort::~SerialPort ( ) [protected, virtual]
 

Disconnect the Serial Port from the service pool thread and shutdown the port.


Member Function Documentation

void SerialPort::Disconnect ( void ) [inline, protected, virtual]
 

Called by the service thread when an exception has occured such as a hangup.

void SerialPort::Expired ( void ) [inline, protected, virtual]
 

Called by the service thread when the objects timer has expired.

int SerialPort::Input ( void * buf,
int len ) [inline, protected]
 

Receive "input" 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.

Returns:
number of bytes received.
Parameters:
address   of buffer to input.
len   of input buffer used.

void SerialPort::Output ( void ) [inline, protected, virtual]
 

Perform when output is available for sending data.

int SerialPort::Output ( void * buf,
int len ) [inline, protected]
 

Transmit "send" 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.

Returns:
number of bytes send.
Parameters:
address   of buffer to send.
len   of bytes to send.

void SerialPort::Pending ( void ) [inline, protected, virtual]
 

Called by the service thread when input data is pending for this tty port.

Effected by setPacketInput and by setLineInput.

bool SerialPort::getDetectOutput ( void ) const [inline, protected]
 

Get the current state of the DetectOutput flag.

bool SerialPort::getDetectPending ( void ) const [inline, protected]
 

Get the current state of the DetectPending flag.

void SerialPort::incTimer ( timeout_t timeout )
 

Derived incTimer to notify the service thread pool of a change in expected timeout.

This allows SerialService to reschedule all timers.

Reimplemented from TimerPort.

void SerialPort::setDetectOutput ( bool ) [protected]
 

Used to indicate if output ready monitoring should be performed by the service thread.

void SerialPort::setDetectPending ( bool ) [protected]
 

Used to indicate if the service thread should monitor pending data for us.

void SerialPort::setTimer ( timeout_t timeout = 0 )
 

Derived setTimer to notify the service thread pool of changes in expected timeout.

This allows SerialService to reschedule all timers.

Parameters:
timeout   in milliseconds.

Reimplemented from TimerPort.


Friends And Related Function Documentation

class SerialService [friend]
 


The documentation for this class was generated from the following file:
Generated at Fri Mar 23 10:47:56 2001 for CommonC++ by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000