ApparatusFramework::SerialPortListener Class Reference
[Device Services]

#include <DeviceServices/common/current/include/SerialPortListener.h>

List of all members.

Public Member Functions

 SerialPortListener ()
virtual ~SerialPortListener ()
virtual void commEventReceived (DWORD commEvent)
virtual void commErrorReceived (DWORD errorMask, COMSTAT status)
virtual void byteReceived ()
virtual void writeFinished ()
virtual void commThreadErrorOccurred (DWORD errorCode, DWORD errorInfo)

Detailed Description

Every instance of a SerialPort class has an associated instance of a this listener class. Because the communication thread of SerialPort is independent from the application thread, it is necessary to inform the application in another way than with return values and out parameters. The listener is a class derived from this base class, which implements its the empty methods. Because the communication thread gets reference to the listener, it can use the methods to do a callback. IMPORTANT: The listener methods are not meant to implement a complete reaction on the communication and error events. It should just be used to decouple the handling of the events from the SerialPort class (e.g. The implementation dispatches a corresponding message). The handling of the serial port is interrupted as long as a listener method is processed. IMPORTANT: Do not try to call SerialPort methods in the listener methods. The behavior would be unpredictable. Most certainly you would end in a deadlock. Instead inform your application and let it do the job.

Definition at line 81 of file SerialPortListener.h.


Constructor & Destructor Documentation

ApparatusFramework::SerialPortListener::SerialPortListener (  )  [inline]

constructors, destructors

Definition at line 84 of file SerialPortListener.h.

virtual ApparatusFramework::SerialPortListener::~SerialPortListener (  )  [inline, virtual]

Definition at line 85 of file SerialPortListener.h.


Member Function Documentation

virtual void ApparatusFramework::SerialPortListener::byteReceived (  )  [inline, virtual]

Indicates that the one byte has been moved from the serial port input buffer to the input buffer of the SeriaPort class.

Definition at line 107 of file SerialPortListener.h.

virtual void ApparatusFramework::SerialPortListener::commErrorReceived ( DWORD  errorMask,
COMSTAT  status 
) [inline, virtual]

Each time the Win32 serial communication signals a serial port error, the listener is notified with this method.

Parameters:
errorMask Bit mask which identifies the errro. Check MSDN for more information (key word: serial communication)
status The status of the serial port at the time of the error. Check MSDN for more information (key word: serial communication)

Definition at line 102 of file SerialPortListener.h.

References BBV_UNUSED_ARG.

virtual void ApparatusFramework::SerialPortListener::commEventReceived ( DWORD  commEvent  )  [inline, virtual]

Listener methods Each time the Win32 serial communication signals a communication event, the listener is notified with this method.

Parameters:
commEvent The communication event. Check MSDN for more information (key word: serial communication)

Definition at line 93 of file SerialPortListener.h.

References BBV_UNUSED_ARG.

virtual void ApparatusFramework::SerialPortListener::commThreadErrorOccurred ( DWORD  errorCode,
DWORD  errorInfo 
) [inline, virtual]

Indicates that during the work of the communication thread an error has occurred.

Parameters:
errorCode One of the SERIAL_PORT_... error codes.
errorInfo More information about the error. At the moment you have to look up the corresponding location in the code, to find the meaning of this value. Sorry.

Definition at line 119 of file SerialPortListener.h.

References BBV_UNUSED_ARG.

virtual void ApparatusFramework::SerialPortListener::writeFinished (  )  [inline, virtual]

Indicates that a write operation (one byte or stream) has been finished.

Definition at line 111 of file SerialPortListener.h.

© 2004-2010 bbv Software Services AG / Apparatus Services