diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2013-12-25 16:14:12 +0400 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-08 13:26:15 +0100 |
commit | d5658bd0ced4a1eb0703d3cb1b566025d610fbdd (patch) | |
tree | 8a8c263d3a472fa98155745b8e3d5186eb7f0be5 /examples/serialport | |
parent | 007e8063946e66d32e4ab7e345472036517135ff (diff) | |
download | qtserialport-d5658bd0ced4a1eb0703d3cb1b566025d610fbdd.tar.gz |
creadersync: do not return successful read for empty data
In case of handling of the TimeoutError it is necessary to check on
existence of the read data (for this concrete implementation of the
example). Otherwise the application always return the TimeoutError
even if a data was successfully read.
Change-Id: I2437461f2ed2806bb7d7e16deb6925df035f62a1
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'examples/serialport')
-rw-r--r-- | examples/serialport/creadersync/main.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/serialport/creadersync/main.cpp b/examples/serialport/creadersync/main.cpp index 188d7b8..47f6ee8 100644 --- a/examples/serialport/creadersync/main.cpp +++ b/examples/serialport/creadersync/main.cpp @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) if (serialPort.error() == QSerialPort::ReadError) { standardOutput << QObject::tr("Failed to read from port %1, error: %2").arg(serialPortName).arg(serialPort.errorString()) << endl; return 1; - } else if (serialPort.error() == QSerialPort::TimeoutError) { + } else if (serialPort.error() == QSerialPort::TimeoutError && readData.isEmpty()) { standardOutput << QObject::tr("No data was currently available for reading from port %1").arg(serialPortName) << endl; return 0; } |