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.socketcan」。「qt.canbus.plugins*」はすべてのプラグインに影響します。 |
| qt.modbus | Qt Modbusクラス内部で標準のロギングを有効にします |
| qt.modbus.lowlevel | Qt Modbusクラス内で、個々のパケットの内容を含む低レベルのロギングを有効にします。 |
ロギングカテゴリを使用すると、QtSerialBus に対する追加の警告およびデバッグ出力を有効にできます。ロギングに関するより詳細な情報は、QLoggingCategory に記載されています。
Qt Modbusのすべてのロギングを有効にする簡単な方法は、main()関数に次の行を追加することです:
QLoggingCategory::setFilterRules(QStringLiteral("qt.modbus* = true"));例
モジュールの進化
「Qt SerialBusの変更点」では、Qt 6シリーズ向けに実施された、モジュールのAPIおよび機能に関する重要な変更点をまとめています。
ライセンス
Qt SerialBus は、The Qt Company から商用ライセンスの下で提供されています。また、GNU Lesser General Public License バージョン 3 またはGNU General Public License バージョン 2 の下でも利用可能です。詳細については、「Qt ライセンス」を参照してください。
© 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.