ApparatusFramework::SerialPortIf Class Reference
[Device Services]

#include <DeviceServices/Win32/current/include/SerialPortIf.h>

Inheritance diagram for ApparatusFramework::SerialPortIf:
ApparatusFramework::SerialPort

List of all members.

Public Member Functions

virtual uint32 openPort (int portNr, uint32 baudRate, uint8 byteSize, uint8 parity, uint8 stopBits)=0
virtual uint32 closePort ()=0
virtual uint32 writeByte (uint8 aByte, bool isBlocking=false, uint32 timeout=SP_INFINITE)=0
virtual uint32 writeByteStream (uint8 *pBuffer, uint16 length, bool isBlocking=false, uint32 timeout=SP_INFINITE)=0
virtual uint32 readByte (uint8 &aByte, bool isBlocking=false, uint32 timeout=SP_INFINITE)=0
virtual uint32 readByteStream (uint8 *pBuffer, uint16 &length, bool isBlocking=false, uint32 timeout=SP_INFINITE)=0
virtual void flush ()=0

Detailed Description

SerialPortIf is an interface (abstract base class) for serial port classes. There is at least an implementation for the Win32 serial communication mechanism. This allows the developer to implement a platform specific implementation based on this interface, which then can be exchanged easily with the Win32 version for debugging. Because this header file is a reduced version of the Win32 header file it might be necessary to adapt it to the needs of a specific platform. Be aware that you have to change all implementations or inform their authors if you change this interface.

Definition at line 136 of file SerialPortIf.h.


Member Function Documentation

virtual uint32 ApparatusFramework::SerialPortIf::closePort (  )  [pure virtual]

Closes the serial port.

Returns:
Returns one of the SERIAL_PORT_... result values.

Implemented in ApparatusFramework::SerialPort.

virtual void ApparatusFramework::SerialPortIf::flush (  )  [pure virtual]

Miscellaneous This function does only flush the input and the output buffer of the SerialPort class but not the hardware buffer of the serial port itself.

Implemented in ApparatusFramework::SerialPort.

virtual uint32 ApparatusFramework::SerialPortIf::openPort ( int  portNr,
uint32  baudRate,
uint8  byteSize,
uint8  parity,
uint8  stopBits 
) [pure virtual]

Open and close ports The implementation of this abstract method attempts to open a serial port.

Parameters:
portNr Number of the port which should be opened.
baudRate Specifies the baud rate at which the serial port operates. Use the predefined values from the header file SerialPortIf.h.
byteSize Number of bits in the bytes transmitted and received
parity Specifies the parity scheme. Use the predefined values from the header file SerialPortIf.h.
stopBits Specifies the number of stop bits. Use the predefined values from the header file SerialPortIf.h.
Returns:
The implementation should return one of the SERIAL_PORT_... result values.

Implemented in ApparatusFramework::SerialPort.

virtual uint32 ApparatusFramework::SerialPortIf::readByte ( uint8 aByte,
bool  isBlocking = false,
uint32  timeout = SP_INFINITE 
) [pure virtual]

Read operations Reads a single byte from the serial port. The non-blocking read fails if there is not enough data in the input buffer. The blocking read fails if the given timeout expires.

Parameters:
aByte One byte of data which is has been read from the serial port.
isBlocking TRUE if blocking read, FALSE if non-blocking
timeout A blocking read operation uses this timeout, so that the caller of this method cannot be blocked forever.
Returns:
The implementation should return one of the SERIAL_PORT_... result values.

Implemented in ApparatusFramework::SerialPort.

virtual uint32 ApparatusFramework::SerialPortIf::readByteStream ( uint8 pBuffer,
uint16 length,
bool  isBlocking = false,
uint32  timeout = SP_INFINITE 
) [pure virtual]

Reads a byte stream from the serial port. The non-blocking read fails if there is not enough data in the input buffer. The blocking read fails if the given timeout expires.

Parameters:
pBuffer Start address of the buffer to which the data from the serial port has to be written.
length Number of bytes to be read from the serial port.
isBlocking TRUE if blocking read, FALSE if non-blocking
timeout A blocking read operation uses this timeout, so that the caller of this method cannot be blocked forever.
Returns:
The implementation should return one of the SERIAL_PORT_... result values.

Implemented in ApparatusFramework::SerialPort.

virtual uint32 ApparatusFramework::SerialPortIf::writeByte ( uint8  aByte,
bool  isBlocking = false,
uint32  timeout = SP_INFINITE 
) [pure virtual]

Write operations Writes a single byte to the serial port.

Parameters:
aByte One byte of data which has to be written to the serial port.
isBlocking TRUE if blocking write, FALSE if non-blocking
timeout A blocking write operation uses this timeout, so that the caller of this method cannot be blocked forever.
Returns:
The implementation should return one of the SERIAL_PORT_... result values.

Implemented in ApparatusFramework::SerialPort.

virtual uint32 ApparatusFramework::SerialPortIf::writeByteStream ( uint8 pBuffer,
uint16  length,
bool  isBlocking = false,
uint32  timeout = SP_INFINITE 
) [pure virtual]

Writes a certain number of bytes to the serial port. The method fails if there is not enough space in the output buffer.

Parameters:
pBuffer Start address of the buffer from which the data has to be written to the serial port.
length Number of bytes to be written to the serial port.
isBlocking TRUE if blocking write, FALSE if non-blocking
timeout A blocking write operation uses this timeout, so that the caller of this method cannot be blocked forever.
Returns:
The implementation should return one of the SERIAL_PORT_... result values.

Implemented in ApparatusFramework::SerialPort.

© 2004-2010 bbv Software Services AG / Apparatus Services