summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2013-10-08 21:32:25 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-09 11:26:49 +0200
commit43f7c62509f71b16b263f4280ee55a350696ca00 (patch)
treeea3dc4478412bf00baef48d2d03ef459de4842b8
parentda0c6b10881781fa52920a1c2dc4fce5b7be8a5e (diff)
downloadqtserialport-43f7c62509f71b16b263f4280ee55a350696ca00.tar.gz
Add warnings to the methods requiring open serial port
Change-Id: I441dcc6c94c75ceada684262b7ab68b5c3471aec Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--src/serialport/qserialport.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 2242abf..04f2f9f 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -59,6 +59,8 @@
# define SERIALPORT_BUFFERSIZE 16384
#endif
+#include <QtCore/qdebug.h>
+
QT_BEGIN_NAMESPACE
QSerialPortPrivateData::QSerialPortPrivateData(QSerialPort *q)
@@ -495,6 +497,7 @@ void QSerialPort::close()
Q_D(QSerialPort);
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return;
}
@@ -566,6 +569,7 @@ bool QSerialPort::setBaudRate(qint32 baudRate, Directions directions)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -632,6 +636,7 @@ bool QSerialPort::setDataBits(DataBits dataBits)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -683,6 +688,7 @@ bool QSerialPort::setParity(Parity parity)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -733,6 +739,7 @@ bool QSerialPort::setStopBits(StopBits stopBits)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -783,6 +790,7 @@ bool QSerialPort::setFlowControl(FlowControl flow)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -834,6 +842,7 @@ bool QSerialPort::setDataTerminalReady(bool set)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -884,6 +893,7 @@ bool QSerialPort::setRequestToSend(bool set)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -936,6 +946,7 @@ QSerialPort::PinoutSignals QSerialPort::pinoutSignals()
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return QSerialPort::UnknownSignal;
}
@@ -965,6 +976,7 @@ bool QSerialPort::flush()
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -986,6 +998,7 @@ bool QSerialPort::clear(Directions directions)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -1045,6 +1058,7 @@ bool QSerialPort::setDataErrorPolicy(DataErrorPolicy policy)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -1261,6 +1275,7 @@ bool QSerialPort::sendBreak(int duration)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}
@@ -1284,6 +1299,7 @@ bool QSerialPort::setBreakEnabled(bool set)
if (!isOpen()) {
setError(QSerialPort::NotOpenError);
+ qWarning("%s: device not open", Q_FUNC_INFO);
return false;
}