summaryrefslogtreecommitdiff
path: root/src/serialport.cpp
diff options
context:
space:
mode:
authorkuzulis <scapig2@yandex.ru>2011-11-03 22:58:54 +0400
committerkuzulis <kuzulis@kuzulis.localdomain>2011-11-03 22:58:54 +0400
commita7a6766c0d2372134a4cfc6f405bd29e6788363b (patch)
tree7ff54f4c31b114ae9796bc03464ad60df2f4e323 /src/serialport.cpp
parent4806cf601483b1b35bac4c149134905fd18909ee (diff)
downloadqtserialport-a7a6766c0d2372134a4cfc6f405bd29e6788363b.tar.gz
*nix: SerialPort: revised mechanism for the preservation and restoration
of the port settings when opening/closing. Now, when you open the port settings are always saved. But when you close the port, you can specify: to restore the old settings or not. To do this, introduce new methods: void setRestoreSettingsOnClose(bool restore); bool restoreSettingsOnClose() const;
Diffstat (limited to 'src/serialport.cpp')
-rw-r--r--src/serialport.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/serialport.cpp b/src/serialport.cpp
index f4f5691..eba9e01 100644
--- a/src/serialport.cpp
+++ b/src/serialport.cpp
@@ -39,6 +39,7 @@ SerialPortPrivate::SerialPortPrivate(SerialPort *parent)
, m_flow(SerialPort::UnknownFlowControl)
, m_policy(SerialPort::IgnorePolicy)
, m_portError(SerialPort::NoError)
+ , m_restoreSettingsOnClose(true)
{
m_engine = SerialPortEngine::create(this);
Q_ASSERT(m_engine);
@@ -505,6 +506,18 @@ void SerialPort::close()
d->setError(SerialPort::DeviceIsNotOpenedError);
}
+void SerialPort::setRestoreSettingsOnClose(bool restore)
+{
+ Q_D( SerialPort);
+ d->m_restoreSettingsOnClose = restore;
+}
+
+bool SerialPort::restoreSettingsOnClose() const
+{
+ Q_D(const SerialPort);
+ return d->m_restoreSettingsOnClose;
+}
+
bool SerialPort::setRate(qint32 rate, Directions dir)
{
Q_D(SerialPort);