Qt Serial Bus

Qt Serial Bus API 提供訪問各種工業串行總綫和協議 (譬如 CAN、ModBus 等) 的類和函數。

快速入門

To use the module with CMake, use the find_package() 命令定位所需模塊組件在 Qt6 包:

find_package(Qt6 COMPONENTS SerialBus REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
					

To use the module for building with qmake, add the module as a value of the QT variable in the project's .pro file:

QT += serialbus
					

支持的總綫和協議

API 參考

這些是 API 參考材料鏈接。

日誌類彆

The QtSerialBus 模塊導齣下列 日誌類彆 :

日誌類彆 描述
qt.canbus 啓用標準日誌,在 Qt CAN Bus
qt.canbus.plugins 啓用低級日誌,在 Qt CAN Bus 插件類。要為特定插件設置日誌,使用 qt.canbus.plugins.pluginname。如 qt.canbus.plugins.socketcan。 qt.canbus.plugins* 影響所有插件。
qt.modbus 啓用標準日誌,在 Qt Modbus
qt.modbus.lowlevel 啓用包括單個數據包內容的低級日誌,在 Qt Modbus

日誌類彆可用於啓用額外警告和調試輸齣為 QtSerialBus 。可以找到有關日誌的更多詳細信息在 QLoggingCategory .

快速方式啓用所有 Qt Modbus 日誌是將以下行添加到 main() 函數:

QLoggingCategory::setFilterRules(QStringLiteral("qt.modbus* = true"));
					

範例

Module Evolution

Changes to Qt SerialBus lists important changes in the module API and functionality that were done for the Qt 6 series of Qt.