summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-30 11:51:51 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-30 11:51:51 +0200
commitb9a300b214f1c79dfed382403ae31f4bc0a8d52a (patch)
tree29b53a4a9ae40bac307b4b9ae8c760d26f4e8e3a
parent55ad040de1ac6a33b4f2efe29038e97e8d43dbc2 (diff)
parenteba0e3f243da949789871c3884c0ba158a3f6948 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
-rw-r--r--LICENSE.GPLv22
-rw-r--r--LICENSE.GPLv32
-rw-r--r--LICENSE.LGPLv32
-rw-r--r--dist/changes-5.7.030
-rw-r--r--examples/serialbus/can/connectdialog.cpp15
-rw-r--r--examples/serialbus/can/connectdialog.h1
-rw-r--r--examples/serialbus/can/mainwindow.cpp6
-rw-r--r--examples/serialbus/modbus/adueditor/plaintextedit.h2
-rw-r--r--src/serialbus/doc/src/examples/can.qdoc2
-rw-r--r--src/serialbus/qcanbus.cpp2
-rw-r--r--src/serialbus/qcanbusfactory.h3
-rw-r--r--src/serialbus/qcanbusframe.cpp2
-rw-r--r--src/serialbus/qmodbuspdu.cpp2
-rw-r--r--src/serialbus/qmodbusrtuserialmaster_p.h4
-rw-r--r--src/tools/canbusutil/canbusutil.cpp13
15 files changed, 65 insertions, 23 deletions
diff --git a/LICENSE.GPLv2 b/LICENSE.GPLv2
index 6dbb032..a424477 100644
--- a/LICENSE.GPLv2
+++ b/LICENSE.GPLv2
@@ -3,7 +3,7 @@
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ You may use, distribute and copy the Qt Toolkit under the terms of
GNU General Public License version 2, which is displayed below.
-------------------------------------------------------------------------
diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3
index 4e49b12..71c4ad4 100644
--- a/LICENSE.GPLv3
+++ b/LICENSE.GPLv3
@@ -3,7 +3,7 @@
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ You may use, distribute and copy the Qt Toolkit under the terms of
GNU Lesser General Public License version 3. That license references
the General Public License version 3, that is displayed below. Other
portions of the Qt Toolkit may be licensed directly under this license.
diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3
index 4d67bac..6bf924c 100644
--- a/LICENSE.LGPLv3
+++ b/LICENSE.LGPLv3
@@ -3,7 +3,7 @@
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
- You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ You may use, distribute and copy the Qt Toolkit under the terms of
GNU Lesser General Public License version 3, which is displayed below.
This license makes reference to the version 3 of the GNU General
Public License, which you can find in the LICENSE.GPLv3 file.
diff --git a/dist/changes-5.7.0 b/dist/changes-5.7.0
new file mode 100644
index 0000000..b7b28bd
--- /dev/null
+++ b/dist/changes-5.7.0
@@ -0,0 +1,30 @@
+QtSerialBus 5.7 introduces a few new features and improvements as well as
+bugfixes over the 5.6.x series. For more details, refer to the online
+documentation included in this distribution. The documentation is also available
+online:
+
+ http://doc.qt.io/qt-5/index.html
+
+The QtSerialBus version 5.7 series is binary compatible with the 5.6.x series.
+Applications compiled for 5.6 will continue to run with 5.7.
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+ http://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* Library *
+****************************************************************************
+
+QtSerialBus
+-----------
+
+ - Added Qt QtSerialBus as a new module to Qt 5.7 supporting CAN and Modbus
+ development
+ - Released the Qt SerialBus module as Technology Preview. This means that the
+ API may still change in subsequent releases.
+
diff --git a/examples/serialbus/can/connectdialog.cpp b/examples/serialbus/can/connectdialog.cpp
index ade06bb..a38d0d8 100644
--- a/examples/serialbus/can/connectdialog.cpp
+++ b/examples/serialbus/can/connectdialog.cpp
@@ -71,7 +71,8 @@ ConnectDialog::ConnectDialog(QWidget *parent) :
connect(m_ui->speedBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
this, &ConnectDialog::checkCustomSpeedPolicy);
-
+ connect(m_ui->backendListBox, &QComboBox::currentTextChanged,
+ this, &ConnectDialog::backendChanged);
m_ui->rawFilterEdit->hide();
m_ui->rawFilterLabel->hide();
@@ -102,6 +103,18 @@ void ConnectDialog::checkCustomSpeedPolicy(int idx)
}
}
+void ConnectDialog::backendChanged(const QString &backend)
+{
+ if (backend == QStringLiteral("generic"))
+ m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("can0"));
+ else if (backend == QStringLiteral("peakcan"))
+ m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("usbbus1"));
+ else if (backend == QStringLiteral("socketcan"))
+ m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("can0"));
+ else if (backend == QStringLiteral("tinycan"))
+ m_ui->interfaceNameEdit->setPlaceholderText(QStringLiteral("channela"));
+}
+
void ConnectDialog::ok()
{
updateSettings();
diff --git a/examples/serialbus/can/connectdialog.h b/examples/serialbus/can/connectdialog.h
index 11aa621..b7c4917 100644
--- a/examples/serialbus/can/connectdialog.h
+++ b/examples/serialbus/can/connectdialog.h
@@ -76,6 +76,7 @@ public:
private slots:
void checkCustomSpeedPolicy(int idx);
+ void backendChanged(const QString &backend);
void ok();
void cancel();
diff --git a/examples/serialbus/can/mainwindow.cpp b/examples/serialbus/can/mainwindow.cpp
index 26dead3..d3e3de8 100644
--- a/examples/serialbus/can/mainwindow.cpp
+++ b/examples/serialbus/can/mainwindow.cpp
@@ -116,7 +116,7 @@ void MainWindow::connectDevice()
m_canDevice = QCanBus::instance()->createDevice(p.backendName.toLocal8Bit(), p.deviceInterfaceName);
if (!m_canDevice) {
- showStatusMessage(tr("Connection error"));
+ showStatusMessage(tr("Error creating device: %1").arg(p.backendName));
return;
}
@@ -133,10 +133,10 @@ void MainWindow::connectDevice()
}
if (!m_canDevice->connectDevice()) {
+ showStatusMessage(tr("Connection error: %1").arg(m_canDevice->errorString()));
+
delete m_canDevice;
m_canDevice = nullptr;
-
- showStatusMessage(tr("Connection error"));
} else {
m_ui->actionConnect->setEnabled(false);
m_ui->actionDisconnect->setEnabled(true);
diff --git a/examples/serialbus/modbus/adueditor/plaintextedit.h b/examples/serialbus/modbus/adueditor/plaintextedit.h
index 1a0d8e3..8eeaf8f 100644
--- a/examples/serialbus/modbus/adueditor/plaintextedit.h
+++ b/examples/serialbus/modbus/adueditor/plaintextedit.h
@@ -72,7 +72,9 @@ public:
{
QMenu menu(this);
menu.addAction(QStringLiteral("Clear"), this, &QPlainTextEdit::clear);
+#ifndef QT_NO_CLIPBOARD
menu.addAction(QStringLiteral("Copy"), this, &QPlainTextEdit::copy, QKeySequence::Copy);
+#endif
menu.addSeparator();
menu.addAction(QStringLiteral("Select All"), this, &QPlainTextEdit::selectAll,
QKeySequence::SelectAll);
diff --git a/src/serialbus/doc/src/examples/can.qdoc b/src/serialbus/doc/src/examples/can.qdoc
index 0020823..4114735 100644
--- a/src/serialbus/doc/src/examples/can.qdoc
+++ b/src/serialbus/doc/src/examples/can.qdoc
@@ -28,7 +28,7 @@
/*! \example can
\title CAN Bus example
- \brief The example sends and received CAN bus frames.
+ \brief The example sends and receives CAN bus frames.
The example sends and receives CAN bus frames. Incoming frames
are ordered according to their type. A connect dialog is
diff --git a/src/serialbus/qcanbus.cpp b/src/serialbus/qcanbus.cpp
index d8f9d20..9909ab7 100644
--- a/src/serialbus/qcanbus.cpp
+++ b/src/serialbus/qcanbus.cpp
@@ -132,7 +132,7 @@ static void setErrorMessage(QString *result, const QString &message)
parameter errorMessage returns a textual error description.
Ownership of the returned backend is transferred to the caller.
- Returns \c null if no suitable device can be found.
+ Returns \c nullptr if no suitable device can be found.
*/
QCanBusDevice *QCanBus::createDevice(const QString &plugin, const QString &interfaceName,
QString *errorMessage) const
diff --git a/src/serialbus/qcanbusfactory.h b/src/serialbus/qcanbusfactory.h
index 169514c..4d391c1 100644
--- a/src/serialbus/qcanbusfactory.h
+++ b/src/serialbus/qcanbusfactory.h
@@ -52,8 +52,7 @@ protected:
virtual ~QCanBusFactory() {}
};
-Q_DECLARE_INTERFACE(QCanBusFactory,
- "org.qt-project.Qt.QCanBusFactory")
+Q_DECLARE_INTERFACE(QCanBusFactory, "org.qt-project.Qt.QCanBusFactory")
QT_END_NAMESPACE
diff --git a/src/serialbus/qcanbusframe.cpp b/src/serialbus/qcanbusframe.cpp
index 8c39dad..4de063b 100644
--- a/src/serialbus/qcanbusframe.cpp
+++ b/src/serialbus/qcanbusframe.cpp
@@ -345,7 +345,7 @@ QDataStream &operator>>(QDataStream &in, QCanBusFrame &frame)
frame.setFrameType(static_cast<QCanBusFrame::FrameType>(frameType));
frame.setExtendedFrameFormat(extendedFrameFormat);
- frame.setPayload(payload);
+ frame.setPayload(payload);
frame.setTimeStamp(QCanBusFrame::TimeStamp(seconds, microSeconds));
diff --git a/src/serialbus/qmodbuspdu.cpp b/src/serialbus/qmodbuspdu.cpp
index 7e09743..d6e1ef9 100644
--- a/src/serialbus/qmodbuspdu.cpp
+++ b/src/serialbus/qmodbuspdu.cpp
@@ -723,7 +723,7 @@ int QModbusResponse::calculateDataSize(const QModbusResponse &response)
if (response.dataSize() < minimum)
break; // can't calculate, let's return -1 to indicate error
- quint8 meiType;
+ quint8 meiType = 0;
response.decodeData(&meiType);
// update size, header 6 bytes: mei type + read device id + conformity level + more follows
diff --git a/src/serialbus/qmodbusrtuserialmaster_p.h b/src/serialbus/qmodbusrtuserialmaster_p.h
index 801072f..e7e9a92 100644
--- a/src/serialbus/qmodbusrtuserialmaster_p.h
+++ b/src/serialbus/qmodbusrtuserialmaster_p.h
@@ -291,9 +291,7 @@ public:
m_current.bytesWritten = 0;
m_current.numberOfRetries--;
m_serialPort->write(m_current.adu);
- // Example: 9600 baud, 11 bit per packet -> 872 char/sec
- // so: 1000 ms / 872 char = 1.147 ms/char * 3.5 character
- m_sendTimer.start((1000. / (qreal(m_baudRate) / 11.)) * m_current.adu.size());
+ m_sendTimer.start(m_interFrameDelayMilliseconds);
qCDebug(QT_MODBUS) << "(RTU client) Sent Serial PDU:" << m_current.requestPdu;
qCDebug(QT_MODBUS_LOW).noquote() << "(RTU client) Sent Serial ADU: 0x" + m_current.adu
diff --git a/src/tools/canbusutil/canbusutil.cpp b/src/tools/canbusutil/canbusutil.cpp
index 4fc2912..68dbab2 100644
--- a/src/tools/canbusutil/canbusutil.cpp
+++ b/src/tools/canbusutil/canbusutil.cpp
@@ -140,13 +140,9 @@ bool CanBusUtil::parseDataField(qint32 &id, QString &payload)
return false;
}
- id = data.left(hashMarkPos).toInt();
+ id = data.left(hashMarkPos).toInt(nullptr, 16);
payload = data.right(data.length() - hashMarkPos - 1);
- if (payload.size() == 0) {
- output << "Payload size zero!" << endl;
- printDataUsage();
- return false;
- }
+
return true;
}
@@ -156,7 +152,10 @@ bool CanBusUtil::parsePayloadField(QString payload, bool &rtrFrame,
fdFrame = false;
rtrFrame = false;
- if (payload[0].toUpper() == 'R') {
+ if (payload.size() == 0)
+ return true;
+
+ if (payload[0].toUpper() == 'R') {
rtrFrame = true;
bool validPayloadLength = false;
if (payload.size() > 1) {