From d5658bd0ced4a1eb0703d3cb1b566025d610fbdd Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Wed, 25 Dec 2013 16:14:12 +0400 Subject: 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 Reviewed-by: Denis Shienkov --- examples/serialport/creadersync/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/serialport/creadersync/main.cpp') diff --git a/examples/serialport/creadersync/main.cpp b/examples/serialport/creadersync/main.cpp index 188d7b89..47f6ee8a 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; } -- cgit v1.2.3