summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-08-17 09:10:32 +0200
committerLiang Qi <liang.qi@qt.io>2018-08-17 09:10:32 +0200
commit9f5b14b06775e91ac65dc3c0b0ea3a54235a93a2 (patch)
tree2a0ec88c1b2006dbb152d521041293f58ff8009f
parent34d346c161bf89a6a98d4782627a5c4f12271bde (diff)
parent23a4f70d26ac2c74e695a0138eb1d766918973bb (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/serialbus/doc/src/peakcan.qdoc Change-Id: I2fe21e838d2da73b2b9c4d1c98752f48f003706a
-rw-r--r--src/serialbus/doc/src/passthrucan.qdoc10
-rw-r--r--src/serialbus/doc/src/peakcan.qdoc13
-rw-r--r--src/serialbus/doc/src/socketcan.qdoc12
-rw-r--r--src/serialbus/doc/src/systeccan.qdoc28
-rw-r--r--src/serialbus/doc/src/vectorcan.qdoc13
5 files changed, 55 insertions, 21 deletions
diff --git a/src/serialbus/doc/src/passthrucan.qdoc b/src/serialbus/doc/src/passthrucan.qdoc
index 21e6283..eff2ef7 100644
--- a/src/serialbus/doc/src/passthrucan.qdoc
+++ b/src/serialbus/doc/src/passthrucan.qdoc
@@ -99,9 +99,13 @@
signal:
\code
- connect(device, &QCanBusDevice::stateChanged,
- this, &MyClass::canStateChanged);
- device->connectDevice();
+ if (!device) {
+ // Error handling goes here
+ } else {
+ connect(device, &QCanBusDevice::stateChanged,
+ this, &MyClass::canStateChanged);
+ device->connectDevice();
+ }
\endcode
\l {QCanBusDevice::}{state()} will return \l {QCanBusDevice::}{ConnectedState}
diff --git a/src/serialbus/doc/src/peakcan.qdoc b/src/serialbus/doc/src/peakcan.qdoc
index 26fc188..c8f52c9 100644
--- a/src/serialbus/doc/src/peakcan.qdoc
+++ b/src/serialbus/doc/src/peakcan.qdoc
@@ -52,14 +52,21 @@
Next, a connection to a specific interface can be established:
\code
+ QString errorString;
QCanBusDevice *device = QCanBus::instance()->createDevice(
- QStringLiteral("peakcan"), QStringLiteral("usb0"));
- device->connectDevice();
+ QStringLiteral("peakcan"), QStringLiteral("usb0"), &errorString);
+ if (!device) {
+ // Error handling goes here
+ qDebug << errorString;
+ } else {
+ device->connectDevice();
+ }
\endcode
Where \e usb0 is the active CAN interface name. The PeakCAN plugin supports
16 USB interfaces from \e usb0 to \e usb15 and 16 PCI interfaces from
- \e pci0 to \e pci15.
+ \e pci0 to \e pci15. The \l {QCanBus::}{availableDevices()} method returns a
+ list of currently available devices.
\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 a7cac9f..df58dae 100644
--- a/src/serialbus/doc/src/socketcan.qdoc
+++ b/src/serialbus/doc/src/socketcan.qdoc
@@ -111,13 +111,21 @@
Next, a connection to a specific interface can be established:
\code
+ QString errorString;
QCanBusDevice *device = QCanBus::instance()->createDevice(
- QStringLiteral("socketcan"), QStringLiteral("can0"));
- device->connectDevice();
+ QStringLiteral("socketcan"), QStringLiteral("can0"), &errorString);
+ if (!device) {
+ // Error handling goes here
+ qDebug << errorString;
+ } else {
+ device->connectDevice();
+ }
\endcode
Where \e can0 is the active CAN interface name. CAN interfaces act like regular
network interfaces on Linux systems and can be discovered using \c ifconfig.
+ Also, the \l {QCanBus::}{availableDevices()} method returns a list of currently
+ available devices.
The device is now open for writing and reading CAN frames:
diff --git a/src/serialbus/doc/src/systeccan.qdoc b/src/serialbus/doc/src/systeccan.qdoc
index bd8ee61..af34665 100644
--- a/src/serialbus/doc/src/systeccan.qdoc
+++ b/src/serialbus/doc/src/systeccan.qdoc
@@ -26,11 +26,11 @@
****************************************************************************/
/*!
\page qtserialbus-SystecCAN-overview.html
- \title Using SystecCAN Backend
+ \title Using SystecCAN Plugin
- \brief Overview of how to use the SystecCAN backend.
+ \brief Overview of how to use the SystecCAN plugin.
- The SystecCAN backend encapsulates the low-level API to work with the
+ The SystecCAN plugin 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
@@ -38,28 +38,36 @@
\section1 Creating CAN Bus Devices
- At first it is necessary to check that QCanBus provides the desired backend:
+ At first it is necessary to check that QCanBus provides the desired plugin:
\code
if (QCanBus::instance()->plugins().contains(QStringLiteral("systeccan"))) {
- // backend available
+ // plugin available
}
\endcode
- Where \e systeccan is the backend name.
+ Where \e systeccan is the plugin name.
Next, a connection to a specific interface can be established:
\code
+ QString errorString;
QCanBusDevice *device = QCanBus::instance()->createDevice(
- QStringLiteral("systeccan"), QStringLiteral("can0.0"));
- device->connectDevice();
+ QStringLiteral("systeccan"), QStringLiteral("can0.0"), &errorString);
+ if (!device) {
+ // Error handling goes here
+ qDebug << errorString;
+ } else {
+ device->connectDevice();
+ }
+
\endcode
Where, \e can0.0 is the active CAN interface name (interface 0, channel 0).
- The SystecCAN backend supports 64 USB interfaces (so called modules) from
+ The SystecCAN plugin supports 64 USB interfaces (so called modules) from
\e can0.0 to \e can63.1. Each module can have one or two channels, they can
- be accessed by the index canX.0 or canX.1.
+ be accessed by the index canX.0 or canX.1. The \l {QCanBus::}{availableDevices()}
+ method returns a list of currently available devices.
\note SYS TEC also provides 8 or 16 channel CAN interfaces. These units
consist of an USB hub and multiple two-channel modules internally.
diff --git a/src/serialbus/doc/src/vectorcan.qdoc b/src/serialbus/doc/src/vectorcan.qdoc
index 5b23c8e..eb4acdd 100644
--- a/src/serialbus/doc/src/vectorcan.qdoc
+++ b/src/serialbus/doc/src/vectorcan.qdoc
@@ -51,9 +51,15 @@
Next, a connection to a specific interface can be established:
\code
+ QString errorString;
QCanBusDevice *device = QCanBus::instance()->createDevice(
- QStringLiteral("vectorcan"), QStringLiteral("can0"));
- device->connectDevice();
+ QStringLiteral("vectorcan"), QStringLiteral("can0"), &errorString);
+ if (!device) {
+ // Error handling goes here
+ qDebug << errorString;
+ } else {
+ device->connectDevice();
+ }
\endcode
Where \e can0 is the active CAN channel name. The VectorCAN plugin provides
@@ -61,7 +67,8 @@
to \e can63. Some of these channels can be virtual, and therefore can be used
without actual CAN hardware. To find out the virtual channels, the program
"Vector Hardware Config" (vcanconf.exe) can be used, which is included in
- Vector's driver package.
+ Vector's driver package. The \l {QCanBus::}{availableDevices()} method returns
+ a list of currently available devices.
The device is now open for writing and reading CAN frames: