Qt Serial Bus
Qt Serial Bus APIは、CANやModBusなど、さまざまな産業用シリアルバスやプロトコルにアクセスするためのクラスと関数を提供します。
はじめに
CMake でモジュールを使用するには、find_package()
コマンドを使用して、Qt6
パッケージに必要なモジュール・コンポーネントを見つけます:
find_package(Qt6 COMPONENTS SerialBus REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::SerialBus)
qmakeでのビルドにモジュールを使用するには、プロジェクトの.proファイルにQT
変数の値としてモジュールを追加します:
QT += serialbus
サポートされているバスとプロトコル
APIリファレンス
APIリファレンスへのリンクです。
ロギングカテゴリー
QtSerialBus モジュールは以下のlogging categories をエクスポートします:
ロギング・カテゴリー | 説明 |
---|---|
qt.canbus | Qt CAN Busクラスの標準ロギングを有効にします。 |
qt.canbus.plugins | Qt CAN Busプラグインクラス内の低レベルのロギングを有効にします。特定のプラグインのロギングを設定するには、"qt.canbus.plugins.pluginname "を使用します。"qt.canbus.plugins*"は全てのプラグインに影響します。 |
qt.modbus | Qt Modbusクラスの標準ロギングを有効にします。 |
qt.modbus.lowlevel | Qt Modbusクラス内で個々のパケット内容を含む低レベルのロギングを有効にします。 |
ロギングのカテゴリは、QtSerialBus の追加警告とデバッグ出力を有効にするために使用できます。ロギングの詳細についてはQLoggingCategory を参照してください。
全てのQt Modbusロギングを有効にする Quick な方法は、main() 関数に以下の行を追加することです:
QLoggingCategory::setFilterRules(QStringLiteral("qt.modbus* = true"));
例
モジュールの進化
Qt SerialBusの変更点には、Qt 6シリーズで行われたモジュールAPIと機能の重要な変更点が記載されています。
© 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.