summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-08-25 16:12:17 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2015-08-27 14:36:50 +0000
commitd36bf099fcec17c19f42baea8ea313926544584b (patch)
tree08be3e752e3f40fa064e9de6d1236f57987ab7c7
parent5bb485ab2abe1503bded979fe0d9a376951e4164 (diff)
Add a skeleton for the PEAK-CAN documentation
Change-Id: Ia9b97cdc9a66c2b3fad40c2514096104d82de6db Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
-rw-r--r--src/serialbus/doc/src/peakcan.qdoc81
-rw-r--r--src/serialbus/doc/src/qtcanbus-backends.qdoc4
2 files changed, 85 insertions, 0 deletions
diff --git a/src/serialbus/doc/src/peakcan.qdoc b/src/serialbus/doc/src/peakcan.qdoc
new file mode 100644
index 0000000..2b79191
--- /dev/null
+++ b/src/serialbus/doc/src/peakcan.qdoc
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \page qtserialbus-peakcan-overview.html
+ \title Using PeakCAN Backend
+
+ \brief Overview of how to use the PeakCAN backend.
+
+ The PeakCAN backend encapsulates the low-level API to work with the
+ \l{http://www.peak-system.com/}{PCAN} adapters.
+
+ \section1 Creating CAN Bus Devices
+
+ At first it is necessary to check that QCanBus provides the desired backend:
+
+ \code
+ foreach (const QByteArray &backend, QCanBus::instance()->plugins()) {
+ if (backend == "peakcan") {
+ // were found
+ break;
+ }
+ }
+ \endcode
+
+ Where, \e peakcan is the backend name.
+
+ Further, it is necessary to request from QCanBus the device with the active PeakCan
+ interface:
+
+ \code
+ QCanBusDevice *device = QCanBus::createDevice("peakcan", QStringLiteral("usbbus1"));
+ device->connectDevice();
+ \endcode
+
+ Where, \e usbbus1 is the active CAN interface name. The PCAN API provides only eight
+ interfaces from \e usbbus1 to \e usbbus8.
+
+ Note: Only the USB adapters are supported currently by this backend.
+
+ The device is now open and can be written and read:
+
+ \code
+ QCanBusFrame frame;
+ frame.setFrameId(8);
+ QByteArray payload("A36E");
+ frame.setPayload(payload);
+ device->writeFrame(frame);
+ \endcode
+
+ The reading can be done using the \l {QCanBusDevice::}{readFrame()} method. The
+ \l {QCanBusDevice::}{frameReceived()} signal is emitted when a new frame is available
+ for reading:
+
+ \code
+ QCanBusFrame frame = device->readFrame();
+ \endcode
+ */
diff --git a/src/serialbus/doc/src/qtcanbus-backends.qdoc b/src/serialbus/doc/src/qtcanbus-backends.qdoc
index a912935..f8fc06d 100644
--- a/src/serialbus/doc/src/qtcanbus-backends.qdoc
+++ b/src/serialbus/doc/src/qtcanbus-backends.qdoc
@@ -55,5 +55,9 @@
\li CAN over Linux sockets
\li \l {Using SocketCAN Backend}{SocketCAN}
\li CAN bus backend using Linux sockets and open source drivers.
+ \row
+ \li PEAK-System
+ \li \l {Using PeakCAN Backend}{PeakCAN}
+ \li CAN bus backend using the PCAN adapters.
\endtable
*/