From b2dcacddabb5bcfbc031a0681a0e90996092a506 Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Tue, 26 Jul 2016 15:20:17 +0300 Subject: Add missng default parameters to waitFor() methods ... and adjust their documentation a bit. [ChangeLog][QtSerialPort][QSerialPort] Added missing parameters for waitFor() methods Change-Id: I95d7076bfef47dd75d37960ca8a719ae779737d6 Reviewed-by: Thiago Macieira --- src/serialport/qserialport.cpp | 15 ++++++++++++--- src/serialport/qserialport.h | 4 ++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 21727a0..4f3fd04 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -1286,10 +1286,11 @@ bool QSerialPort::canReadLine() const This function blocks until new data is available for reading and the \l{QIODevice::}{readyRead()} signal has been emitted. The function - will timeout after \a msecs milliseconds. + will timeout after \a msecs milliseconds; the default timeout is + 30000 milliseconds. - The function returns true if the readyRead() signal is emitted and - there is new data available for reading; otherwise it returns false + The function returns \c true if the readyRead() signal is emitted and + there is new data available for reading; otherwise it returns \c false (if an error occurred or the operation timed out). \sa waitForBytesWritten() @@ -1314,6 +1315,14 @@ bool QSerialPort::waitForReadyRead(int msecs) /*! \reimp + + This function blocks until at least one byte has been written to the serial + port and the \l{QIODevice::}{bytesWritten()} signal has been emitted. The + function will timeout after \a msecs milliseconds; the default timeout is + 30000 milliseconds. + + The function returns \c true if the bytesWritten() signal is emitted; otherwise + it returns \c false (if an error occurred or the operation timed out). */ bool QSerialPort::waitForBytesWritten(int msecs) { diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h index 3289ca1..0a7ab0f 100644 --- a/src/serialport/qserialport.h +++ b/src/serialport/qserialport.h @@ -262,8 +262,8 @@ public: qint64 bytesToWrite() const Q_DECL_OVERRIDE; bool canReadLine() const Q_DECL_OVERRIDE; - bool waitForReadyRead(int msecs) Q_DECL_OVERRIDE; - bool waitForBytesWritten(int msecs) Q_DECL_OVERRIDE; + bool waitForReadyRead(int msecs = 30000) Q_DECL_OVERRIDE; + bool waitForBytesWritten(int msecs = 30000) Q_DECL_OVERRIDE; #if QT_DEPRECATED_SINCE(5, 5) QT_DEPRECATED bool sendBreak(int duration = 0); -- cgit v1.2.1