CANpie FD
CAN programming interface environment - Version 3.08
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions
QCanFilter Class Reference

Detailed Description

Public Types

enum  FilterType_e { ,
  eFILTER_ACCEPT,
  eFILTER_REJECT
}
 

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
 
FilterType_te type (void) const
 

Member Enumeration Documentation

◆ FilterType_e

This enumeration defines possible filter types.

Enumerator
eFILTER_ACCEPT 

Accept: CAN frames meeting the condition will pass the filter

eFILTER_REJECT 

Reject: CAN frames meeting the condition will be 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]clFrameR- CAN frame
Returns
TRUE if parameter values are valid
See also
match()

The function configures 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.

In case the supplied parameters for ulIdentifierLowV and ulIdentifierHighV are not valid (e.g. identifier value > QCAN_FRAME_ID_MASK_STD for Extended frames) the function will return FALSE and the filter type is set to QCanFilter::eFILTER_OFF.

◆ match()

bool QCanFilter::match ( const QCanFrame clFrameR) const
Parameters
[in]clFrameR- CAN frame
Returns
TRUE if filter condition is met

The function tests the CAN frame clFrameR with regards to to 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).

◆ type()

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

The function returns the current filter type, which is implicitly set by the functions acceptFrame() or rejectFrame().