diff options
Diffstat (limited to 'src/serialbus/doc/src/vectorcan.qdoc')
-rw-r--r-- | src/serialbus/doc/src/vectorcan.qdoc | 13 |
1 files changed, 10 insertions, 3 deletions
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: |