CAN programming interface environment
Version 3.10
Loading...
Searching...
No Matches
QCanFilter Class Reference

#include <qcan_filter.hpp>

Public Types

enum  FilterType_e {
}
 

Public Member Functions

 QCanFilter ()
 
bool acceptFrame (const QCanFrame::FrameFormat_e &teFormatR, const uint32_t ulIdentifierLowV, const uint32_t ulIdentifierHighV)
 
bool match (const QCanFrame &clFrameR) const
 
bool rejectFrame (const QCanFrame::FrameFormat_e &teFormatR, const uint32_t ulIdentifierLowV, const uint32_t ulIdentifierHighV)
 
FilterType_te type (void) const
 

Member Enumeration Documentation

◆ FilterType_e

This enumeration defines possible filter types.

Enumerator
eFILTER_ACCEPT 

Accept: CAN frames that meet the condition pass the filter

eFILTER_REJECT 

Reject: CAN frames that meet the condition are rejected by the filter

Constructor & Destructor Documentation

◆ QCanFilter()

QCanFilter::QCanFilter ( )

Constructs an empty filter.

Member Function Documentation

◆ acceptFrame()

bool QCanFilter::acceptFrame ( const QCanFrame::FrameFormat_e & teFormatR,
const uint32_t ulIdentifierLowV,
const uint32_t ulIdentifierHighV )
Parameters
[in]teFormatRFrame format (standard or extended)
[in]ulIdentifierLowVLower bound of identifier range (inclusive)
[in]ulIdentifierHighVUpper bound of identifier range (inclusive)
Returns
TRUE if parameter values are valid
See also
match()

Configure an acceptance filter for CAN frames with a frame format defined by teFormatR. All CAN frames with an identifier value within the range from ulIdentifierLowV to ulIdentifierHighV will match the filter condition.

If the supplied parameters for ulIdentifierLowV and ulIdentifierHighV are not valid (e.g., identifier value > QCAN_FRAME_ID_MASK_STD for extended frames) the function returns FALSE and the filter type is set to QCanFilter::eFILTER_OFF.

◆ match()

bool QCanFilter::match ( const QCanFrame & clFrameR) const
Parameters
[in]clFrameRCAN frame to test
Returns
TRUE if filter condition is met

Test the CAN frame clFrameR with regard to the configured filter type. For an acceptance filter (QCanFilter::eFILTER_ACCEPT) the function returns TRUE if the CAN frame meets the acceptance condition (e.g. identifier value).

For a rejection filter (QCanFilter::eFILTER_REJECT) the function returns TRUE if the CAN frame meets the rejection condition (e.g. identifier value).

◆ rejectFrame()

bool QCanFilter::rejectFrame ( const QCanFrame::FrameFormat_e & teFormatR,
const uint32_t ulIdentifierLowV,
const uint32_t ulIdentifierHighV )
Parameters
[in]teFormatRFrame format (standard or extended)
[in]ulIdentifierLowVLower bound of identifier range (inclusive)
[in]ulIdentifierHighVUpper bound of identifier range (inclusive)
Returns
TRUE if parameter values are valid
See also
match()

Configure a rejection filter for CAN frames with a frame format defined by teFormatR. All CAN frames with an identifier value within the range from ulIdentifierLowV to ulIdentifierHighV will match the rejection condition.

If the supplied parameters for ulIdentifierLowV and ulIdentifierHighV are not valid (e.g., identifier value > QCAN_FRAME_ID_MASK_STD for extended frames) the function returns FALSE and the filter type is set to QCanFilter::eFILTER_OFF.

◆ type()

FilterType_te QCanFilter::type ( void ) const
inline
Returns
Current filter type

Returns the current filter type, which is implicitly set by acceptFrame() or rejectFrame().