diff options
-rw-r--r-- | examples/serialport/doc/creaderasync.qdoc | 2 | ||||
-rw-r--r-- | src/serialport/qserialport.cpp | 23 | ||||
-rw-r--r-- | src/serialport/qserialport.h | 22 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 10 |
4 files changed, 34 insertions, 23 deletions
diff --git a/examples/serialport/doc/creaderasync.qdoc b/examples/serialport/doc/creaderasync.qdoc index 23498565..a8b21013 100644 --- a/examples/serialport/doc/creaderasync.qdoc +++ b/examples/serialport/doc/creaderasync.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example creader + \example creaderasync \title Command Line Reader Async Example \ingroup qtserialport-examples diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index b8780636..060fcdc6 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -116,10 +116,10 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed) port to the desired setting using the setBaudRate(), setDataBits(), setParity(), setStopBits(), and setFlowControl() methods. - The status of the control pinout signals is determined with the - isDataTerminalReady(), isRequestToSend, and pinoutSignals() methods. To - change the control line status, use the setDataTerminalReady(), and - setRequestToSend() methods. + There are a couple of properties to work with the pinout signals namely: + QSerialPort::dataTerminalReady, QSerialPort::requestToSend. It is also + possible to use the pinoutSignals() method to query the current pinout + signals set. Once you know that the ports are ready to read or write, you can use the read() or write() methods. Alternatively the @@ -291,8 +291,14 @@ int QSerialPortPrivateData::timeoutValue(int msecs, int elapsed) This enum describes the possible RS-232 pinout signals. \value NoSignal No line active - \value TransmittedDataSignal TxD (Transmitted Data). - \value ReceivedDataSignal RxD (Received Data). + \value TransmittedDataSignal TxD (Transmitted Data). This value is + obsolete. It is provided to keep old + source code working. We strongly + advise against using it in new code. + \value ReceivedDataSignal RxD (Received Data). This value is + obsolete. It is provided to keep old + source code working. We strongly + advise against using it in new code. \value DataTerminalReadySignal DTR (Data Terminal Ready). \value DataCarrierDetectSignal DCD (Data Carrier Detect). \value DataSetReadySignal DSR (Data Set Ready). @@ -981,8 +987,7 @@ bool QSerialPort::isRequestToSend() \note The serial port has to be open before trying to get the pinout signals; otherwise returns NoSignal and sets the NotOpenError error code. - \sa isDataTerminalReady(), isRequestToSend, setDataTerminalReady(), - setRequestToSend() + \sa QSerialPort::dataTerminalReady, QSerialPort::requestToSend */ QSerialPort::PinoutSignals QSerialPort::pinoutSignals() { @@ -1279,7 +1284,7 @@ bool QSerialPort::waitForReadyRead(int msecs) } /*! - \fn QSerialPort::Handle QSerialPort::handle() + \fn Handle QSerialPort::handle() const \since 5.2 If the platform is supported and the serial port is open, returns the native diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h index 1689222b..30e3b8c1 100644 --- a/src/serialport/qserialport.h +++ b/src/serialport/qserialport.h @@ -131,16 +131,6 @@ public: UnknownFlowControl = -1 }; -#if QT_DEPRECATED_SINCE(5, 2) -#if defined _MSC_VER -#pragma deprecated(UnknownBaud) -#pragma deprecated(UnknownDataBits) -#pragma deprecated(UnknownParity) -#pragma deprecated(UnknownStopBits) -#pragma deprecated(UnknownFlowControl) -#endif -#endif - enum PinoutSignal { NoSignal = 0x00, TransmittedDataSignal = 0x01, @@ -157,6 +147,18 @@ public: Q_DECLARE_FLAGS(PinoutSignals, PinoutSignal) #if QT_DEPRECATED_SINCE(5, 2) +#if defined _MSC_VER +#pragma deprecated(UnknownBaud) +#pragma deprecated(UnknownDataBits) +#pragma deprecated(UnknownParity) +#pragma deprecated(UnknownStopBits) +#pragma deprecated(UnknownFlowControl) +#pragma deprecated(TransmittedDataSignal) +#pragma deprecated(ReceivedDataSignal) +#endif +#endif + +#if QT_DEPRECATED_SINCE(5, 2) enum DataErrorPolicy { SkipPolicy, PassZeroPolicy, diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index 5641fcb4..ecf8a62f 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -377,6 +377,9 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) QElapsedTimer stopWatch; stopWatch.start(); + const qint64 initialReadBufferSize = readBuffer.size(); + qint64 currentReadBufferSize = initialReadBufferSize; + do { bool timedOut = false; HANDLE triggeredEvent = 0; @@ -390,11 +393,12 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) if (triggeredEvent == communicationOverlapped.hEvent) { _q_completeAsyncCommunication(); - if (error != QSerialPort::NoError) - return false; } else if (triggeredEvent == readCompletionOverlapped.hEvent) { _q_completeAsyncRead(); - return error == QSerialPort::NoError; + if (qint64(readBuffer.size()) != currentReadBufferSize) + currentReadBufferSize = readBuffer.size(); + else if (initialReadBufferSize != currentReadBufferSize) + return true; } else if (triggeredEvent == writeCompletionOverlapped.hEvent) { _q_completeAsyncWrite(); } else { |