User manual

CAN API reference
17 © 2007-2010 Analytica GmbH
CANSetFilter
CANSetFilter — Sets the current filter settings for the connection.
Syntax
#include <AnaGateDllCAN.h>
int CANSetFilter(int hHandle, const int * pnFilter);
Parameter
hHandle Valid access handle.
pnFilter Pointer to an array of 8 filter entries (4 mask and 4 range filter entries). A filter entry contains
of two 32-bit values. Unused mask filter entries must be initialized with 0 values. Unused
range filter entries must be initialized with a 0 for the start value and 0x1FFFFFFF for the
end value.
Return value
Returns Null if successful, or an error value otherwise (Appendix A, Return Codes).
Description
This function sets the current filter settings for the current connection. Filter can be used to suppress
messages with specific CAN message ids.
A mask filter contains of a mask value, which defines the bits of the CAN identifier to examine, and the
appropriate filter value. If the CAN identifier matches in the indicated filter mask with the filter value, the
incoming CAN telegram is sent to the PC, otherwise not.
A range filter defines an address range with a appropriate start and end address. If the CAN identifier do
not lie in the indicated filter range, the incoming CAN telegram is not sent to the PC.
Filter are only active, if the parameter bMonitor is set via the CANOpenDevice function.
See also
CANGetFilter