|qmake:||QT += serialbus|
|QCanBusDevice *||createDevice(const QString &plugin, const QString &interfaceName, QString *errorMessage = nullptr) const|
- 31 public functions inherited from QObject
Static Public Members
- 11 static public members inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 2 signals inherited from QObject
- 9 protected functions inherited from QObject
The QCanBus class handles registration and creation of bus plugins.
QCanBus loads Qt CAN Bus plugins at runtime. The ownership of serial bus plugins is transferred to the loader.
Member Function Documentation
QCanBusDevice *QCanBus::createDevice(const QString &plugin, const QString &interfaceName, QString *errorMessage = nullptr) const
Creates a CAN bus device. plugin is the name of the plugin as returned by the plugins() method. interfaceName is the CAN bus interface name. In case of failure, the optional parameter errorMessage returns a textual error description.
Ownership of the returned plugin is transferred to the caller. Returns
nullptr if no suitable device can be found.
For example, the following call would connect to the SocketCAN interface vcan0:
QCanBusDevice *device = QCanBus::instance()->createDevice( QStringLiteral("socketcan"), QStringLiteral("vcan0")); device->connectDevice();
Note: The interfaceName is plugin-dependent. See the corresponding plugin documentation for more information: CAN Bus Plugins.
QStringList QCanBus::plugins() const
Returns a list of identifiers for all loaded plugins.
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.