Filter Struct
struct QCanBusDevice::FilterQCanBusDevice::Filter 構造体は、CAN バスフレームのフィルターを定義する。詳細...
パブリック型
enum | FormatFilter { MatchBaseFormat, MatchExtendedFormat, MatchBaseAndExtendedFormat } |
flags | FormatFilters |
パブリック変数
QCanBusDevice::Filter::FormatFilter | format |
QCanBusFrame::FrameId | frameId |
QCanBusFrame::FrameId | frameIdMask |
QCanBusFrame::FrameType | type |
関連する非メンバー
bool | operator!=(const QCanBusDevice::Filter &a, const QCanBusDevice::Filter &b) |
bool | operator==(const QCanBusDevice::Filter &a, const QCanBusDevice::Filter &b) |
詳細説明
フィルタリングを有効にするために、QCanBusDevice::Filter インスタンスのリストがQCanBusDevice::setConfigurationParameter() に渡される。受信したCANフレームがリスト内のフィルターの少なくとも1つにマッチした場合、QCanBusDevice 。
以下の例では、この構造体の使用方法を示します:
QCanBusDevice::Filter filter; QList<QCanBusDevice::Filter> filterList; // filter all CAN bus packages with id 0x444 (base) or 0xXXXXX444 (extended) filter.frameId = 0x444u; filter.frameIdMask = 0x7FFu; filter.format = QCanBusDevice::Filter::MatchBaseAndExtendedFormat; filter.type = QCanBusFrame::InvalidFrame; filterList.append(filter); // filter all DataFrames with extended CAN bus package format filter.frameId = 0x0; filter.frameIdMask = 0x0; filter.format = QCanBusDevice::Filter::MatchExtendedFormat; filter.type = QCanBusFrame::DataFrame; filterList.append(filter); // apply filter device->setConfigurationParameter(QCanBusDevice::RawFilterKey, QVariant::fromValue(filterList));
メンバ型ドキュメント
enum Filter::FormatFilter
flags Filter::FormatFilters
この enum は、入力される CAN バスフレームをフィルタリングするために使用されるフォーマットパターンを記述します。
定数 | 値 | 説明 |
---|---|---|
QCanBusDevice::Filter::MatchBaseFormat | 0x0001 | CANバスフレームは、ベースフレームフォーマット(11ビット識別子)を使用しなければならない。 |
QCanBusDevice::Filter::MatchExtendedFormat | 0x0002 | CANバスフレームは拡張フレームフォーマット(29ビット識別子)を使用しなければならない。 |
QCanBusDevice::Filter::MatchBaseAndExtendedFormat | 0x0003 | CANバスフレームは、ベースまたは拡張フレームフォーマットを持つことができます。 |
FormatFilters型はQFlags<FormatFilter>のtypedefです。FormatFilterの値のORの組み合わせを格納する。
メンバ変数ドキュメント
QCanBusDevice::Filter::FormatFilter Filter::format
この変数は、一致する CAN バス・フレームのフレーム・フォーマットを保持する。
デフォルトでは、このフィールドはQCanBusDevice::Filter::MatchBaseAndExtendedFormat に設定されています。
QCanBusFrame::FrameId Filter::frameId
この変数は、受信フレームのフィルタリングに使用されるフレームIDを保持する。
frameId はframeIdMask と組み合わせて使用される。以下がtrue
と評価された場合にマッチングが成功します:
(receivedFrameId & frameIdMask) == (frameId & frameIdMask)
デフォルトでは、このフィールドは0x0
に設定されています。
frameIdMaskも参照してください 。
QCanBusFrame::FrameId Filter::frameIdMask
この変数は、フィルタのフレーム ID と受信フレームに適用されるビットマスクを保持する。
以下がtrue
と評価される場合、2 つのフレーム ID は一致します:
(receivedFrameId & frameIdMask) == (frameId & frameIdMask)
デフォルトでは、このフィールドは0x0
に設定されています。
frameIdも参照 。
QCanBusFrame::FrameType Filter::type
この変数は、フィルターされるフレームのタイプを保持する。
この変数をQCanBusFrame::InvalidFrame に設定することで、任意の CAN バス・フレーム・タイプにマッチさせることができます。 type がQCanBusFrame::UnknownFrame に等しい場合、フィルター・オブジェクトは無効です。
デフォルトでは、このフィールドはQCanBusFrame::InvalidFrame に設定されています。
QCanBusFrame::FrameTypeも参照してください 。
関連する非会員
[constexpr noexcept]
bool operator!=(const QCanBusDevice::Filter &a, const QCanBusDevice::Filter &b)
フィルターa がフィルターb と等しくない場合はtrue
を返し、そうでない場合はfalse
を返す。
[constexpr noexcept]
bool operator==(const QCanBusDevice::Filter &a, const QCanBusDevice::Filter &b)
フィルターa がフィルターb と等しい場合はtrue
を返し、そうでない場合はfalse
を返す。
© 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.