QtCanBus Namespace
QtCanBus 命名空间提供了一些通用枚举,这些枚举用于QtSerialPort 模块中的 CAN 总线处理部分。更多内容...
| 头文件: | #include <qcancommondefinitions.h> |
| 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。
使用枚举类型是为了避免与 unsigned int 之间的隐式转换。
© 2026 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.