. 1.0.0
Открытые члены | Защищенные данные | Полный список членов класса
Класс QextSerialBaseabstract

QT serial port base class for Posix_QextSerialPort and Win_QextSerialPort classes. Подробнее...

Граф наследования:QextSerialBase:
Posix_QextSerialPort Win_QextSerialPort

Открытые члены

 QextSerialBase ()
 
 QextSerialBase (const char *name)
 
virtual ~QextSerialBase ()
 
virtual void construct (void)
 
virtual const charname () const
 
virtual void setName (const char *name)
 
virtual bool open (int mode=0)=0
 
virtual bool open (const char *name)
 
virtual void close ()=0
 
virtual void flush ()=0
 
virtual Offset size () const =0
 
virtual Q_LONG readLine (char *data, Q_ULONG maxlen)
 
virtual int getch ()=0
 
virtual int putch (int)=0
 
virtual int ungetch (int)
 
virtual bool atEnd () const
 
virtual void setFlowControl (FlowType)=0
 
virtual FlowType flowControl () const
 
virtual void setParity (ParityType)=0
 
virtual ParityType parity () const
 
virtual void setDataBits (DataBitsType)=0
 
virtual DataBitsType dataBits () const
 
virtual void setStopBits (StopBitsType)=0
 
virtual StopBitsType stopBits () const
 
virtual void setBaudRate (BaudRateType)=0
 
virtual BaudRateType baudRate () const
 
virtual bool isOpen () const
 
virtual unsigned long lastError () const
 
virtual void setDtr (bool set=true)=0
 
virtual void setRts (bool set=true)=0
 
virtual unsigned long lineStatus (void)=0
 
virtual int bytesWaiting ()=0
 
virtual void translateError (unsigned long)=0
 
virtual void setTimeout (unsigned long, unsigned long)=0
 
virtual bool isOpen (void)
 
virtual Q_LONG readBlock (char *data, unsigned long maxlen)=0
 
virtual Q_LONG writeBlock (const char *data, unsigned long len)=0
 

Защищенные данные

bool portOpen
 
unsigned long lastErr
 
char portName [PORT_NAME_SIZE_LIMIT+1]
 
PortSettings Settings
 

Подробное описание

QT serial port base class for Posix_QextSerialPort and Win_QextSerialPort classes.

Версия
0.70 (pre-alpha)
Автор
Wayne Roth

A common base class for Win_QextSerialBase, Posix_QextSerialBase and QextSerialPort.

Конструктор(ы)

◆ QextSerialBase() [1/2]

QextSerialBase::QextSerialBase ( )

Default constructor.

Перекрестные ссылки setName().

◆ QextSerialBase() [2/2]

QextSerialBase::QextSerialBase ( const char * name)

Construct a port and assign it to the device specified by the name parameter.

Перекрестные ссылки name() и setName().

◆ ~QextSerialBase()

QextSerialBase::~QextSerialBase ( )
virtual

Standard destructor.

Методы

◆ atEnd()

bool QextSerialBase::atEnd ( ) const
virtual

This function will return true if the input buffer is empty (or on error), and false otherwise. Call QextSerialBase::lastError() for error information.

◆ baudRate()

BaudRateType QextSerialBase::baudRate ( void ) const
virtual

Returns the baud rate of the serial port. For a list of possible return values see the definition of the enum BaudRateType.

Используется в Posix_QextSerialPort::setBaudRate() и Win_QextSerialPort::setBaudRate().

◆ bytesWaiting()

virtual int QextSerialBase::bytesWaiting ( )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ close()

virtual void QextSerialBase::close ( )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ construct()

void QextSerialBase::construct ( void )
virtual

Common constructor function, called by all versions of Win_QextSerialPort::Win_QextSerialPort(). Sets up default port settings (115200 8N1 Hardware flow control where supported, otherwise no flow control, and 500 ms timeout).

Переопределяется в Posix_QextSerialPort и Win_QextSerialPort.

Используется в Posix_QextSerialPort::construct() и Win_QextSerialPort::construct().

◆ dataBits()

DataBitsType QextSerialBase::dataBits ( ) const
virtual

Returns the number of data bits used by the port. For a list of possible values returned by this function, see the definition of the enum DataBitsType.

Используется в Posix_QextSerialPort::setDataBits() и Win_QextSerialPort::setDataBits().

◆ flowControl()

FlowType QextSerialBase::flowControl ( ) const
virtual

Returns the type of flow control used by the port. For a list of possible values returned by this function, see the definition of the enum FlowType.

◆ flush()

virtual void QextSerialBase::flush ( )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ getch()

virtual int QextSerialBase::getch ( )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ isOpen() [1/2]

bool QextSerialBase::isOpen ( void ) const
virtual

Returns true if the port associated with the class is currently open, or false if it is not.

◆ isOpen() [2/2]

bool QextSerialBase::isOpen ( void )
virtual

Returns true if the port is currently open, false otherwise

◆ lastError()

unsigned long QextSerialBase::lastError ( ) const
virtual

Returns the code for the last error encountered by the port, or E_NO_ERROR if the last port operation was successful. Possible error codes are:

Error                           Explanation
---------------------------     -------------------------------------------------------------
E_NO_ERROR                      No Error has occured
E_INVALID_FD                    Invalid file descriptor (port was not opened correctly)
E_NO_MEMORY                     Unable to allocate memory tables (POSIX)
E_CAUGHT_NON_BLOCKED_SIGNAL     Caught a non-blocked signal (POSIX)
E_PORT_TIMEOUT                  Operation timed out (POSIX)
E_INVALID_DEVICE                The file opened by the port is not a character device (POSIX)
E_BREAK_CONDITION               The port detected a break condition
E_FRAMING_ERROR                 The port detected a framing error 
                                (usually caused by incorrect baud rate settings)
E_IO_ERROR                      There was an I/O error while communicating with the port
E_BUFFER_OVERRUN                Character buffer overrun
E_RECEIVE_OVERFLOW              Receive buffer overflow
E_RECEIVE_PARITY_ERROR          The port detected a parity error in the received data
E_TRANSMIT_OVERFLOW             Transmit buffer overflow
E_READ_FAILED                   General read operation failure
E_WRITE_FAILED                  General write operation failure

◆ lineStatus()

virtual unsigned long QextSerialBase::lineStatus ( void )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ name()

const char * QextSerialBase::name ( ) const
virtual

Returns a pointer to a string containing the name of the device associated with the object

Используется в open(), QextSerialBase(), setName() и Win_QextSerialPort::Win_QextSerialPort().

◆ open() [1/2]

bool QextSerialBase::open ( const char * name)
virtual

Opens a serial port by name. The string passed in the name parameter is associated with the object and subsequent calls to open() may use the no-parameter version. This function has no effect if the port associated with the class is already open. The port is also configured to the current settings, as stored in the Settings structure.

Перекрестные ссылки name() и setName().

◆ open() [2/2]

virtual bool QextSerialBase::open ( int mode = 0)
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ parity()

ParityType QextSerialBase::parity ( ) const
virtual

Returns the type of parity used by the port. For a list of possible values returned by this function, see the definition of the enum ParityType.

Используется в Posix_QextSerialPort::setParity() и Win_QextSerialPort::setParity().

◆ putch()

virtual int QextSerialBase::putch ( int )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ readBlock()

virtual Q_LONG QextSerialBase::readBlock ( char * data,
unsigned long maxlen )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ readLine()

Q_LONG QextSerialBase::readLine ( char * data,
Q_ULONG maxlen )
virtual

This function will read a line of buffered input from the port, stopping when either maxlen bytes have been read, the port has no more data available, or a newline is encountered. The value returned is the length of the string that was read.

Thanks to Olivier Tubach for the original version of this function.

◆ setBaudRate()

virtual void QextSerialBase::setBaudRate ( BaudRateType )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setDataBits()

virtual void QextSerialBase::setDataBits ( DataBitsType )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setDtr()

virtual void QextSerialBase::setDtr ( bool set = true)
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setFlowControl()

virtual void QextSerialBase::setFlowControl ( FlowType )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setName()

void QextSerialBase::setName ( const char * name)
virtual

Sets the name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0".

Перекрестные ссылки name().

Используется в open(), QextSerialBase(), QextSerialBase() и Win_QextSerialPort::Win_QextSerialPort().

◆ setParity()

virtual void QextSerialBase::setParity ( ParityType )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setRts()

virtual void QextSerialBase::setRts ( bool set = true)
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setStopBits()

virtual void QextSerialBase::setStopBits ( StopBitsType )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ setTimeout()

virtual void QextSerialBase::setTimeout ( unsigned long ,
unsigned long  )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ size()

virtual Offset QextSerialBase::size ( ) const
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ stopBits()

StopBitsType QextSerialBase::stopBits ( ) const
virtual

Returns the number of stop bits used by the port. For a list of possible return values, see the definition of the enum StopBitsType.

Используется в Posix_QextSerialPort::setStopBits() и Win_QextSerialPort::setStopBits().

◆ translateError()

virtual void QextSerialBase::translateError ( unsigned long )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.

◆ ungetch()

int QextSerialBase::ungetch ( int )
virtual

This function is included to implement the full QIODevice interface, and currently has no purpose within this class. This function is meaningless on an unbuffered device and currently only prints a warning message to that effect.

Переопределяется в Posix_QextSerialPort и Win_QextSerialPort.

◆ writeBlock()

virtual Q_LONG QextSerialBase::writeBlock ( const char * data,
unsigned long len )
pure virtual

Замещается в Posix_QextSerialPort и Win_QextSerialPort.


Объявления и описания членов классов находятся в файлах: