QCanBusFactory 类

QCanBusFactory 类是用作 CAN Bus 插件的插件接口的工厂类。 更多...

头: #include <QCanBusFactory>
CMake: find_package(Qt6 REQUIRED COMPONENTS SerialBus)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmake: QT += serialbus

公共函数

virtual QList<QCanBusDeviceInfo> availableDevices (QString * errorMessage ) const = 0
virtual QCanBusDevice * createDevice (const QString & interfaceName , QString * errorMessage ) const = 0

详细描述

所有插件必须实现此工厂类提供的函数。

成员函数文档编制

[pure virtual] QList < QCanBusDeviceInfo > QCanBusFactory:: availableDevices ( QString * errorMessage ) const

Returns the list of available devices and their capabilities for the QCanBusDevice .

errorMessage contains an error description in case of failure.

[pure virtual] QCanBusDevice *QCanBusFactory:: createDevice (const QString & interfaceName , QString * errorMessage ) const

创建新的 QCanBusDevice . The caller must take ownership of the returned pointer.

interfaceName is the CAN interface name and errorMessage contains an error description in case of failure.

若工厂无法创建插件,返回 nullptr .