diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2014-12-05 12:57:48 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2014-12-05 11:22:26 +0100 |
commit | 160efdbbf51c38ac973b0e36b98b72e2439f51e6 (patch) | |
tree | 15dfc04a499e297e138363d9c77d83e3c371977e | |
parent | 4484e56bbdd832c0ea8478034287ee183496a7bf (diff) | |
download | qtserialport-160efdbbf51c38ac973b0e36b98b72e2439f51e6.tar.gz |
Do not use internal pre-cached RTS and DTR variables
Some devices do not support these signals, and returns an errors when attempt
to query it. But the QSP::open() always requests a status of these lines.
In this case the QSP::open() will return true, but also will setup an error
code (for example, QSP::UnsupportedOperationError for socat's devices in
Linux). That is unexpected behavior for the user.
It is reasonable do not query a state of these signals when opening.
Also we do not need to use of appropriate internal variables, and we can
remove it.
Change-Id: I277110014c20c1f2c3fdaed20c4582d1356897b9
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
-rw-r--r-- | src/serialport/qserialport.cpp | 16 | ||||
-rw-r--r-- | src/serialport/qserialport_p.h | 2 |
2 files changed, 4 insertions, 14 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 5e838c0..0e60036 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -70,8 +70,6 @@ QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q) , stopBits(QSerialPort::OneStop) , flowControl(QSerialPort::NoFlowControl) , policy(QSerialPort::IgnorePolicy) - , dataTerminalReady(false) - , requestToSend(false) #if QT_DEPRECATED_SINCE(5,3) , settingsRestoredOnClose(true) #endif @@ -531,10 +529,6 @@ bool QSerialPort::open(OpenMode mode) } QIODevice::open(mode); - - d->dataTerminalReady = isDataTerminalReady(); - d->requestToSend = isRequestToSend(); - return true; } @@ -865,11 +859,10 @@ bool QSerialPort::setDataTerminalReady(bool set) return false; } + const bool dataTerminalReady = isDataTerminalReady(); const bool retval = d->setDataTerminalReady(set); - if (retval && (d->dataTerminalReady != set)) { - d->dataTerminalReady = set; + if (retval && (dataTerminalReady != set)) emit dataTerminalReadyChanged(set); - } return retval; } @@ -913,11 +906,10 @@ bool QSerialPort::setRequestToSend(bool set) return false; } + const bool requestToSend = isRequestToSend(); const bool retval = d->setRequestToSend(set); - if (retval && (d->requestToSend != set)) { - d->requestToSend = set; + if (retval && (requestToSend != set)) emit requestToSendChanged(set); - } return retval; } diff --git a/src/serialport/qserialport_p.h b/src/serialport/qserialport_p.h index 6f39260..578d8a9 100644 --- a/src/serialport/qserialport_p.h +++ b/src/serialport/qserialport_p.h @@ -75,8 +75,6 @@ public: QSerialPort::StopBits stopBits; QSerialPort::FlowControl flowControl; QSerialPort::DataErrorPolicy policy; - bool dataTerminalReady; - bool requestToSend; bool settingsRestoredOnClose; QSerialPort * const q_ptr; }; |