QtCanBus Namespace
QtCanBus 命名空间提供了一些通用枚举,这些枚举用于QtSerialPort 模块的 CAN 总线处理部分。更多
头文件: | #include <QtCanBus> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS SerialBus) target_link_libraries(mytarget PRIVATE Qt6::SerialBus) |
qmake: | QT += serialbus |
自 | Qt 6.5 |
类型
enum class | DataFormat { SignedInteger, UnsignedInteger, Float, Double, AsciiString } |
enum class | DataSource { Payload, FrameId } |
enum class | MultiplexState { None, MultiplexorSwitch, MultiplexedSignal, SwitchAndSignal } |
enum class | UniqueId { } |
类型文档
enum class QtCanBus::DataFormat
该枚举表示可能的数据格式。格式定义了如何从数据源中提取数值。
常量 | 值 | 说明 |
---|---|---|
QtCanBus::DataFormat::SignedInteger | 0 | 信号值是有符号整数。 |
QtCanBus::DataFormat::UnsignedInteger | 1 | 信号值为无符号整数。 |
QtCanBus::DataFormat::Float | 2 | 信号值为浮点数。 |
QtCanBus::DataFormat::Double | 3 | 信号值为双倍。 |
QtCanBus::DataFormat::AsciiString | 4 | 信号值为 ASCII 字符串。 |
enum class QtCanBus::DataSource
该枚举表示数据在 CAN 帧中的位置。
常数 | 值 | 描述 |
---|---|---|
QtCanBus::DataSource::Payload | 0 | 数据将从有效载荷中提取。 |
QtCanBus::DataSource::FrameId | 1 | 数据将从帧 ID 中提取。 |
enum class QtCanBus::MultiplexState
该枚举表示信号可能的多路复用状态。
常量 | 值 | 说明 |
---|---|---|
QtCanBus::MultiplexState::None | 0x00 | 信号不用于多路复用。 |
QtCanBus::MultiplexState::MultiplexorSwitch | 0x01 | 该信号用作多路复用开关,这意味着其他信号取决于该信号的值。 |
QtCanBus::MultiplexState::MultiplexedSignal | 0x02 | 该信号由某个开关复用,因此只有当开关具有特定值时才能提取其值。 |
QtCanBus::MultiplexState::SwitchAndSignal | MultiplexorSwitch | MultiplexedSignal | 信号的多路复用开关必须具有能让我们使用该信号的值。在使用时,该信号还充当其他多路复用信号的多路复用开关。 |
enum class QtCanBus::UniqueId
代表 CAN 唯一标识符。基本类型是 quint32。
使用枚举可避免与无符号 int 之间的隐式转换。
© 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.