Google

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

SerialService Class Reference

The SerialService is a thead service object that is meant to service attached serial ports. Thread pool service for serial ports. More...

#include <serial.h>

Inheritance diagram for SerialService:

Thread Mutex List of all members.

Public Methods

void Update (unsigned char flag = 0xff)
 Notify service thread that a port has been added or removed, or a timer changed, so that a new schedule can be computed for expiring attached ports. More...

 SerialService (int pri = 0)
 Create a service thread for attaching serial ports. More...

 ~SerialService ()
 Terminate the service thread and update attached objects.

int getCount (void)
 Get current reference count. More...


Protected Methods

virtual void OnUpdate (unsigned char flag)
 A virtual handler for processing user defined update requests (1-254) which have been posted through Update. More...

virtual void OnEvent (void)
 A virtual handler for event loop calls. More...

virtual void OnCallback (SerialPort *port)
 A virtual handler for adding support for additional callback events into SerialPort. More...


Friends

class  SerialPort

Detailed Description

The SerialService is a thead service object that is meant to service attached serial ports. Thread pool service for serial ports.

Multiple pool objects may be created and multiple serial ports may be attached to the same thread of of execution. This allows one to balance threads and the serial ports they service.

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

SerialService::SerialService ( int pri = 0 )
 

Create a service thread for attaching serial ports.

The thread begins execution with the first attached port.

Parameters:
pri   of this thread to run under.

SerialService::~SerialService ( )
 

Terminate the service thread and update attached objects.


Member Function Documentation

void SerialService::OnCallback ( SerialPort * port ) [inline, protected, virtual]
 

A virtual handler for adding support for additional callback events into SerialPort.

Parameters:
serial   port currently being evaluated.

void SerialService::OnEvent ( void ) [inline, protected, virtual]
 

A virtual handler for event loop calls.

This can be used to extend event loop processing.

void SerialService::OnUpdate ( unsigned char flag ) [inline, protected, virtual]
 

A virtual handler for processing user defined update requests (1-254) which have been posted through Update.

Parameters:
flag   of update request.

void SerialService::Update ( unsigned char flag = 0xff )
 

Notify service thread that a port has been added or removed, or a timer changed, so that a new schedule can be computed for expiring attached ports.

This can also be used to pass requests to the OnUpdate() event handler.

Parameters:
flag   event for OnUpdate, termination, or reschedule.

int SerialService::getCount ( void ) [inline]
 

Get current reference count.

This can be used when selecting the lead used service handler from a pool.

Returns:
count of active ports.


Friends And Related Function Documentation

class SerialPort [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