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 프레임이 목록에 있는 필터 중 하나 이상과 일치하면 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
플래그 Filter::FormatFilters
이 열거형은 들어오는 CAN 버스 프레임을 필터링하는 데 사용되는 형식 패턴을 설명합니다.
Constant | 값 | 설명 |
---|---|---|
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
로 평가되면 두 프레임 ID가 일치하는 것입니다:
(receivedFrameId & frameIdMask) == (frameId & frameIdMask)
기본적으로 이 필드는 0x0
으로 설정되어 있습니다.
frameId 를참조하세요 .
QCanBusFrame::FrameType Filter::type
이 변수에는 필터링할 프레임의 유형이 저장됩니다.
이 변수를 QCanBusFrame::InvalidFrame 으로 설정하여 모든 CAN 버스 프레임 유형을 일치시킬 수 있습니다. 유형이 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.