diff options
-rw-r--r-- | dist/changes-5.9.0 | 61 | ||||
-rw-r--r-- | examples/serialbus/can/bitratebox.h | 2 | ||||
-rw-r--r-- | examples/serialbus/can/mainwindow.cpp | 4 | ||||
-rw-r--r-- | examples/serialbus/can/mainwindow.ui | 9 | ||||
-rw-r--r-- | src/plugins/canbus/peakcan/peakcan.pro | 2 | ||||
-rw-r--r-- | src/plugins/canbus/socketcan/socketcan.pro | 2 | ||||
-rw-r--r-- | src/plugins/canbus/systeccan/systeccan.pro | 2 | ||||
-rw-r--r-- | src/plugins/canbus/tinycan/tinycan.pro | 2 | ||||
-rw-r--r-- | src/plugins/canbus/vectorcan/vectorcan.pro | 2 | ||||
-rw-r--r-- | src/plugins/canbus/vectorcan/vectorcanbackend.cpp | 21 | ||||
-rw-r--r-- | src/serialbus/doc/src/peakcan.qdoc | 7 | ||||
-rw-r--r-- | src/serialbus/doc/src/socketcan.qdoc | 3 | ||||
-rw-r--r-- | src/serialbus/doc/src/systeccan.qdoc | 3 | ||||
-rw-r--r-- | src/serialbus/doc/src/vectorcan.qdoc | 3 | ||||
-rw-r--r-- | src/serialbus/qcanbusdevice.cpp | 10 | ||||
-rw-r--r-- | src/serialbus/qcanbusdeviceinfo.cpp | 30 | ||||
-rw-r--r-- | src/serialbus/qcanbusdeviceinfo.h | 3 | ||||
-rw-r--r-- | src/tools/tools.pro | 2 | ||||
-rw-r--r-- | tests/auto/qcanbusframe/tst_qcanbusframe.cpp | 26 |
19 files changed, 139 insertions, 55 deletions
diff --git a/dist/changes-5.9.0 b/dist/changes-5.9.0 new file mode 100644 index 0000000..64e01c5 --- /dev/null +++ b/dist/changes-5.9.0 @@ -0,0 +1,61 @@ +Qt 5.9 introduces many new features and improvements as well as bugfixes +over the 5.8.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 Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Library * +**************************************************************************** + +QtSerialBus +----------- + + - QCanBusDevice + * [QTBUG-57658] Added buffering details in QCanBusDevice::framesToWrite + documentation. + * Added QCanBusDevice::DataBitRateKey enum. + + - QCanBusFrame + * [QTBUG-56720] Introduced flag to allow data bitrate switching for CAN FD + frames. Reference implementation is done for the SocketCAN plugin. + * Added error state indicator flag to QCanBusFrame and set it appropriate + for received CAN FD frames with the SocketCAN plugin. Setting this flag + for testing purposes is also possible. + + - QCanBus + * [QTBUG-54298] Added the new class QCanBusDeviceInfo for enumeration of + available CAN interfaces and more information about them. + * Added a new SystecCAN plugin for Windows support of CAN adapters from + http://www.systec-electronic.com. + + - Modified the PeakCAN plugin such that it supports up to 16 USB and + 16 PCI CAN channels. + + - VectorCAN: + * Fixed a crash when device open fails because no device drivers are + installed. + * [QTBUG-58774] Fixed that 64 bit builds need to load vxlapi64.dll. + * [QTBUG-58840] Fixed that received frames with an extended ID are + received with ID 0 and marked as invalid. + * [QTBUG-59037] Fixed receiving a transmit echo for all sent frames by + adding the QCanBusDevice::ReceiveOwnKey configuration. + + - [QTBUG-59050] Fixed that QModbusRtuSerialMaster did not close the + serial port on disconnect. + - Added code improvements and cleanups throughout the module's examples. + - [QTBUG-55045] Improved error handling code throughout all CAN plugins. + - Improved canbusutil output formatting and detail level. + - Fixed module build when Qt was configured with various -no-feature-xyz + options. diff --git a/examples/serialbus/can/bitratebox.h b/examples/serialbus/can/bitratebox.h index e9df635..42bbb2d 100644 --- a/examples/serialbus/can/bitratebox.h +++ b/examples/serialbus/can/bitratebox.h @@ -43,7 +43,9 @@ #include <QComboBox> +QT_BEGIN_NAMESPACE class QIntValidator; +QT_END_NAMESPACE class BitRateBox : public QComboBox { diff --git a/examples/serialbus/can/mainwindow.cpp b/examples/serialbus/can/mainwindow.cpp index f950938..19ed560 100644 --- a/examples/serialbus/can/mainwindow.cpp +++ b/examples/serialbus/can/mainwindow.cpp @@ -45,6 +45,7 @@ #include <QCanBus> #include <QCanBusFrame> #include <QCloseEvent> +#include <QDesktopServices> #include <QtDebug> #include <QTimer> @@ -92,6 +93,9 @@ void MainWindow::initActionsConnections() connect(m_ui->actionQuit, &QAction::triggered, this, &QWidget::close); connect(m_ui->actionAboutQt, &QAction::triggered, qApp, &QApplication::aboutQt); connect(m_ui->actionClearLog, &QAction::triggered, m_ui->receivedMessagesEdit, &QTextEdit::clear); + connect(m_ui->actionPluginDocumentation, &QAction::triggered, this, []() { + QDesktopServices::openUrl(QUrl("http://doc.qt.io/qt-5/qtcanbus-backends.html#can-bus-plugins")); + }); } void MainWindow::receiveError(QCanBusDevice::CanBusError error) const diff --git a/examples/serialbus/can/mainwindow.ui b/examples/serialbus/can/mainwindow.ui index 72dc62b..04f8c93 100644 --- a/examples/serialbus/can/mainwindow.ui +++ b/examples/serialbus/can/mainwindow.ui @@ -206,6 +206,7 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> <property name="title"> <string>&Help</string> </property> + <addaction name="actionPluginDocumentation"/> <addaction name="actionAboutQt"/> </widget> <addaction name="menuCalls"/> @@ -265,6 +266,14 @@ Otherwise, the standard format with 11 bit idenfier is used.</string> <string>Clear &Log</string> </property> </action> + <action name="actionPluginDocumentation"> + <property name="text"> + <string>Plugin Documentation</string> + </property> + <property name="toolTip"> + <string>Open plugin documentation in Webbrowser</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources> diff --git a/src/plugins/canbus/peakcan/peakcan.pro b/src/plugins/canbus/peakcan/peakcan.pro index bcea9ac..9f9a2de 100644 --- a/src/plugins/canbus/peakcan/peakcan.pro +++ b/src/plugins/canbus/peakcan/peakcan.pro @@ -1,6 +1,6 @@ TARGET = qtpeakcanbus -QT = core-private serialbus +QT = core serialbus HEADERS += \ peakcanbackend.h \ diff --git a/src/plugins/canbus/socketcan/socketcan.pro b/src/plugins/canbus/socketcan/socketcan.pro index 6a5504f..a4874b0 100644 --- a/src/plugins/canbus/socketcan/socketcan.pro +++ b/src/plugins/canbus/socketcan/socketcan.pro @@ -1,6 +1,6 @@ TARGET = qtsocketcanbus -QT = core-private serialbus +QT = core serialbus HEADERS += \ socketcanbackend.h diff --git a/src/plugins/canbus/systeccan/systeccan.pro b/src/plugins/canbus/systeccan/systeccan.pro index 06d5537..f1c2180 100644 --- a/src/plugins/canbus/systeccan/systeccan.pro +++ b/src/plugins/canbus/systeccan/systeccan.pro @@ -1,6 +1,6 @@ TARGET = qtsysteccanbus -QT = core-private serialbus +QT = core serialbus HEADERS += \ systeccanbackend.h \ diff --git a/src/plugins/canbus/tinycan/tinycan.pro b/src/plugins/canbus/tinycan/tinycan.pro index ab6a58b..c0aa948 100644 --- a/src/plugins/canbus/tinycan/tinycan.pro +++ b/src/plugins/canbus/tinycan/tinycan.pro @@ -1,6 +1,6 @@ TARGET = qttinycanbus -QT = core-private serialbus +QT = core serialbus HEADERS += \ tinycanbackend.h \ diff --git a/src/plugins/canbus/vectorcan/vectorcan.pro b/src/plugins/canbus/vectorcan/vectorcan.pro index a43c061..b22492b 100644 --- a/src/plugins/canbus/vectorcan/vectorcan.pro +++ b/src/plugins/canbus/vectorcan/vectorcan.pro @@ -1,6 +1,6 @@ TARGET = qtvectorcanbus -QT = core-private serialbus +QT = core serialbus HEADERS += \ vectorcanbackend.h \ diff --git a/src/plugins/canbus/vectorcan/vectorcanbackend.cpp b/src/plugins/canbus/vectorcan/vectorcanbackend.cpp index 47662a6..6c455da 100644 --- a/src/plugins/canbus/vectorcan/vectorcanbackend.cpp +++ b/src/plugins/canbus/vectorcan/vectorcanbackend.cpp @@ -170,8 +170,8 @@ bool VectorCanBackendPrivate::open() XL_INTERFACE_VERSION, XL_BUS_TYPE_CAN); if (Q_UNLIKELY(status != XL_SUCCESS || portHandle == XL_INVALID_PORTHANDLE)) { - q->setError(systemErrorString(status), - QCanBusDevice::ConnectionError); + q->setError(systemErrorString(status), QCanBusDevice::ConnectionError); + portHandle = XL_INVALID_PORTHANDLE; return false; } } @@ -180,8 +180,7 @@ bool VectorCanBackendPrivate::open() const XLstatus status = ::xlActivateChannel(portHandle, channelMask, XL_BUS_TYPE_CAN, XL_ACTIVATE_RESET_CLOCK); if (Q_UNLIKELY(status != XL_SUCCESS)) { - q->setError(systemErrorString(status), - QCanBusDevice::CanBusError::ConnectionError); + q->setError(systemErrorString(status), QCanBusDevice::CanBusError::ConnectionError); return false; } } @@ -190,8 +189,7 @@ bool VectorCanBackendPrivate::open() const int queueLevel = 1; const XLstatus status = ::xlSetNotification(portHandle, &readHandle, queueLevel); if (Q_UNLIKELY(status != XL_SUCCESS)) { - q->setError(systemErrorString(status), - QCanBusDevice::ConnectionError); + q->setError(systemErrorString(status), QCanBusDevice::ConnectionError); return false; } } @@ -214,19 +212,22 @@ void VectorCanBackendPrivate::close() delete writeNotifier; writeNotifier = nullptr; + // xlClosePort can crash on systems with vxlapi.dll but no device driver installed. + // Therefore avoid calling any close function when the portHandle is invalid anyway. + if (portHandle == XL_INVALID_PORTHANDLE) + return; + { const XLstatus status = ::xlDeactivateChannel(portHandle, channelMask); if (Q_UNLIKELY(status != XL_SUCCESS)) { - q->setError(systemErrorString(status), - QCanBusDevice::CanBusError::ConfigurationError); + q->setError(systemErrorString(status), QCanBusDevice::CanBusError::ConnectionError); } } { const XLstatus status = ::xlClosePort(portHandle); if (Q_UNLIKELY(status != XL_SUCCESS)) { - q->setError(systemErrorString(status), - QCanBusDevice::ConnectionError); + q->setError(systemErrorString(status), QCanBusDevice::ConnectionError); } } diff --git a/src/serialbus/doc/src/peakcan.qdoc b/src/serialbus/doc/src/peakcan.qdoc index d47d776..490d832 100644 --- a/src/serialbus/doc/src/peakcan.qdoc +++ b/src/serialbus/doc/src/peakcan.qdoc @@ -33,6 +33,9 @@ The PeakCAN plugin encapsulates the low-level API to work with the \l{http://www.peak-system.com/}{PEAK-System} CAN adapters. + This plugin requires the PCAN device drivers and the pcanbasic library + (pcanbasic.dll under Windows). + \section1 Creating CAN Bus Devices At first it is necessary to check that QCanBus provides the desired plugin: @@ -54,8 +57,8 @@ \endcode Where \e usb0 is the active CAN interface name. The PeakCAN plugin supports - eight USB interfaces from \e usb0 to \e usb7 and eight PCI interfaces from - \e pci0 to \e pci7. + 16 USB interfaces from \e usb0 to \e usb15 and 16 PCI interfaces from + \e pci0 to \e pci15. \note Only the USB and PCI adapters are currently supported by this plugin. diff --git a/src/serialbus/doc/src/socketcan.qdoc b/src/serialbus/doc/src/socketcan.qdoc index 74a8dab..12f96fd 100644 --- a/src/serialbus/doc/src/socketcan.qdoc +++ b/src/serialbus/doc/src/socketcan.qdoc @@ -34,6 +34,9 @@ This API is a set of open source CAN drivers and a networking stack contributed by Volkswagen Research to the Linux kernel. + This plugin requires a Linux Kernel with SocketCAN support and SocketCAN device + drivers for the used CAN hardware. + \section1 SocketCAN usage To list all (including unconfigured) network interfaces, the command diff --git a/src/serialbus/doc/src/systeccan.qdoc b/src/serialbus/doc/src/systeccan.qdoc index 08ecfce..dda9dd5 100644 --- a/src/serialbus/doc/src/systeccan.qdoc +++ b/src/serialbus/doc/src/systeccan.qdoc @@ -33,6 +33,9 @@ The SystecCAN backend encapsulates the low-level API to work with the \l{http://www.systec-electronic.com/}{SYS TEC} CAN adapters. + This plugin requires the SYS TEC CAN device drivers and the usbcan32.dll + (usbcan64.dll for 64 bit builds). + \section1 Creating CAN Bus Devices At first it is necessary to check that QCanBus provides the desired backend: diff --git a/src/serialbus/doc/src/vectorcan.qdoc b/src/serialbus/doc/src/vectorcan.qdoc index f95f956..5b95a83 100644 --- a/src/serialbus/doc/src/vectorcan.qdoc +++ b/src/serialbus/doc/src/vectorcan.qdoc @@ -33,6 +33,9 @@ The VectorCAN plugin encapsulates the low-level API to work with the \l{http://www.vector.com/}{Vector Informatik} CAN adapters. + This plugin requires the Vector CAN device drivers and the vxlapi.dll + (vxlapi64.dll for 64 bit builds). + \section1 Creating CAN Bus Devices At first it is necessary to check that QCanBus provides the desired plugin: diff --git a/src/serialbus/qcanbusdevice.cpp b/src/serialbus/qcanbusdevice.cpp index 70778a7..f613f0a 100644 --- a/src/serialbus/qcanbusdevice.cpp +++ b/src/serialbus/qcanbusdevice.cpp @@ -717,11 +717,11 @@ void QCanBusDevice::setState(QCanBusDevice::CanBusDeviceState newState) QCanBusDeviceInfo QCanBusDevice::createDeviceInfo(const QString &name, bool isVirtual, bool isFlexibleDataRateCapable) { - QCanBusDeviceInfoPrivate info; - info.name = name; - info.isVirtual = isVirtual; - info.hasFlexibleDataRate = isFlexibleDataRateCapable; - return QCanBusDeviceInfo(info); + QScopedPointer<QCanBusDeviceInfoPrivate> info(new QCanBusDeviceInfoPrivate); + info->name = name; + info->isVirtual = isVirtual; + info->hasFlexibleDataRate = isFlexibleDataRateCapable; + return QCanBusDeviceInfo(*info.take()); } QT_END_NAMESPACE diff --git a/src/serialbus/qcanbusdeviceinfo.cpp b/src/serialbus/qcanbusdeviceinfo.cpp index fac1e9f..30b0e12 100644 --- a/src/serialbus/qcanbusdeviceinfo.cpp +++ b/src/serialbus/qcanbusdeviceinfo.cpp @@ -51,36 +51,23 @@ QT_BEGIN_NAMESPACE */ /*! - Constructs an empty QCanBusDeviceInfo. -*/ -QCanBusDeviceInfo::QCanBusDeviceInfo() : - d_ptr(new QCanBusDeviceInfoPrivate) -{ -} - -/*! Constructs a copy of \a other. */ -QCanBusDeviceInfo::QCanBusDeviceInfo(const QCanBusDeviceInfo &other) : - d_ptr(other.d_ptr) -{ -} +QCanBusDeviceInfo::QCanBusDeviceInfo(const QCanBusDeviceInfo &) = default; /*! Constructs a CAN bus device info from QCanBusDeviceInfoPrivate \a dd. \internal */ QCanBusDeviceInfo::QCanBusDeviceInfo(QCanBusDeviceInfoPrivate &dd) : - d_ptr(new QCanBusDeviceInfoPrivate(dd)) + d_ptr(&dd) { } /*! Destroys the CAN bus device info. */ -QCanBusDeviceInfo::~QCanBusDeviceInfo() -{ -} +QCanBusDeviceInfo::~QCanBusDeviceInfo() = default; /*! \fn void QCanBusDeviceInfo::swap(QCanBusDeviceInfo &other) @@ -88,16 +75,17 @@ QCanBusDeviceInfo::~QCanBusDeviceInfo() and never fails. */ +/*! + \fn QCanBusDeviceInfo &QCanBusDeviceInfo::operator=(QCanBusDeviceInfo &&other) + + Move-assigns other to this QCanBusDeviceInfo instance. +*/ /*! Assigns \a other to this CAN bus device info and returns a reference to this CAN bus device info. */ -QCanBusDeviceInfo &QCanBusDeviceInfo::operator=(const QCanBusDeviceInfo &other) -{ - QCanBusDeviceInfo(other).swap(*this); - return *this; -} +QCanBusDeviceInfo &QCanBusDeviceInfo::operator=(const QCanBusDeviceInfo &) = default; /*! Returns the interface name of this CAN bus interface, e.g. can0. diff --git a/src/serialbus/qcanbusdeviceinfo.h b/src/serialbus/qcanbusdeviceinfo.h index b21a4b3..68b68a3 100644 --- a/src/serialbus/qcanbusdeviceinfo.h +++ b/src/serialbus/qcanbusdeviceinfo.h @@ -44,12 +44,11 @@ QT_BEGIN_NAMESPACE class QCanBusDeviceInfoPrivate; -class QCanBusDeviceInfoPrivateDeleter; class Q_SERIALBUS_EXPORT QCanBusDeviceInfo { public: - QCanBusDeviceInfo(); + QCanBusDeviceInfo() = delete; QCanBusDeviceInfo(const QCanBusDeviceInfo &other); ~QCanBusDeviceInfo(); diff --git a/src/tools/tools.pro b/src/tools/tools.pro index 1e278da..72d34fb 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs -!android|android_app: SUBDIRS += canbusutil +qtConfig(commandlineparser):!android|android_app: SUBDIRS += canbusutil diff --git a/tests/auto/qcanbusframe/tst_qcanbusframe.cpp b/tests/auto/qcanbusframe/tst_qcanbusframe.cpp index b67b6f8..043d89e 100644 --- a/tests/auto/qcanbusframe/tst_qcanbusframe.cpp +++ b/tests/auto/qcanbusframe/tst_qcanbusframe.cpp @@ -431,36 +431,40 @@ void tst_QCanBusFrame::streaming_data() QTest::addColumn<bool>("isExtended"); QTest::addColumn<bool>("isFlexibleDataRate"); QTest::addColumn<bool>("isBitrateSwitch"); + QTest::addColumn<bool>("isErrorStateIndicator"); QTest::addColumn<QCanBusFrame::FrameType>("frameType"); QTest::newRow("emptyFrame") << quint32(0) << QByteArray() << qint64(0) << qint64(0) - << false << false << false << QCanBusFrame::DataFrame; + << false << false << false << false << QCanBusFrame::DataFrame; QTest::newRow("fullFrame1") << quint32(123) << QByteArray("abcde1") << qint64(456) << qint64(784) - << true << false << false << QCanBusFrame::DataFrame; + << true << false << false << false << QCanBusFrame::DataFrame; QTest::newRow("fullFrame2") << quint32(123) << QByteArray("abcde2") << qint64(457) << qint64(785) - << false << false << false << QCanBusFrame::DataFrame; + << false << false << false << false << QCanBusFrame::DataFrame; QTest::newRow("fullFrameFD") << quint32(123) << QByteArray("abcdfd") << qint64(457) << qint64(785) - << false << true << false << QCanBusFrame::DataFrame; + << false << true << false << false << QCanBusFrame::DataFrame; QTest::newRow("fullFrameBRS") << quint32(123) << QByteArray("abcdfd") << qint64(457) << qint64(785) - << false << true << true << QCanBusFrame::DataFrame; + << false << true << true << false << QCanBusFrame::DataFrame; + QTest::newRow("fullFrameESI") << quint32(123) << QByteArray("abcdfd") + << qint64(457) << qint64(785) + << false << true << false << true << QCanBusFrame::DataFrame; QTest::newRow("fullFrame3") << quint32(123) << QByteArray("abcde3") << qint64(458) << qint64(786) - << true << false << false << QCanBusFrame::RemoteRequestFrame; + << true << false << false << false << QCanBusFrame::RemoteRequestFrame; QTest::newRow("fullFrame4") << quint32(123) << QByteArray("abcde4") << qint64(459) << qint64(787) - << false << false << false << QCanBusFrame::RemoteRequestFrame; + << false << false << false << false << QCanBusFrame::RemoteRequestFrame; QTest::newRow("fullFrame5") << quint32(123) << QByteArray("abcde5") << qint64(460) << qint64(789) - << true << false << false << QCanBusFrame::ErrorFrame; + << true << false << false << false << QCanBusFrame::ErrorFrame; QTest::newRow("fullFrame6") << quint32(123) << QByteArray("abcde6") << qint64(453) << qint64(788) - << false << false << false << QCanBusFrame::ErrorFrame; + << false << false << false << false << QCanBusFrame::ErrorFrame; } void tst_QCanBusFrame::streaming() @@ -472,6 +476,7 @@ void tst_QCanBusFrame::streaming() QFETCH(bool, isExtended); QFETCH(bool, isFlexibleDataRate); QFETCH(bool, isBitrateSwitch); + QFETCH(bool, isErrorStateIndicator); QFETCH(QCanBusFrame::FrameType, frameType); QCanBusFrame originalFrame(frameId, payload); @@ -481,6 +486,7 @@ void tst_QCanBusFrame::streaming() originalFrame.setExtendedFrameFormat(isExtended); originalFrame.setFlexibleDataRateFormat(isFlexibleDataRate); originalFrame.setBitrateSwitch(isBitrateSwitch); + originalFrame.setErrorStateIndicator(isErrorStateIndicator); originalFrame.setFrameType(frameType); QByteArray buffer; @@ -505,6 +511,8 @@ void tst_QCanBusFrame::streaming() originalFrame.hasFlexibleDataRateFormat()); QCOMPARE(restoredFrame.hasBitrateSwitch(), originalFrame.hasBitrateSwitch()); + QCOMPARE(restoredFrame.hasErrorStateIndicator(), + originalFrame.hasErrorStateIndicator()); } void tst_QCanBusFrame::tst_error() |