Serial port interface class. More...
#include <SerialPort.h>
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. |
Serial port interface class.
Serial port interface class describes a common interface for physical and Bluetooth serial ports.
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.
timeOut | Specifies the timeout in milliseconds. |
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.
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.
timeOut | Specifies timeout in milliseconds. |
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.
pData | Points to the data bu7ffer. | |
maxLen | Specifies the number of bytes to be read. |
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.
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.
pData | Points to the data buffer. | |
dataLen | Specifies the number of bytes to write |
Implemented in BluetoothSPPConnection, and SerialPort.