QextBaseType Class Reference

Inheritance diagram for QextBaseType:

Win_QextSerialPort Posix_QextSerialPort QextSerialBase QextSerialBase QIODevice QIODevice QextSerialPort List of all members.

Public Member Functions

 aboutToClose ()
 aboutToClose ()
 atEnd ()
 atEnd ()
virtual bool atEnd () const
virtual BaudRateType baudRate () const
virtual qint64 bytesAvailable ()
virtual qint64 bytesAvailable ()
 bytesToWrite ()
 bytesToWrite ()
 bytesWritten (qint64 bytes)
 bytesWritten (qint64 bytes)
 canReadLine ()
 canReadLine ()
virtual void close ()
virtual void close ()
virtual void construct ()
virtual DataBitsType dataBits () const
 errorString ()
 errorString ()
virtual FlowType flowControl () const
virtual void flush ()
virtual void flush ()
 getChar (char *c)
 getChar (char *c)
 isOpen ()
 isOpen ()
 isReadable ()
 isReadable ()
 isSequential ()
 isSequential ()
virtual bool isSequential () const
 isTextModeEnabled ()
 isTextModeEnabled ()
 isWritable ()
 isWritable ()
virtual ulong lastError () const
virtual ulong lineStatus ()
virtual ulong lineStatus (void)
virtual bool open (OpenMode mode=0)
virtual bool open (OpenMode mode=0)
 openMode ()
 openMode ()
virtual ParityType parity () const
 peek (qint64 maxSize)
 peek (char *data, qint64 maxSize)
 peek (qint64 maxSize)
 peek (char *data, qint64 maxSize)
virtual QString portName () const
 pos ()
 pos ()
 putChar (char c)
 putChar (char c)
 read (qint64 maxSize)
 read (char *data, qint64 maxSize)
 read (qint64 maxSize)
 read (char *data, qint64 maxSize)
 readAll ()
 readAll ()
 readLine (qint64 maxSize=0)
 readLine (qint64 maxSize=0)
virtual qint64 readLine (char *data, qint64 maxSize)
 readLineData (char *data, qint64 maxSize)
 readLineData (char *data, qint64 maxSize)
 readyRead ()
 readyRead ()
 reset ()
 reset ()
 seek (qint64 pos)
 seek (qint64 pos)
virtual void setBaudRate (BaudRateType)
virtual void setBaudRate (BaudRateType)
virtual void setDataBits (DataBitsType)
virtual void setDataBits (DataBitsType)
virtual void setDtr (bool set=true)
virtual void setDtr (bool set=true)
 setErrorString (const QString &str)
 setErrorString (const QString &str)
virtual void setFlowControl (FlowType)
virtual void setFlowControl (FlowType)
 setOpenMode (OpenMode openMode)
 setOpenMode (OpenMode openMode)
virtual void setParity (ParityType)
virtual void setParity (ParityType)
virtual void setPortName (const QString &name)
virtual void setRts (bool set=true)
virtual void setRts (bool set=true)
virtual void setStopBits (StopBitsType)
virtual void setStopBits (StopBitsType)
 setTextModeEnabled (bool enabled)
 setTextModeEnabled (bool enabled)
virtual void setTimeout (ulong, ulong)
virtual void setTimeout (ulong, ulong)
 size ()
virtual qint64 size () const
 size ()
virtual qint64 size () const
virtual StopBitsType stopBits () const
virtual void translateError (ulong error)
virtual void translateError (ulong)
virtual void ungetChar (char c)
virtual void ungetChar (char c)
 waitForBytesWritten (int msecs)
 waitForBytesWritten (int msecs)
 waitForReadyRead (int msecs)
 waitForReadyRead (int msecs)
 write (const QByteArray &byteArray)
 write (const char *data, qint64 maxSize)
 write (const QByteArray &byteArray)
 write (const char *data, qint64 maxSize)

Protected Member Functions

virtual qint64 readData (char *data, qint64 maxSize)
virtual qint64 readData (char *data, qint64 maxSize)
virtual qint64 writeData (const char *data, qint64 maxSize)
virtual qint64 writeData (const char *data, qint64 maxSize)

Protected Attributes

ulong lastErr
ulong lastErr
QString port
QString port
termios Posix_CommConfig
timeval Posix_Copy_Timeout
QFile * Posix_File
timeval Posix_Timeout
PortSettings Settings
PortSettings Settings
COMMCONFIG Win_CommConfig
COMMTIMEOUTS Win_CommTimeouts
HANDLE Win_Handle

Static Protected Attributes

static QMutex * mutex = NULL
static QMutex * mutex = NULL
static ulong refCount = 0
static ulong refCount = 0

Member Function Documentation

bool QextSerialBase::atEnd (  )  const [virtual, inherited]

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

00187 {
00188     if (size()) {
00189         return true;
00190     }
00191     return false;
00192 }

BaudRateType QextSerialBase::baudRate ( void   )  const [virtual, inherited]

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

00126 {
00127     return Settings.BaudRate;
00128 }

qint64 Posix_QextSerialPort::bytesAvailable (  )  [virtual, inherited]

Returns the number of bytes waiting in the port's receive queue. This function will return 0 if the port is not currently open, or -1 on error. Error information can be retrieved by calling Posix_QextSerialPort::getLastError().

Implements QextSerialBase.

00909 {
00910     LOCK_MUTEX();
00911     if (isOpen()) {
00912         int bytesQueued;
00913         fd_set fileSet;
00914         FD_ZERO(&fileSet);
00915         FD_SET(Posix_File->handle(), &fileSet);
00916 
00917         /*on Linux systems the Posix_Timeout structure will be altered by the select() call.
00918           Make sure we use the right timeout values*/
00919         //memcpy(&Posix_Timeout, &Posix_Copy_Timeout, sizeof(struct timeval));
00920         Posix_Timeout = Posix_Copy_Timeout;
00921         int n=select(Posix_File->handle()+1, &fileSet, NULL, &fileSet, &Posix_Timeout);
00922         if (!n) {
00923             lastErr=E_PORT_TIMEOUT;
00924             UNLOCK_MUTEX();
00925             return -1;
00926         }
00927         if (n==-1 || ioctl(Posix_File->handle(), FIONREAD, &bytesQueued)==-1) {
00928             translateError(errno);
00929             UNLOCK_MUTEX();
00930             return -1;
00931         }
00932         lastErr=E_NO_ERROR;
00933         UNLOCK_MUTEX();
00934         return bytesQueued + QIODevice::bytesAvailable();
00935     }
00936     UNLOCK_MUTEX();
00937     return 0;
00938 }

qint64 Win_QextSerialPort::bytesAvailable (  )  [virtual, inherited]

Returns the number of bytes waiting in the port's receive queue. This function will return 0 if the port is not currently open, or -1 on error. Error information can be retrieved by calling Win_QextSerialPort::getLastError().

Implements QextSerialBase.

00229                                           {
00230     LOCK_MUTEX();
00231     if (isOpen()) {
00232         DWORD Errors;
00233         COMSTAT Status;
00234         bool success=ClearCommError(Win_Handle, &Errors, &Status);
00235         translateError(Errors);
00236         if (success) {
00237             lastErr=E_NO_ERROR;
00238             UNLOCK_MUTEX();
00239             return Status.cbInQue + QIODevice::bytesAvailable();
00240         }
00241         UNLOCK_MUTEX();
00242         return (unsigned int)-1;
00243     }
00244     UNLOCK_MUTEX();
00245     return 0;
00246 }

void Posix_QextSerialPort::close (  )  [virtual, inherited]

Closes a serial port. This function has no effect if the serial port associated with the class is not currently open.

Implements QextSerialBase.

00865 {
00866     LOCK_MUTEX();
00867     Posix_File->close();
00868     QIODevice::close();
00869     UNLOCK_MUTEX();
00870 }

void Win_QextSerialPort::close (  )  [virtual, inherited]

Closes a serial port. This function has no effect if the serial port associated with the class is not currently open.

Implements QextSerialBase.

00187                                {
00188     LOCK_MUTEX();
00189     CloseHandle(Win_Handle);
00190     QIODevice::close();
00191     UNLOCK_MUTEX();
00192 }

void QextSerialBase::construct (  )  [virtual, inherited]

Common constructor function for setting up default port settings. (115200 Baud, 8N1, Hardware flow control where supported, otherwise no flow control, and 500 ms timeout).

00083 {
00084     Settings.BaudRate=BAUD115200;
00085     Settings.DataBits=DATA_8;
00086     Settings.Parity=PAR_NONE;
00087     Settings.StopBits=STOP_1;
00088     Settings.FlowControl=FLOW_HARDWARE;
00089     Settings.Timeout_Sec=0;
00090     Settings.Timeout_Millisec=500;
00091 
00092 #ifdef QT_THREAD_SUPPORT
00093     if (!mutex) {
00094         mutex=new QMutex( QMutex::Recursive );
00095     }
00096     refCount++;
00097 #endif
00098 
00099     setOpenMode(QIODevice::NotOpen);
00100 }

DataBitsType QextSerialBase::dataBits (  )  const [virtual, inherited]

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.

00136 {
00137     return Settings.DataBits;
00138 }

FlowType QextSerialBase::flowControl (  )  const [virtual, inherited]

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.

00166 {
00167     return Settings.FlowControl;
00168 }

void Posix_QextSerialPort::flush (  )  [virtual, inherited]

Flushes all pending I/O to the serial port. This function has no effect if the serial port associated with the class is not currently open.

Implements QextSerialBase.

00878 {
00879     LOCK_MUTEX();
00880     if (isOpen()) {
00881         Posix_File->flush();
00882     }
00883     UNLOCK_MUTEX();
00884 }

void Win_QextSerialPort::flush (  )  [virtual, inherited]

Flushes all pending I/O to the serial port. This function has no effect if the serial port associated with the class is not currently open.

Implements QextSerialBase.

00199                                {
00200     LOCK_MUTEX();
00201     if (isOpen()) {
00202         FlushFileBuffers(Win_Handle);
00203     }
00204     UNLOCK_MUTEX();
00205 }

bool QextSerialBase::isSequential (  )  const [virtual, inherited]

Returns true if device is sequential, otherwise returns false. Serial port is sequential device so this function always returns true. Check QIODevice::isSequential() documentation for more information.

00177 {
00178     return true;
00179 }

ulong QextSerialBase::lastError (  )  const [virtual, inherited]

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
00248 {
00249     return lastErr;
00250 }

unsigned long Posix_QextSerialPort::lineStatus ( void   )  [virtual, inherited]

returns the line status as stored by the port function. This function will retrieve the states of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned long with specific bits indicating which lines are high. The following constants should be used to examine the states of individual lines:

Mask        Line
------      ----
LS_CTS      CTS
LS_DSR      DSR
LS_DCD      DCD
LS_RI       RI
LS_RTS      RTS (POSIX only)
LS_DTR      DTR (POSIX only)
LS_ST       Secondary TXD (POSIX only)
LS_SR       Secondary RXD (POSIX only)

This function will return 0 if the port associated with the class is not currently open.

Implements QextSerialBase.

01042 {
01043     unsigned long Status=0, Temp=0;
01044     LOCK_MUTEX();
01045     if (isOpen()) {
01046         ioctl(Posix_File->handle(), TIOCMGET, &Temp);
01047         if (Temp&TIOCM_CTS) {
01048             Status|=LS_CTS;
01049         }
01050         if (Temp&TIOCM_DSR) {
01051             Status|=LS_DSR;
01052         }
01053         if (Temp&TIOCM_RI) {
01054             Status|=LS_RI;
01055         }
01056         if (Temp&TIOCM_CD) {
01057             Status|=LS_DCD;
01058         }
01059         if (Temp&TIOCM_DTR) {
01060             Status|=LS_DTR;
01061         }
01062         if (Temp&TIOCM_RTS) {
01063             Status|=LS_RTS;
01064         }
01065         if (Temp&TIOCM_ST) {
01066             Status|=LS_ST;
01067         }
01068         if (Temp&TIOCM_SR) {
01069             Status|=LS_SR;
01070         }
01071     }
01072     UNLOCK_MUTEX();
01073     return Status;
01074 }

ulong Win_QextSerialPort::lineStatus ( void   )  [virtual, inherited]

returns the line status as stored by the port function. This function will retrieve the states of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned long with specific bits indicating which lines are high. The following constants should be used to examine the states of individual lines:

Mask        Line
------      ----
LS_CTS      CTS
LS_DSR      DSR
LS_DCD      DCD
LS_RI       RI

This function will return 0 if the port associated with the class is not currently open.

Implements QextSerialBase.

00838                                          {
00839     unsigned long Status=0, Temp=0;
00840     LOCK_MUTEX();
00841     if (isOpen()) {
00842         GetCommModemStatus(Win_Handle, &Temp);
00843         if (Temp&MS_CTS_ON) {
00844             Status|=LS_CTS;
00845         }
00846         if (Temp&MS_DSR_ON) {
00847             Status|=LS_DSR;
00848         }
00849         if (Temp&MS_RING_ON) {
00850             Status|=LS_RI;
00851         }
00852         if (Temp&MS_RLSD_ON) {
00853             Status|=LS_DCD;
00854         }
00855     }
00856     UNLOCK_MUTEX();
00857     return Status;
00858 }

bool Posix_QextSerialPort::open ( OpenMode  mode = 0  )  [virtual, inherited]

Opens the serial port associated to this class. 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.

Implements QextSerialBase.

00817 {
00818     LOCK_MUTEX();
00819     if (mode == QIODevice::NotOpen)
00820         return isOpen();
00821     if (!isOpen()) {
00822         /*open the port*/
00823         Posix_File->setFileName(port);
00824         qDebug("Trying to open File");
00825         if (Posix_File->open(QIODevice::ReadWrite|QIODevice::Unbuffered)) {
00826             qDebug("Opened File succesfully");
00827             /*set open mode*/
00828             QIODevice::open(mode);
00829 
00830             /*configure port settings*/
00831             tcgetattr(Posix_File->handle(), &Posix_CommConfig);
00832 
00833             /*set up other port settings*/
00834             Posix_CommConfig.c_cflag|=CREAD|CLOCAL;
00835             Posix_CommConfig.c_lflag&=(~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG));
00836             Posix_CommConfig.c_iflag&=(~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY));
00837             Posix_CommConfig.c_oflag&=(~OPOST);
00838             Posix_CommConfig.c_cc[VMIN]=0;
00839             Posix_CommConfig.c_cc[VINTR] = _POSIX_VDISABLE;
00840             Posix_CommConfig.c_cc[VQUIT] = _POSIX_VDISABLE;
00841             Posix_CommConfig.c_cc[VSTART] = _POSIX_VDISABLE;
00842             Posix_CommConfig.c_cc[VSTOP] = _POSIX_VDISABLE;
00843             Posix_CommConfig.c_cc[VSUSP] = _POSIX_VDISABLE;
00844             setBaudRate(Settings.BaudRate);
00845             setDataBits(Settings.DataBits);
00846             setParity(Settings.Parity);
00847             setStopBits(Settings.StopBits);
00848             setFlowControl(Settings.FlowControl);
00849             setTimeout(Settings.Timeout_Sec, Settings.Timeout_Millisec);
00850             tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00851         } else {
00852             qDebug("Could not open File! Error code : %d", Posix_File->error());
00853         }
00854     }
00855     UNLOCK_MUTEX();
00856     return isOpen();
00857 }

bool Win_QextSerialPort::open ( OpenMode  mode = 0  )  [virtual, inherited]

Opens a serial port. Note that this function does not specify which device to open. If you need to open a device by name, see Win_QextSerialPort::open(const char*). 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.

Implements QextSerialBase.

00144                                            {
00145     unsigned long confSize = sizeof(COMMCONFIG);
00146     Win_CommConfig.dwSize = confSize;
00147 
00148     LOCK_MUTEX();
00149     if (mode == QIODevice::NotOpen)
00150         return isOpen();
00151     if (!isOpen()) {
00152         /*open the port*/
00153         Win_Handle=CreateFileA(port.toAscii(), GENERIC_READ|GENERIC_WRITE,
00154                               FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
00155         if (Win_Handle!=INVALID_HANDLE_VALUE) {
00156             /*set open mode*/
00157             QIODevice::open(mode);
00158 
00159             /*configure port settings*/
00160             GetCommConfig(Win_Handle, &Win_CommConfig, &confSize);
00161             GetCommState(Win_Handle, &(Win_CommConfig.dcb));
00162 
00163             /*set up parameters*/
00164             Win_CommConfig.dcb.fBinary=TRUE;
00165             Win_CommConfig.dcb.fInX=FALSE;
00166             Win_CommConfig.dcb.fOutX=FALSE;
00167             Win_CommConfig.dcb.fAbortOnError=FALSE;
00168             Win_CommConfig.dcb.fNull=FALSE;
00169             setBaudRate(Settings.BaudRate);
00170             setDataBits(Settings.DataBits);
00171             setStopBits(Settings.StopBits);
00172             setParity(Settings.Parity);
00173             setFlowControl(Settings.FlowControl);
00174             setTimeout(Settings.Timeout_Sec, Settings.Timeout_Millisec);
00175             SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00176         }
00177     }
00178     UNLOCK_MUTEX();
00179     return isOpen();
00180 }

ParityType QextSerialBase::parity (  )  const [virtual, inherited]

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.

00146 {
00147     return Settings.Parity;
00148 }

QString QextSerialBase::portName (  )  const [virtual, inherited]

Returns the name set by setPortName().

00116 {
00117     return port;
00118 }

qint64 Posix_QextSerialPort::readData ( char *  data,
qint64  maxSize 
) [protected, virtual, inherited]

Reads a block of data from the serial port. This function will read at most maxSize bytes from the serial port and place them in the buffer pointed to by data. Return value is the number of bytes actually read, or -1 on error.

Warning:
before calling this function ensure that serial port associated with this class is currently open (use isOpen() function to check if port is open).

Implements QextSerialBase.

01086 {
01087     LOCK_MUTEX();
01088     int retVal=0;
01089     retVal=Posix_File->read(data, maxSize);
01090     if (retVal==-1)
01091         lastErr=E_READ_FAILED;
01092     UNLOCK_MUTEX();
01093 
01094     return retVal;
01095 }

qint64 Win_QextSerialPort::readData ( char *  data,
qint64  maxSize 
) [protected, virtual, inherited]

Reads a block of data from the serial port. This function will read at most maxlen bytes from the serial port and place them in the buffer pointed to by data. Return value is the number of bytes actually read, or -1 on error.

Warning:
before calling this function ensure that serial port associated with this class is currently open (use isOpen() function to check if port is open).

Implements QextSerialBase.

00289 {
00290     LOCK_MUTEX();
00291     int retVal=0;
00292     COMSTAT Win_ComStat;
00293     DWORD Win_BytesRead=0;
00294     DWORD Win_ErrorMask=0;
00295     ClearCommError(Win_Handle, &Win_ErrorMask, &Win_ComStat);
00296     if (Win_ComStat.cbInQue &&
00297         (!ReadFile(Win_Handle, (void*)data, (DWORD)maxSize, &Win_BytesRead, NULL)
00298         || Win_BytesRead==0)) {
00299         lastErr=E_READ_FAILED;
00300         retVal=-1;
00301     }
00302     else {
00303         retVal=((int)Win_BytesRead);
00304     }
00305     UNLOCK_MUTEX();
00306 
00307     return retVal;
00308 }

qint64 QextSerialBase::readLine ( char *  data,
qint64  maxSize 
) [virtual, inherited]

This function will read a line of buffered input from the port, stopping when either maxSize 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.

Reimplemented from QIODevice.

00201 {
00202     qint64 numBytes = bytesAvailable();
00203     char* pData = data;
00204 
00205     if (maxSize < 2)    //maxSize must be larger than 1
00206         return -1;
00207 
00208     /*read a byte at a time for MIN(bytesAvail, maxSize - 1) iterations, or until a newline*/
00209     while (pData<(data+numBytes) && --maxSize) {
00210         readData(pData, 1);
00211         if (*pData++ == '\n') {
00212             break;
00213         }
00214     }
00215     *pData='\0';
00216 
00217     /*return size of data read*/
00218     return (pData-data);
00219 }

void Posix_QextSerialPort::setBaudRate ( BaudRateType  baudRate  )  [virtual, inherited]

Sets the baud rate of the serial port. Note that not all rates are applicable on all platforms. The following table shows translations of the various baud rate constants on Windows(including NT/2000) and POSIX platforms. Speeds marked with an * are speeds that are usable on both Windows and POSIX.

Note:
BAUD76800 may not be supported on all POSIX systems. SGI/IRIX systems do not support BAUD1800.
  RATE          Windows Speed   POSIX Speed
  -----------   -------------   -----------
   BAUD50                 110          50
   BAUD75                 110          75
  *BAUD110                110         110
   BAUD134                110         134.5
   BAUD150                110         150
   BAUD200                110         200
  *BAUD300                300         300
  *BAUD600                600         600
  *BAUD1200              1200        1200
   BAUD1800              1200        1800
  *BAUD2400              2400        2400
  *BAUD4800              4800        4800
  *BAUD9600              9600        9600
   BAUD14400            14400        9600
  *BAUD19200            19200       19200
  *BAUD38400            38400       38400
   BAUD56000            56000       38400
  *BAUD57600            57600       57600
   BAUD76800            57600       76800
  *BAUD115200          115200      115200
   BAUD128000          128000      115200
   BAUD256000          256000      115200

Implements QextSerialBase.

00190 {
00191     LOCK_MUTEX();
00192     if (Settings.BaudRate!=baudRate) {
00193         switch (baudRate) {
00194             case BAUD14400:
00195                 Settings.BaudRate=BAUD9600;
00196                 break;
00197 
00198             case BAUD56000:
00199                 Settings.BaudRate=BAUD38400;
00200                 break;
00201 
00202             case BAUD76800:
00203 
00204 #ifndef B76800
00205                 Settings.BaudRate=BAUD57600;
00206 #else
00207                 Settings.BaudRate=baudRate;
00208 #endif
00209                 break;
00210 
00211             case BAUD128000:
00212             case BAUD256000:
00213                 Settings.BaudRate=BAUD115200;
00214                 break;
00215 
00216             default:
00217                 Settings.BaudRate=baudRate;
00218                 break;
00219         }
00220     }
00221     if (isOpen()) {
00222         switch (baudRate) {
00223 
00224             /*50 baud*/
00225             case BAUD50:
00226                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 50 baud operation.");
00227 #ifdef CBAUD
00228                 Posix_CommConfig.c_cflag&=(~CBAUD);
00229                 Posix_CommConfig.c_cflag|=B50;
00230 #else
00231                 cfsetispeed(&Posix_CommConfig, B50);
00232                 cfsetospeed(&Posix_CommConfig, B50);
00233 #endif
00234                 break;
00235 
00236             /*75 baud*/
00237             case BAUD75:
00238                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 75 baud operation.");
00239 #ifdef CBAUD
00240                 Posix_CommConfig.c_cflag&=(~CBAUD);
00241                 Posix_CommConfig.c_cflag|=B75;
00242 #else
00243                 cfsetispeed(&Posix_CommConfig, B75);
00244                 cfsetospeed(&Posix_CommConfig, B75);
00245 #endif
00246                 break;
00247 
00248             /*110 baud*/
00249             case BAUD110:
00250 #ifdef CBAUD
00251                 Posix_CommConfig.c_cflag&=(~CBAUD);
00252                 Posix_CommConfig.c_cflag|=B110;
00253 #else
00254                 cfsetispeed(&Posix_CommConfig, B110);
00255                 cfsetospeed(&Posix_CommConfig, B110);
00256 #endif
00257                 break;
00258 
00259             /*134.5 baud*/
00260             case BAUD134:
00261                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 134.5 baud operation.");
00262 #ifdef CBAUD
00263                 Posix_CommConfig.c_cflag&=(~CBAUD);
00264                 Posix_CommConfig.c_cflag|=B134;
00265 #else
00266                 cfsetispeed(&Posix_CommConfig, B134);
00267                 cfsetospeed(&Posix_CommConfig, B134);
00268 #endif
00269                 break;
00270 
00271             /*150 baud*/
00272             case BAUD150:
00273                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 150 baud operation.");
00274 #ifdef CBAUD
00275                 Posix_CommConfig.c_cflag&=(~CBAUD);
00276                 Posix_CommConfig.c_cflag|=B150;
00277 #else
00278                 cfsetispeed(&Posix_CommConfig, B150);
00279                 cfsetospeed(&Posix_CommConfig, B150);
00280 #endif
00281                 break;
00282 
00283             /*200 baud*/
00284             case BAUD200:
00285                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows does not support 200 baud operation.");
00286 #ifdef CBAUD
00287                 Posix_CommConfig.c_cflag&=(~CBAUD);
00288                 Posix_CommConfig.c_cflag|=B200;
00289 #else
00290                 cfsetispeed(&Posix_CommConfig, B200);
00291                 cfsetospeed(&Posix_CommConfig, B200);
00292 #endif
00293                 break;
00294 
00295             /*300 baud*/
00296             case BAUD300:
00297 #ifdef CBAUD
00298                 Posix_CommConfig.c_cflag&=(~CBAUD);
00299                 Posix_CommConfig.c_cflag|=B300;
00300 #else
00301                 cfsetispeed(&Posix_CommConfig, B300);
00302                 cfsetospeed(&Posix_CommConfig, B300);
00303 #endif
00304                 break;
00305 
00306             /*600 baud*/
00307             case BAUD600:
00308 #ifdef CBAUD
00309                 Posix_CommConfig.c_cflag&=(~CBAUD);
00310                 Posix_CommConfig.c_cflag|=B600;
00311 #else
00312                 cfsetispeed(&Posix_CommConfig, B600);
00313                 cfsetospeed(&Posix_CommConfig, B600);
00314 #endif
00315                 break;
00316 
00317             /*1200 baud*/
00318             case BAUD1200:
00319 #ifdef CBAUD
00320                 Posix_CommConfig.c_cflag&=(~CBAUD);
00321                 Posix_CommConfig.c_cflag|=B1200;
00322 #else
00323                 cfsetispeed(&Posix_CommConfig, B1200);
00324                 cfsetospeed(&Posix_CommConfig, B1200);
00325 #endif
00326                 break;
00327 
00328             /*1800 baud*/
00329             case BAUD1800:
00330                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows and IRIX do not support 1800 baud operation.");
00331 #ifdef CBAUD
00332                 Posix_CommConfig.c_cflag&=(~CBAUD);
00333                 Posix_CommConfig.c_cflag|=B1800;
00334 #else
00335                 cfsetispeed(&Posix_CommConfig, B1800);
00336                 cfsetospeed(&Posix_CommConfig, B1800);
00337 #endif
00338                 break;
00339 
00340             /*2400 baud*/
00341             case BAUD2400:
00342 #ifdef CBAUD
00343                 Posix_CommConfig.c_cflag&=(~CBAUD);
00344                 Posix_CommConfig.c_cflag|=B2400;
00345 #else
00346                 cfsetispeed(&Posix_CommConfig, B2400);
00347                 cfsetospeed(&Posix_CommConfig, B2400);
00348 #endif
00349                 break;
00350 
00351             /*4800 baud*/
00352             case BAUD4800:
00353 #ifdef CBAUD
00354                 Posix_CommConfig.c_cflag&=(~CBAUD);
00355                 Posix_CommConfig.c_cflag|=B4800;
00356 #else
00357                 cfsetispeed(&Posix_CommConfig, B4800);
00358                 cfsetospeed(&Posix_CommConfig, B4800);
00359 #endif
00360                 break;
00361 
00362             /*9600 baud*/
00363             case BAUD9600:
00364 #ifdef CBAUD
00365                 Posix_CommConfig.c_cflag&=(~CBAUD);
00366                 Posix_CommConfig.c_cflag|=B9600;
00367 #else
00368                 cfsetispeed(&Posix_CommConfig, B9600);
00369                 cfsetospeed(&Posix_CommConfig, B9600);
00370 #endif
00371                 break;
00372 
00373             /*14400 baud*/
00374             case BAUD14400:
00375                 TTY_WARNING("Posix_QextSerialPort: POSIX does not support 14400 baud operation.  Switching to 9600 baud.");
00376 #ifdef CBAUD
00377                 Posix_CommConfig.c_cflag&=(~CBAUD);
00378                 Posix_CommConfig.c_cflag|=B9600;
00379 #else
00380                 cfsetispeed(&Posix_CommConfig, B9600);
00381                 cfsetospeed(&Posix_CommConfig, B9600);
00382 #endif
00383                 break;
00384 
00385             /*19200 baud*/
00386             case BAUD19200:
00387 #ifdef CBAUD
00388                 Posix_CommConfig.c_cflag&=(~CBAUD);
00389                 Posix_CommConfig.c_cflag|=B19200;
00390 #else
00391                 cfsetispeed(&Posix_CommConfig, B19200);
00392                 cfsetospeed(&Posix_CommConfig, B19200);
00393 #endif
00394                 break;
00395 
00396             /*38400 baud*/
00397             case BAUD38400:
00398 #ifdef CBAUD
00399                 Posix_CommConfig.c_cflag&=(~CBAUD);
00400                 Posix_CommConfig.c_cflag|=B38400;
00401 #else
00402                 cfsetispeed(&Posix_CommConfig, B38400);
00403                 cfsetospeed(&Posix_CommConfig, B38400);
00404 #endif
00405                 break;
00406 
00407             /*56000 baud*/
00408             case BAUD56000:
00409                 TTY_WARNING("Posix_QextSerialPort: POSIX does not support 56000 baud operation.  Switching to 38400 baud.");
00410 #ifdef CBAUD
00411                 Posix_CommConfig.c_cflag&=(~CBAUD);
00412                 Posix_CommConfig.c_cflag|=B38400;
00413 #else
00414                 cfsetispeed(&Posix_CommConfig, B38400);
00415                 cfsetospeed(&Posix_CommConfig, B38400);
00416 #endif
00417                 break;
00418 
00419             /*57600 baud*/
00420             case BAUD57600:
00421 #ifdef CBAUD
00422                 Posix_CommConfig.c_cflag&=(~CBAUD);
00423                 Posix_CommConfig.c_cflag|=B57600;
00424 #else
00425                 cfsetispeed(&Posix_CommConfig, B57600);
00426                 cfsetospeed(&Posix_CommConfig, B57600);
00427 #endif
00428                 break;
00429 
00430             /*76800 baud*/
00431             case BAUD76800:
00432                 TTY_PORTABILITY_WARNING("Posix_QextSerialPort Portability Warning: Windows and some POSIX systems do not support 76800 baud operation.");
00433 #ifdef CBAUD
00434                 Posix_CommConfig.c_cflag&=(~CBAUD);
00435 
00436 #ifdef B76800
00437                 Posix_CommConfig.c_cflag|=B76800;
00438 #else
00439                 TTY_WARNING("Posix_QextSerialPort: Posix_QextSerialPort was compiled without 76800 baud support.  Switching to 57600 baud.");
00440                 Posix_CommConfig.c_cflag|=B57600;
00441 #endif //B76800
00442 #else  //CBAUD
00443 #ifdef B76800
00444                 cfsetispeed(&Posix_CommConfig, B76800);
00445                 cfsetospeed(&Posix_CommConfig, B76800);
00446 #else
00447                 TTY_WARNING("Posix_QextSerialPort: Posix_QextSerialPort was compiled without 76800 baud support.  Switching to 57600 baud.");
00448                 cfsetispeed(&Posix_CommConfig, B57600);
00449                 cfsetospeed(&Posix_CommConfig, B57600);
00450 #endif //B76800
00451 #endif //CBAUD
00452                 break;
00453 
00454             /*115200 baud*/
00455             case BAUD115200:
00456 #ifdef CBAUD
00457                 Posix_CommConfig.c_cflag&=(~CBAUD);
00458                 Posix_CommConfig.c_cflag|=B115200;
00459 #else
00460                 cfsetispeed(&Posix_CommConfig, B115200);
00461                 cfsetospeed(&Posix_CommConfig, B115200);
00462 #endif
00463                 break;
00464 
00465             /*128000 baud*/
00466             case BAUD128000:
00467                 TTY_WARNING("Posix_QextSerialPort: POSIX does not support 128000 baud operation.  Switching to 115200 baud.");
00468 #ifdef CBAUD
00469                 Posix_CommConfig.c_cflag&=(~CBAUD);
00470                 Posix_CommConfig.c_cflag|=B115200;
00471 #else
00472                 cfsetispeed(&Posix_CommConfig, B115200);
00473                 cfsetospeed(&Posix_CommConfig, B115200);
00474 #endif
00475                 break;
00476 
00477             /*256000 baud*/
00478             case BAUD256000:
00479                 TTY_WARNING("Posix_QextSerialPort: POSIX does not support 256000 baud operation.  Switching to 115200 baud.");
00480 #ifdef CBAUD
00481                 Posix_CommConfig.c_cflag&=(~CBAUD);
00482                 Posix_CommConfig.c_cflag|=B115200;
00483 #else
00484                 cfsetispeed(&Posix_CommConfig, B115200);
00485                 cfsetospeed(&Posix_CommConfig, B115200);
00486 #endif
00487                 break;
00488         }
00489         tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00490     }
00491     UNLOCK_MUTEX();
00492 }

void Win_QextSerialPort::setBaudRate ( BaudRateType  baudRate  )  [virtual, inherited]

Sets the baud rate of the serial port. Note that not all rates are applicable on all platforms. The following table shows translations of the various baud rate constants on Windows(including NT/2000) and POSIX platforms. Speeds marked with an * are speeds that are usable on both Windows and POSIX.

  RATE          Windows Speed   POSIX Speed
  -----------   -------------   -----------
   BAUD50                 110          50
   BAUD75                 110          75
  *BAUD110                110         110
   BAUD134                110         134.5
   BAUD150                110         150
   BAUD200                110         200
  *BAUD300                300         300
  *BAUD600                600         600
  *BAUD1200              1200        1200
   BAUD1800              1200        1800
  *BAUD2400              2400        2400
  *BAUD4800              4800        4800
  *BAUD9600              9600        9600
   BAUD14400            14400        9600
  *BAUD19200            19200       19200
  *BAUD38400            38400       38400
   BAUD56000            56000       38400
  *BAUD57600            57600       57600
   BAUD76800            57600       76800
  *BAUD115200          115200      115200
   BAUD128000          128000      115200
   BAUD256000          256000      115200

Implements QextSerialBase.

00629                                                           {
00630     LOCK_MUTEX();
00631     if (Settings.BaudRate!=baudRate) {
00632         switch (baudRate) {
00633             case BAUD50:
00634             case BAUD75:
00635             case BAUD134:
00636             case BAUD150:
00637             case BAUD200:
00638                 Settings.BaudRate=BAUD110;
00639                 break;
00640 
00641             case BAUD1800:
00642                 Settings.BaudRate=BAUD1200;
00643                 break;
00644 
00645             case BAUD76800:
00646                 Settings.BaudRate=BAUD57600;
00647                 break;
00648 
00649             default:
00650                 Settings.BaudRate=baudRate;
00651                 break;
00652         }
00653     }
00654     if (isOpen()) {
00655         switch (baudRate) {
00656 
00657             /*50 baud*/
00658             case BAUD50:
00659                 TTY_WARNING("Win_QextSerialPort: Windows does not support 50 baud operation.  Switching to 110 baud.");
00660                 Win_CommConfig.dcb.BaudRate=CBR_110;
00661                 break;
00662 
00663             /*75 baud*/
00664             case BAUD75:
00665                 TTY_WARNING("Win_QextSerialPort: Windows does not support 75 baud operation.  Switching to 110 baud.");
00666                 Win_CommConfig.dcb.BaudRate=CBR_110;
00667                 break;
00668 
00669             /*110 baud*/
00670             case BAUD110:
00671                 Win_CommConfig.dcb.BaudRate=CBR_110;
00672                 break;
00673 
00674             /*134.5 baud*/
00675             case BAUD134:
00676                 TTY_WARNING("Win_QextSerialPort: Windows does not support 134.5 baud operation.  Switching to 110 baud.");
00677                 Win_CommConfig.dcb.BaudRate=CBR_110;
00678                 break;
00679 
00680             /*150 baud*/
00681             case BAUD150:
00682                 TTY_WARNING("Win_QextSerialPort: Windows does not support 150 baud operation.  Switching to 110 baud.");
00683                 Win_CommConfig.dcb.BaudRate=CBR_110;
00684                 break;
00685 
00686             /*200 baud*/
00687             case BAUD200:
00688                 TTY_WARNING("Win_QextSerialPort: Windows does not support 200 baud operation.  Switching to 110 baud.");
00689                 Win_CommConfig.dcb.BaudRate=CBR_110;
00690                 break;
00691 
00692             /*300 baud*/
00693             case BAUD300:
00694                 Win_CommConfig.dcb.BaudRate=CBR_300;
00695                 break;
00696 
00697             /*600 baud*/
00698             case BAUD600:
00699                 Win_CommConfig.dcb.BaudRate=CBR_600;
00700                 break;
00701 
00702             /*1200 baud*/
00703             case BAUD1200:
00704                 Win_CommConfig.dcb.BaudRate=CBR_1200;
00705                 break;
00706 
00707             /*1800 baud*/
00708             case BAUD1800:
00709                 TTY_WARNING("Win_QextSerialPort: Windows does not support 1800 baud operation.  Switching to 1200 baud.");
00710                 Win_CommConfig.dcb.BaudRate=CBR_1200;
00711                 break;
00712 
00713             /*2400 baud*/
00714             case BAUD2400:
00715                 Win_CommConfig.dcb.BaudRate=CBR_2400;
00716                 break;
00717 
00718             /*4800 baud*/
00719             case BAUD4800:
00720                 Win_CommConfig.dcb.BaudRate=CBR_4800;
00721                 break;
00722 
00723             /*9600 baud*/
00724             case BAUD9600:
00725                 Win_CommConfig.dcb.BaudRate=CBR_9600;
00726                 break;
00727 
00728             /*14400 baud*/
00729             case BAUD14400:
00730                 TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: POSIX does not support 14400 baud operation.");
00731                 Win_CommConfig.dcb.BaudRate=CBR_14400;
00732                 break;
00733 
00734             /*19200 baud*/
00735             case BAUD19200:
00736                 Win_CommConfig.dcb.BaudRate=CBR_19200;
00737                 break;
00738 
00739             /*38400 baud*/
00740             case BAUD38400:
00741                 Win_CommConfig.dcb.BaudRate=CBR_38400;
00742                 break;
00743 
00744             /*56000 baud*/
00745             case BAUD56000:
00746                 TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: POSIX does not support 56000 baud operation.");
00747                 Win_CommConfig.dcb.BaudRate=CBR_56000;
00748                 break;
00749 
00750             /*57600 baud*/
00751             case BAUD57600:
00752                 Win_CommConfig.dcb.BaudRate=CBR_57600;
00753                 break;
00754 
00755             /*76800 baud*/
00756             case BAUD76800:
00757                 TTY_WARNING("Win_QextSerialPort: Windows does not support 76800 baud operation.  Switching to 57600 baud.");
00758                 Win_CommConfig.dcb.BaudRate=CBR_57600;
00759                 break;
00760 
00761             /*115200 baud*/
00762             case BAUD115200:
00763                 Win_CommConfig.dcb.BaudRate=CBR_115200;
00764                 break;
00765 
00766             /*128000 baud*/
00767             case BAUD128000:
00768                 TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: POSIX does not support 128000 baud operation.");
00769                 Win_CommConfig.dcb.BaudRate=CBR_128000;
00770                 break;
00771 
00772             /*256000 baud*/
00773             case BAUD256000:
00774                 TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: POSIX does not support 256000 baud operation.");
00775                 Win_CommConfig.dcb.BaudRate=CBR_256000;
00776                 break;
00777         }
00778         SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00779     }
00780     UNLOCK_MUTEX();
00781 }

void Posix_QextSerialPort::setDataBits ( DataBitsType  dataBits  )  [virtual, inherited]

Sets the number of data bits used by the serial port. Possible values of dataBits are:

    DATA_5      5 data bits
    DATA_6      6 data bits
    DATA_7      7 data bits
    DATA_8      8 data bits

Note:
This function is subject to the following restrictions:
5 data bits cannot be used with 2 stop bits.
8 data bits cannot be used with space parity on POSIX systems.

Implements QextSerialBase.

00513 {
00514     LOCK_MUTEX();
00515     if (Settings.DataBits!=dataBits) {
00516         if ((Settings.StopBits==STOP_2 && dataBits==DATA_5) ||
00517             (Settings.StopBits==STOP_1_5 && dataBits!=DATA_5) ||
00518             (Settings.Parity==PAR_SPACE && dataBits==DATA_8)) {
00519         }
00520         else {
00521             Settings.DataBits=dataBits;
00522         }
00523     }
00524     if (isOpen()) {
00525         switch(dataBits) {
00526 
00527             /*5 data bits*/
00528             case DATA_5:
00529                 if (Settings.StopBits==STOP_2) {
00530                     TTY_WARNING("Posix_QextSerialPort: 5 Data bits cannot be used with 2 stop bits.");
00531                 }
00532                 else {
00533                     Settings.DataBits=dataBits;
00534                     Posix_CommConfig.c_cflag&=(~CSIZE);
00535                     Posix_CommConfig.c_cflag|=CS5;
00536                     tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00537                 }
00538                 break;
00539 
00540             /*6 data bits*/
00541             case DATA_6:
00542                 if (Settings.StopBits==STOP_1_5) {
00543                     TTY_WARNING("Posix_QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits.");
00544                 }
00545                 else {
00546                     Settings.DataBits=dataBits;
00547                     Posix_CommConfig.c_cflag&=(~CSIZE);
00548                     Posix_CommConfig.c_cflag|=CS6;
00549                     tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00550                 }
00551                 break;
00552 
00553             /*7 data bits*/
00554             case DATA_7:
00555                 if (Settings.StopBits==STOP_1_5) {
00556                     TTY_WARNING("Posix_QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits.");
00557                 }
00558                 else {
00559                     Settings.DataBits=dataBits;
00560                     Posix_CommConfig.c_cflag&=(~CSIZE);
00561                     Posix_CommConfig.c_cflag|=CS7;
00562                     tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00563                 }
00564                 break;
00565 
00566             /*8 data bits*/
00567             case DATA_8:
00568                 if (Settings.StopBits==STOP_1_5) {
00569                     TTY_WARNING("Posix_QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits.");
00570                 }
00571                 else {
00572                     Settings.DataBits=dataBits;
00573                     Posix_CommConfig.c_cflag&=(~CSIZE);
00574                     Posix_CommConfig.c_cflag|=CS8;
00575                     tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00576                 }
00577                 break;
00578         }
00579     }
00580     UNLOCK_MUTEX();
00581 }

void Win_QextSerialPort::setDataBits ( DataBitsType  dataBits  )  [virtual, inherited]

Sets the number of data bits used by the serial port. Possible values of dataBits are:

    DATA_5      5 data bits
    DATA_6      6 data bits
    DATA_7      7 data bits
    DATA_8      8 data bits

Note:
This function is subject to the following restrictions:
5 data bits cannot be used with 2 stop bits.
1.5 stop bits can only be used with 5 data bits.
8 data bits cannot be used with space parity on POSIX systems.

Implements QextSerialBase.

00470                                                           {
00471     LOCK_MUTEX();
00472     if (Settings.DataBits!=dataBits) {
00473         if ((Settings.StopBits==STOP_2 && dataBits==DATA_5) ||
00474             (Settings.StopBits==STOP_1_5 && dataBits!=DATA_5)) {
00475         }
00476         else {
00477             Settings.DataBits=dataBits;
00478         }
00479     }
00480     if (isOpen()) {
00481         switch(dataBits) {
00482 
00483             /*5 data bits*/
00484             case DATA_5:
00485                 if (Settings.StopBits==STOP_2) {
00486                     TTY_WARNING("Win_QextSerialPort: 5 Data bits cannot be used with 2 stop bits.");
00487                 }
00488                 else {
00489                     Win_CommConfig.dcb.ByteSize=5;
00490                     SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00491                 }
00492                 break;
00493 
00494             /*6 data bits*/
00495             case DATA_6:
00496                 if (Settings.StopBits==STOP_1_5) {
00497                     TTY_WARNING("Win_QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits.");
00498                 }
00499                 else {
00500                     Win_CommConfig.dcb.ByteSize=6;
00501                     SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00502                 }
00503                 break;
00504 
00505             /*7 data bits*/
00506             case DATA_7:
00507                 if (Settings.StopBits==STOP_1_5) {
00508                     TTY_WARNING("Win_QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits.");
00509                 }
00510                 else {
00511                     Win_CommConfig.dcb.ByteSize=7;
00512                     SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00513                 }
00514                 break;
00515 
00516             /*8 data bits*/
00517             case DATA_8:
00518                 if (Settings.StopBits==STOP_1_5) {
00519                     TTY_WARNING("Win_QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits.");
00520                 }
00521                 else {
00522                     Win_CommConfig.dcb.ByteSize=8;
00523                     SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00524                 }
00525                 break;
00526         }
00527     }
00528     UNLOCK_MUTEX();
00529 }

void Posix_QextSerialPort::setDtr ( bool  set = true  )  [virtual, inherited]

Sets DTR line to the requested state (high by default). This function will have no effect if the port associated with the class is not currently open.

Implements QextSerialBase.

00980 {
00981     LOCK_MUTEX();
00982     if (isOpen()) {
00983         int status;
00984         ioctl(Posix_File->handle(), TIOCMGET, &status);
00985         if (set) {
00986             status|=TIOCM_DTR;
00987         }
00988         else {
00989             status&=~TIOCM_DTR;
00990         }
00991         ioctl(Posix_File->handle(), TIOCMSET, &status);
00992     }
00993     UNLOCK_MUTEX();
00994 }

void Win_QextSerialPort::setDtr ( bool  set = true  )  [virtual, inherited]

Sets DTR line to the requested state (high by default). This function will have no effect if the port associated with the class is not currently open.

Implements QextSerialBase.

00788                                         {
00789     LOCK_MUTEX();
00790     if (isOpen()) {
00791         if (set) {
00792             EscapeCommFunction(Win_Handle, SETDTR);
00793         }
00794         else {
00795             EscapeCommFunction(Win_Handle, CLRDTR);
00796         }
00797     }
00798     UNLOCK_MUTEX();
00799 }

void Posix_QextSerialPort::setFlowControl ( FlowType  flow  )  [virtual, inherited]

Sets the flow control used by the port. Possible values of flow are:

    FLOW_OFF            No flow control
    FLOW_HARDWARE       Hardware (RTS/CTS) flow control
    FLOW_XONXOFF        Software (XON/XOFF) flow control
Note:
FLOW_HARDWARE may not be supported on all versions of UNIX. In cases where it is unsupported, FLOW_HARDWARE is the same as FLOW_OFF.

Implements QextSerialBase.

00746 {
00747     LOCK_MUTEX();
00748     if (Settings.FlowControl!=flow) {
00749         Settings.FlowControl=flow;
00750     }
00751     if (isOpen()) {
00752         switch(flow) {
00753 
00754             /*no flow control*/
00755             case FLOW_OFF:
00756                 Posix_CommConfig.c_cflag&=(~CRTSCTS);
00757                 Posix_CommConfig.c_iflag&=(~(IXON|IXOFF|IXANY));
00758                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00759                 break;
00760 
00761             /*software (XON/XOFF) flow control*/
00762             case FLOW_XONXOFF:
00763                 Posix_CommConfig.c_cflag&=(~CRTSCTS);
00764                 Posix_CommConfig.c_iflag|=(IXON|IXOFF|IXANY);
00765                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00766                 break;
00767 
00768             case FLOW_HARDWARE:
00769                 Posix_CommConfig.c_cflag|=CRTSCTS;
00770                 Posix_CommConfig.c_iflag&=(~(IXON|IXOFF|IXANY));
00771                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00772                 break;
00773         }
00774     }
00775     UNLOCK_MUTEX();
00776 }

void Win_QextSerialPort::setFlowControl ( FlowType  flow  )  [virtual, inherited]

Sets the flow control used by the port. Possible values of flow are:

    FLOW_OFF            No flow control
    FLOW_HARDWARE       Hardware (RTS/CTS) flow control
    FLOW_XONXOFF        Software (XON/XOFF) flow control

Implements QextSerialBase.

00358                                                      {
00359     LOCK_MUTEX();
00360     if (Settings.FlowControl!=flow) {
00361         Settings.FlowControl=flow;
00362     }
00363     if (isOpen()) {
00364         switch(flow) {
00365 
00366             /*no flow control*/
00367             case FLOW_OFF:
00368                 Win_CommConfig.dcb.fOutxCtsFlow=FALSE;
00369                 Win_CommConfig.dcb.fRtsControl=RTS_CONTROL_DISABLE;
00370                 Win_CommConfig.dcb.fInX=FALSE;
00371                 Win_CommConfig.dcb.fOutX=FALSE;
00372                 SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00373                 break;
00374 
00375             /*software (XON/XOFF) flow control*/
00376             case FLOW_XONXOFF:
00377                 Win_CommConfig.dcb.fOutxCtsFlow=FALSE;
00378                 Win_CommConfig.dcb.fRtsControl=RTS_CONTROL_DISABLE;
00379                 Win_CommConfig.dcb.fInX=TRUE;
00380                 Win_CommConfig.dcb.fOutX=TRUE;
00381                 SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00382                 break;
00383 
00384             case FLOW_HARDWARE:
00385                 Win_CommConfig.dcb.fOutxCtsFlow=TRUE;
00386                 Win_CommConfig.dcb.fRtsControl=RTS_CONTROL_HANDSHAKE;
00387                 Win_CommConfig.dcb.fInX=FALSE;
00388                 Win_CommConfig.dcb.fOutX=FALSE;
00389                 SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00390                 break;
00391         }
00392     }
00393     UNLOCK_MUTEX();
00394 }

void Posix_QextSerialPort::setParity ( ParityType  parity  )  [virtual, inherited]

Sets the parity associated with the serial port. The possible values of parity are:

    PAR_SPACE       Space Parity
    PAR_MARK        Mark Parity
    PAR_NONE        No Parity
    PAR_EVEN        Even Parity
    PAR_ODD         Odd Parity

Note:
This function is subject to the following limitations:
POSIX systems do not support mark parity.
POSIX systems support space parity only if tricked into doing so, and only with fewer than 8 data bits. Use space parity very carefully with POSIX systems.

Implements QextSerialBase.

00604 {
00605     LOCK_MUTEX();
00606     if (Settings.Parity!=parity) {
00607         if (parity==PAR_MARK || (parity==PAR_SPACE && Settings.DataBits==DATA_8)) {
00608         }
00609         else {
00610             Settings.Parity=parity;
00611         }
00612     }
00613     if (isOpen()) {
00614         switch (parity) {
00615 
00616             /*space parity*/
00617             case PAR_SPACE:
00618                 if (Settings.DataBits==DATA_8) {
00619                     TTY_PORTABILITY_WARNING("Posix_QextSerialPort:  Space parity is only supported in POSIX with 7 or fewer data bits");
00620                 }
00621                 else {
00622 
00623                     /*space parity not directly supported - add an extra data bit to simulate it*/
00624                     Posix_CommConfig.c_cflag&=~(PARENB|CSIZE);
00625                     switch(Settings.DataBits) {
00626                         case DATA_5:
00627                             Settings.DataBits=DATA_6;
00628                             Posix_CommConfig.c_cflag|=CS6;
00629                             break;
00630 
00631                         case DATA_6:
00632                             Settings.DataBits=DATA_7;
00633                             Posix_CommConfig.c_cflag|=CS7;
00634                             break;
00635 
00636                         case DATA_7:
00637                             Settings.DataBits=DATA_8;
00638                             Posix_CommConfig.c_cflag|=CS8;
00639                             break;
00640 
00641                         case DATA_8:
00642                             break;
00643                     }
00644                     tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00645                 }
00646                 break;
00647 
00648             /*mark parity - WINDOWS ONLY*/
00649             case PAR_MARK:
00650                 TTY_WARNING("Posix_QextSerialPort: Mark parity is not supported by POSIX.");
00651                 break;
00652 
00653             /*no parity*/
00654             case PAR_NONE:
00655                 Posix_CommConfig.c_cflag&=(~PARENB);
00656                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00657                 break;
00658 
00659             /*even parity*/
00660             case PAR_EVEN:
00661                 Posix_CommConfig.c_cflag&=(~PARODD);
00662                 Posix_CommConfig.c_cflag|=PARENB;
00663                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00664                 break;
00665 
00666             /*odd parity*/
00667             case PAR_ODD:
00668                 Posix_CommConfig.c_cflag|=(PARENB|PARODD);
00669                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00670                 break;
00671         }
00672     }
00673     UNLOCK_MUTEX();
00674 }

void Win_QextSerialPort::setParity ( ParityType  parity  )  [virtual, inherited]

Sets the parity associated with the serial port. The possible values of parity are:

    PAR_SPACE       Space Parity
    PAR_MARK        Mark Parity
    PAR_NONE        No Parity
    PAR_EVEN        Even Parity
    PAR_ODD         Odd Parity

Implements QextSerialBase.

00407                                                     {
00408     LOCK_MUTEX();
00409     if (Settings.Parity!=parity) {
00410         Settings.Parity=parity;
00411     }
00412     if (isOpen()) {
00413         Win_CommConfig.dcb.Parity=(unsigned char)parity;
00414         switch (parity) {
00415 
00416             /*space parity*/
00417             case PAR_SPACE:
00418                 if (Settings.DataBits==DATA_8) {
00419                     TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: Space parity with 8 data bits is not supported by POSIX systems.");
00420                 }
00421                 Win_CommConfig.dcb.fParity=TRUE;
00422                 break;
00423 
00424             /*mark parity - WINDOWS ONLY*/
00425             case PAR_MARK:
00426                 TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning:  Mark parity is not supported by POSIX systems");
00427                 Win_CommConfig.dcb.fParity=TRUE;
00428                 break;
00429 
00430             /*no parity*/
00431             case PAR_NONE:
00432                 Win_CommConfig.dcb.fParity=FALSE;
00433                 break;
00434 
00435             /*even parity*/
00436             case PAR_EVEN:
00437                 Win_CommConfig.dcb.fParity=TRUE;
00438                 break;
00439 
00440             /*odd parity*/
00441             case PAR_ODD:
00442                 Win_CommConfig.dcb.fParity=TRUE;
00443                 break;
00444         }
00445         SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00446     }
00447     UNLOCK_MUTEX();
00448 }

void QextSerialBase::setPortName ( const QString &  name  )  [virtual, inherited]

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

00107 {
00108     port = name;
00109 }

void Posix_QextSerialPort::setRts ( bool  set = true  )  [virtual, inherited]

Sets RTS line to the requested state (high by default). This function will have no effect if the port associated with the class is not currently open.

Implements QextSerialBase.

01002 {
01003     LOCK_MUTEX();
01004     if (isOpen()) {
01005         int status;
01006         ioctl(Posix_File->handle(), TIOCMGET, &status);
01007         if (set) {
01008             status|=TIOCM_RTS;
01009         }
01010         else {
01011             status&=~TIOCM_RTS;
01012         }
01013         ioctl(Posix_File->handle(), TIOCMSET, &status);
01014     }
01015     UNLOCK_MUTEX();
01016 }

void Win_QextSerialPort::setRts ( bool  set = true  )  [virtual, inherited]

Sets RTS line to the requested state (high by default). This function will have no effect if the port associated with the class is not currently open.

Implements QextSerialBase.

00806                                         {
00807     LOCK_MUTEX();
00808     if (isOpen()) {
00809         if (set) {
00810             EscapeCommFunction(Win_Handle, SETRTS);
00811         }
00812         else {
00813             EscapeCommFunction(Win_Handle, CLRRTS);
00814         }
00815     }
00816     UNLOCK_MUTEX();
00817 }

void Posix_QextSerialPort::setStopBits ( StopBitsType  stopBits  )  [virtual, inherited]

Sets the number of stop bits used by the serial port. Possible values of stopBits are:

    STOP_1      1 stop bit
    STOP_1_5    1.5 stop bits
    STOP_2      2 stop bits
Note:
This function is subject to the following restrictions:
2 stop bits cannot be used with 5 data bits.
POSIX does not support 1.5 stop bits.

Implements QextSerialBase.

00693 {
00694     LOCK_MUTEX();
00695     if (Settings.StopBits!=stopBits) {
00696         if ((Settings.DataBits==DATA_5 && stopBits==STOP_2) || stopBits==STOP_1_5) {}
00697         else {
00698             Settings.StopBits=stopBits;
00699         }
00700     }
00701     if (isOpen()) {
00702         switch (stopBits) {
00703 
00704             /*one stop bit*/
00705             case STOP_1:
00706                 Settings.StopBits=stopBits;
00707                 Posix_CommConfig.c_cflag&=(~CSTOPB);
00708                 tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00709                 break;
00710 
00711             /*1.5 stop bits*/
00712             case STOP_1_5:
00713                 TTY_WARNING("Posix_QextSerialPort: 1.5 stop bit operation is not supported by POSIX.");
00714                 break;
00715 
00716             /*two stop bits*/
00717             case STOP_2:
00718                 if (Settings.DataBits==DATA_5) {
00719                     TTY_WARNING("Posix_QextSerialPort: 2 stop bits cannot be used with 5 data bits");
00720                 }
00721                 else {
00722                     Settings.StopBits=stopBits;
00723                     Posix_CommConfig.c_cflag|=CSTOPB;
00724                     tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00725                 }
00726                 break;
00727         }
00728     }
00729     UNLOCK_MUTEX();
00730 }

void Win_QextSerialPort::setStopBits ( StopBitsType  stopBits  )  [virtual, inherited]

Sets the number of stop bits used by the serial port. Possible values of stopBits are:

    STOP_1      1 stop bit
    STOP_1_5    1.5 stop bits
    STOP_2      2 stop bits

Note:
This function is subject to the following restrictions:
2 stop bits cannot be used with 5 data bits.
1.5 stop bits cannot be used with 6 or more data bits.
POSIX does not support 1.5 stop bits.

Implements QextSerialBase.

00549                                                           {
00550     LOCK_MUTEX();
00551     if (Settings.StopBits!=stopBits) {
00552         if ((Settings.DataBits==DATA_5 && stopBits==STOP_2) ||
00553             (stopBits==STOP_1_5 && Settings.DataBits!=DATA_5)) {
00554         }
00555         else {
00556             Settings.StopBits=stopBits;
00557         }
00558     }
00559     if (isOpen()) {
00560         switch (stopBits) {
00561 
00562             /*one stop bit*/
00563             case STOP_1:
00564                 Win_CommConfig.dcb.StopBits=ONESTOPBIT;
00565                 SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00566                 break;
00567 
00568             /*1.5 stop bits*/
00569             case STOP_1_5:
00570                 TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: 1.5 stop bit operation is not supported by POSIX.");
00571                 if (Settings.DataBits!=DATA_5) {
00572                     TTY_WARNING("Win_QextSerialPort: 1.5 stop bits can only be used with 5 data bits");
00573                 }
00574                 else {
00575                     Win_CommConfig.dcb.StopBits=ONE5STOPBITS;
00576                     SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00577                 }
00578                 break;
00579 
00580             /*two stop bits*/
00581             case STOP_2:
00582                 if (Settings.DataBits==DATA_5) {
00583                     TTY_WARNING("Win_QextSerialPort: 2 stop bits cannot be used with 5 data bits");
00584                 }
00585                 else {
00586                     Win_CommConfig.dcb.StopBits=TWOSTOPBITS;
00587                     SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
00588                 }
00589                 break;
00590         }
00591     }
00592     UNLOCK_MUTEX();
00593 }

void Posix_QextSerialPort::setTimeout ( ulong  sec,
ulong  millisec 
) [virtual, inherited]

Sets the read and write timeouts for the port to sec seconds and millisec milliseconds. Note that this is a per-character timeout, i.e. the port will wait this long for each individual character, not for the whole read operation. This timeout also applies to the bytesWaiting() function.

Note:
POSIX does not support millisecond-level control for I/O timeout values. Any timeout set using this function will be set to the next lowest tenth of a second for the purposes of detecting read or write timeouts. For example a timeout of 550 milliseconds will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and writing the port. However millisecond-level control is allowed by the select() system call, so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for the purpose of detecting available bytes in the read buffer.

Implements QextSerialBase.

00796 {
00797     LOCK_MUTEX();
00798     Settings.Timeout_Sec=sec;
00799     Settings.Timeout_Millisec=millisec;
00800     Posix_Copy_Timeout.tv_sec=sec;
00801     Posix_Copy_Timeout.tv_usec=millisec;
00802     if (isOpen()) {
00803         tcgetattr(Posix_File->handle(), &Posix_CommConfig);
00804         Posix_CommConfig.c_cc[VTIME]=sec*10+millisec/100;
00805         tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
00806     }
00807     UNLOCK_MUTEX();
00808 }

void Win_QextSerialPort::setTimeout ( ulong  sec,
ulong  millisec 
) [virtual, inherited]

Sets the read and write timeouts for the port to sec seconds and millisec milliseconds.

Implements QextSerialBase.

00864                                                              {
00865     LOCK_MUTEX();
00866     Settings.Timeout_Sec=sec;
00867     Settings.Timeout_Millisec=millisec;
00868     if(isOpen()) {
00869         Win_CommTimeouts.ReadIntervalTimeout = sec*1000+millisec;
00870         Win_CommTimeouts.ReadTotalTimeoutMultiplier = sec*1000+millisec;
00871         Win_CommTimeouts.ReadTotalTimeoutConstant = 0;
00872         Win_CommTimeouts.WriteTotalTimeoutMultiplier = sec*1000+millisec;
00873         Win_CommTimeouts.WriteTotalTimeoutConstant = 0;
00874         SetCommTimeouts(Win_Handle, &Win_CommTimeouts);
00875     }
00876     UNLOCK_MUTEX();
00877 }

qint64 Posix_QextSerialPort::size (  )  const [virtual, inherited]

This function will return the number of bytes waiting in the receive queue of the serial port. It is included primarily to provide a complete QIODevice interface, and will not record errors in the lastErr member (because it is const). This function is also not thread-safe - in multithreading situations, use Posix_QextSerialPort::bytesWaiting() instead.

Implements QextSerialBase.

00894 {
00895     int numBytes;
00896     if (ioctl(Posix_File->handle(), FIONREAD, &numBytes)<0) {
00897         numBytes=0;
00898     }
00899     return (qint64)numBytes;
00900 }

qint64 Win_QextSerialPort::size (  )  const [virtual, inherited]

This function will return the number of bytes waiting in the receive queue of the serial port. It is included primarily to provide a complete QIODevice interface, and will not record errors in the lastErr member (because it is const). This function is also not thread-safe - in multithreading situations, use Win_QextSerialPort::bytesAvailable() instead.

Implements QextSerialBase.

00214                                       {
00215     int availBytes;
00216     COMSTAT Win_ComStat;
00217     DWORD Win_ErrorMask=0;
00218     ClearCommError(Win_Handle, &Win_ErrorMask, &Win_ComStat);
00219     availBytes = Win_ComStat.cbInQue;
00220     return (qint64)availBytes;
00221 }

StopBitsType QextSerialBase::stopBits (  )  const [virtual, inherited]

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

00156 {
00157     return Settings.StopBits;
00158 }

void Posix_QextSerialPort::translateError ( ulong  error  )  [virtual, inherited]

Translates a system-specific error code to a QextSerialPort error code. Used internally.

Implements QextSerialBase.

00957 {
00958     switch (error) {
00959         case EBADF:
00960         case ENOTTY:
00961             lastErr=E_INVALID_FD;
00962             break;
00963 
00964         case EINTR:
00965             lastErr=E_CAUGHT_NON_BLOCKED_SIGNAL;
00966             break;
00967 
00968         case ENOMEM:
00969             lastErr=E_NO_MEMORY;
00970             break;
00971     }
00972 }

void Win_QextSerialPort::translateError ( ulong  error  )  [virtual, inherited]

Translates a system-specific error code to a QextSerialPort error code. Used internally.

Implements QextSerialBase.

00252                                                    {
00253     if (error&CE_BREAK) {
00254         lastErr=E_BREAK_CONDITION;
00255     }
00256     else if (error&CE_FRAME) {
00257         lastErr=E_FRAMING_ERROR;
00258     }
00259     else if (error&CE_IOE) {
00260         lastErr=E_IO_ERROR;
00261     }
00262     else if (error&CE_MODE) {
00263         lastErr=E_INVALID_FD;
00264     }
00265     else if (error&CE_OVERRUN) {
00266         lastErr=E_BUFFER_OVERRUN;
00267     }
00268     else if (error&CE_RXPARITY) {
00269         lastErr=E_RECEIVE_PARITY_ERROR;
00270     }
00271     else if (error&CE_RXOVER) {
00272         lastErr=E_RECEIVE_OVERFLOW;
00273     }
00274     else if (error&CE_TXFULL) {
00275         lastErr=E_TRANSMIT_OVERFLOW;
00276     }
00277 }

void Posix_QextSerialPort::ungetChar ( char  c  )  [virtual, inherited]

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.

Implements QextSerialBase.

00947 {
00948     /*meaningless on unbuffered sequential device - return error and print a warning*/
00949     TTY_WARNING("Posix_QextSerialPort: ungetChar() called on an unbuffered sequential device - operation is meaningless");
00950 }

void Win_QextSerialPort::ungetChar ( char  c  )  [virtual, inherited]

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.

Implements QextSerialBase.

00343                                          {
00344 
00345     /*meaningless on unbuffered sequential device - return error and print a warning*/
00346     TTY_WARNING("Win_QextSerialPort: ungetChar() called on an unbuffered sequential device - operation is meaningless");
00347 }

qint64 Posix_QextSerialPort::writeData ( const char *  data,
qint64  maxSize 
) [protected, virtual, inherited]

Writes a block of data to the serial port. This function will write maxSize bytes from the buffer pointed to by data to the serial port. Return value is the number of bytes actually written, or -1 on error.

Warning:
before calling this function ensure that serial port associated with this class is currently open (use isOpen() function to check if port is open).

Implements QextSerialBase.

01107 {
01108     LOCK_MUTEX();
01109     int retVal=0;
01110     retVal=Posix_File->write(data, maxSize);
01111     if (retVal==-1)
01112        lastErr=E_WRITE_FAILED;
01113     UNLOCK_MUTEX();
01114 
01115     flush();
01116     return retVal;
01117 }

qint64 Win_QextSerialPort::writeData ( const char *  data,
qint64  maxSize 
) [protected, virtual, inherited]

Writes a block of data to the serial port. This function will write len bytes from the buffer pointed to by data to the serial port. Return value is the number of bytes actually written, or -1 on error.

Warning:
before calling this function ensure that serial port associated with this class is currently open (use isOpen() function to check if port is open).

Implements QextSerialBase.

00320 {
00321     LOCK_MUTEX();
00322     int retVal=0;
00323     DWORD Win_BytesWritten;
00324     if (!WriteFile(Win_Handle, (void*)data, (DWORD)maxSize, &Win_BytesWritten, NULL)) {
00325         lastErr=E_WRITE_FAILED;
00326         retVal=-1;
00327     }
00328     else {
00329         retVal=((int)Win_BytesWritten);
00330     }
00331     UNLOCK_MUTEX();
00332 
00333     flush();
00334     return retVal;
00335 }


Member Data Documentation

ulong QextSerialBase::lastErr [protected, inherited]

ulong QextSerialBase::lastErr [protected, inherited]

QMutex * QextSerialBase::mutex = NULL [static, protected, inherited]

QMutex * QextSerialBase::mutex = NULL [static, protected, inherited]

QString QextSerialBase::port [protected, inherited]

QString QextSerialBase::port [protected, inherited]

struct termios Posix_QextSerialPort::Posix_CommConfig [protected, inherited]

struct timeval Posix_QextSerialPort::Posix_Copy_Timeout [protected, inherited]

QFile* Posix_QextSerialPort::Posix_File [protected, inherited]

struct timeval Posix_QextSerialPort::Posix_Timeout [protected, inherited]

unsigned long QextSerialBase::refCount = 0 [static, protected, inherited]

unsigned long QextSerialBase::refCount = 0 [static, protected, inherited]

PortSettings QextSerialBase::Settings [protected, inherited]

PortSettings QextSerialBase::Settings [protected, inherited]

COMMCONFIG Win_QextSerialPort::Win_CommConfig [protected, inherited]

COMMTIMEOUTS Win_QextSerialPort::Win_CommTimeouts [protected, inherited]

HANDLE Win_QextSerialPort::Win_Handle [protected, inherited]


The documentation for this class was generated from the following file:
Generated on Sun Mar 25 04:21:54 2007 for QextSerialPort by  doxygen 1.4.7