diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-11 09:23:08 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-11 09:28:05 +0100 |
commit | 96ea4b2629939b5ff357402245ac2e220979ee51 (patch) | |
tree | 7ea11c5468217915db6c3a17ec8da1407401d4fa /src | |
parent | a93fc13093ce6c75f23f8edcf323a1244891f14b (diff) | |
parent | 84ec01711a9869da26f04e14fda5a5fc54073e98 (diff) | |
download | qtserialport-96ea4b2629939b5ff357402245ac2e220979ee51.tar.gz |
Merge remote-tracking branch 'origin/release' into stable
Conflicts:
src/serialport/qserialport_win.cpp
Change-Id: Ib00a645c6660a3c81dbc9e159110f7bfc392ea36
Diffstat (limited to 'src')
-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 |
3 files changed, 33 insertions, 22 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index b878063..060fcdc 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 1689222..30e3b8c 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 5641fcb..ecf8a62 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 { |