diff options
Diffstat (limited to 'src/serialport')
-rw-r--r-- | src/serialport/qserialport.cpp | 19 | ||||
-rw-r--r-- | src/serialport/qserialport_p.h | 2 | ||||
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 5 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 16 | ||||
-rw-r--r-- | src/serialport/qserialport_wince.cpp | 5 |
5 files changed, 18 insertions, 29 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 9d5aa40..b252152 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -1341,10 +1341,27 @@ bool QSerialPort::isBreakEnabled() const /*! \reimp */ +// This function does not really read anything, as we use QIODevicePrivate's +// buffer. The buffer will be read inside of QIODevice before this +// method will be called. qint64 QSerialPort::readData(char *data, qint64 maxSize) { Q_D(QSerialPort); - return d->readData(data, maxSize); + + Q_UNUSED(data); + Q_UNUSED(maxSize); + +#ifdef Q_OS_WIN32 + // We need try to start async reading to read a remainder from a driver's queue + // in case we have a limited read buffer size. Because the read notification can + // be stalled since Windows do not re-triggered an EV_RXCHAR event if a driver's + // buffer has a remainder of data ready to read until a new data will be received. + if (d->readBufferMaxSize || d->flowControl == QSerialPort::HardwareControl) + d->startAsyncRead(); +#endif + + // return 0 indicating there may be more data in the future + return qint64(0); } /*! diff --git a/src/serialport/qserialport_p.h b/src/serialport/qserialport_p.h index 7da2204..9d634b1 100644 --- a/src/serialport/qserialport_p.h +++ b/src/serialport/qserialport_p.h @@ -133,8 +133,6 @@ public: bool sendBreak(int duration); bool setBreakEnabled(bool set); - qint64 readData(char *data, qint64 maxSize); - bool waitForReadyRead(int msec); bool waitForBytesWritten(int msec); diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 1f90a18..14180ec 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -372,11 +372,6 @@ bool QSerialPortPrivate::setBreakEnabled(bool set) return true; } -qint64 QSerialPortPrivate::readData(char *data, qint64 maxSize) -{ - return buffer.read(data, maxSize); -} - bool QSerialPortPrivate::waitForReadyRead(int msecs) { QElapsedTimer stopWatch; diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index e6e6924..5f4da9d 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -252,22 +252,6 @@ bool QSerialPortPrivate::setBreakEnabled(bool set) return true; } -qint64 QSerialPortPrivate::readData(char *data, qint64 maxSize) -{ - Q_UNUSED(data); - Q_UNUSED(maxSize); - - // We need try to start async reading to read a remainder from a driver's queue - // in case we have a limited read buffer size. Because the read notification can - // be stalled since Windows do not re-triggered an EV_RXCHAR event if a driver's - // buffer has a remainder of data ready to read until a new data will be received. - if (readBufferMaxSize || flowControl == QSerialPort::HardwareControl) - startAsyncRead(); - - // return 0 indicating there may be more data in the future - return qint64(0); -} - bool QSerialPortPrivate::waitForReadyRead(int msecs) { if (!writeStarted && !_q_startAsyncWrite()) diff --git a/src/serialport/qserialport_wince.cpp b/src/serialport/qserialport_wince.cpp index b8affb6..86cbcb0 100644 --- a/src/serialport/qserialport_wince.cpp +++ b/src/serialport/qserialport_wince.cpp @@ -329,11 +329,6 @@ bool QSerialPortPrivate::setBreakEnabled(bool set) return true; } -qint64 QSerialPortPrivate::readData(char *data, qint64 maxSize) -{ - return buffer.read(data, maxSize); -} - bool QSerialPortPrivate::waitForReadyRead(int msec) { if (!buffer.isEmpty()) |