QCanBusFactory Class

QCanBusFactory 类是一个工厂类,用作 CAN 总线插件的插件接口。更多

Header: #include <QCanBusFactory>
CMake.QCanBusFactory 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

返回QCanBusDevice 可用设备及其功能的列表。

errorMessage 如果失败,则包含错误说明。

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

创建一个新的QCanBusDevice 。调用者必须拥有返回指针的所有权。

interfaceName 是 CAN 接口名称, 包含失败时的错误描述。errorMessage

如果工厂无法创建插件,则返回nullptr

© 2025 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.