QCanBus Class | Qt Serial Bus 5.6

Qt Documentation (Technology Preview) | Qt Serial Bus | C++ Classes | QCanBus

Qt 5.6.2 Reference Documentation

# QCanBus Class

The QCanBus class handles registration and creation of bus backends. More...

Header: | #include <QCanBus>
qmake: | QT += serialbus
Since: | Qt 5.6
Inherits: | QObject

- List of all members, including inherited members

## Public Functions

QCanBusDevice * | createDevice(const QByteArray &plugin, const QString &interfaceName) const
QList<QByteArray> | plugins() const

- 31 public functions inherited from QObject

## Static Public Members

QCanBus * | instance()

- 10 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
- 1 public variable inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject

## Detailed Description

The QCanBus class handles registration and creation of bus backends.

QCanBus loads Qt CAN Bus plugins at runtime. The ownership of serial bus backends is transferred to the loader.

## Member Function Documentation

### QCanBusDevice *QCanBus::createDevice(const QByteArray &plugin, const QString &interfaceName) 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.

Ownership of the returned backend is transferred to the caller. Returns `nullptr` if no suitable device can be found.

### `[static]` QCanBus *QCanBus::instance()

Returns a pointer to the QCanBus class. The object is loaded if necessary. QCanBus uses the singleton design pattern.

### QList<QByteArray> QCanBus::plugins() const

Returns a list of identifiers for all loaded plugins.