summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LICENSE.GPLv22
-rw-r--r--LICENSE.GPLv32
-rw-r--r--LICENSE.LGPLv32
-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/tools/canbusutil/canbusutil.cpp13
13 files changed, 34 insertions, 20 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/examples/serialbus/can/connectdialog.cpp b/examples/serialbus/can/connectdialog.cpp
index 7495832..1c3ba43 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 7a46c86..f04f554 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 fe63911..a04a0f4 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 4fa7520..85b824f 100644
--- a/src/serialbus/qcanbus.cpp
+++ b/src/serialbus/qcanbus.cpp
@@ -120,7 +120,7 @@ QList<QByteArray> QCanBus::plugins() const
method. \a interfaceName is the CAN bus interface name.
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 QByteArray &plugin,
const QString &interfaceName) const
diff --git a/src/serialbus/qcanbusfactory.h b/src/serialbus/qcanbusfactory.h
index 450ebda..b143058 100644
--- a/src/serialbus/qcanbusfactory.h
+++ b/src/serialbus/qcanbusfactory.h
@@ -51,8 +51,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 46498a3..105bf8b 100644
--- a/src/serialbus/qcanbusframe.cpp
+++ b/src/serialbus/qcanbusframe.cpp
@@ -320,7 +320,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/tools/canbusutil/canbusutil.cpp b/src/tools/canbusutil/canbusutil.cpp
index 8f70f07..8421caf 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) {