SerialPortInterface Class Reference

Serial port interface class. More...

#include <SerialPort.h>

Inheritance diagram for SerialPortInterface:
BluetoothSPPConnection SerialPort BarcodeReader LMXBluetoothPort ModemPort

List of all members.

Public Member Functions

virtual bool reOpen ()=0
 Reopen serial port Serial port implementation should override this function to implement port reopening method. It should be used to initialize the port to its last settings.
virtual bool isPortOpen ()=0
 Query port status Serial port implementation should override this function to implement port query method. This method can be used to check if the port is opened or not since serial port can be closed by the system using the HUP command.
virtual ssize_t readData (void *pData, size_t maxLen)=0
 Read data from serial port Serial port implementation should override this function to implement the data reading method to receive specified number of bytes from the serial port.
virtual ssize_t writeData (const void *pData, size_t dataLen)=0
 Write data to serial port Serial port implementation should override this function to implement the method for writing data to serial port.
virtual size_t numInputPending (int timeOut)=0
 Get number of pending bytes Serial port implementation should override this function to implement method for detecting the number of bytes currently pending in the receive buffer.
virtual bool isInputPending (int timeOut)=0
 Check if there is input data Serial port implementation should override this function to implement method for detecting if there is input data waiting in the receive buffer.
virtual void flushInput ()=0
 Flush serial port input Serial port implementation should override this function to implement method for discarding all serial port input currently pending for receiving.
virtual void flushOutput ()=0
 Flush serial port output Serial port implementation should override this function to implement method for discarding all serial port output currently pending for transmit.
virtual void drainOutput ()=0
 Drain serial port output Serial port implementation should override this function to implement method for waiting until all output data written to the serial port has been transmitted.

Detailed Description

Serial port interface class.

Serial port interface class describes a common interface for physical and Bluetooth serial ports.


Member Function Documentation

virtual bool SerialPortInterface::isInputPending ( int  timeOut  )  [pure virtual]

Check if there is input data Serial port implementation should override this function to implement method for detecting if there is input data waiting in the receive buffer.

The method should block if there is no data currently pending for receive until the timeout expires or data arrives. If there are bytes pending in the receive buffer already, the function should return immediately.

Parameters:
timeOut Specifies the timeout in milliseconds.
Returns:
Returns true if there is data pending for reading.

Implemented in BluetoothSPPConnection, and SerialPort.

virtual bool SerialPortInterface::isPortOpen (  )  [pure virtual]

Query port status Serial port implementation should override this function to implement port query method. This method can be used to check if the port is opened or not since serial port can be closed by the system using the HUP command.

Returns:
Returns true if the port is opened.

Implemented in BluetoothSPPConnection, and SerialPort.

virtual size_t SerialPortInterface::numInputPending ( int  timeOut  )  [pure virtual]

Get number of pending bytes Serial port implementation should override this function to implement method for detecting the number of bytes currently pending in the receive buffer.

The method should block until timeout expires or the data arrives to serial port. If there are bytes pending in the receive buffer already, the function should return immediately.

Parameters:
timeOut Specifies timeout in milliseconds.
Returns:
Returns the number of bytes pending for read or 0 if no bytes are pending.

Implemented in BluetoothSPPConnection, and SerialPort.

virtual ssize_t SerialPortInterface::readData ( void *  pData,
size_t  maxLen 
) [pure virtual]

Read data from serial port Serial port implementation should override this function to implement the data reading method to receive specified number of bytes from the serial port.

Parameters:
pData Points to the data bu7ffer.
maxLen Specifies the number of bytes to be read.
Returns:
Returns number of bytes actually received from serial port or -1 on error.

Implemented in BluetoothSPPConnection, and SerialPort.

virtual bool SerialPortInterface::reOpen (  )  [pure virtual]

Reopen serial port Serial port implementation should override this function to implement port reopening method. It should be used to initialize the port to its last settings.

Returns:
Return true, if the port was reopened successfully.

Implemented in BluetoothSPPConnection, and SerialPort.

virtual ssize_t SerialPortInterface::writeData ( const void *  pData,
size_t  dataLen 
) [pure virtual]

Write data to serial port Serial port implementation should override this function to implement the method for writing data to serial port.

Parameters:
pData Points to the data buffer.
dataLen Specifies the number of bytes to write
Returns:
Returns the number of bytes actually written to the serial port.

Implemented in BluetoothSPPConnection, and SerialPort.


The documentation for this class was generated from the following file:
Generated on Wed Oct 20 11:13:45 2010 for libspatha by  doxygen 1.6.3