VCI .NET SDK Can Filtering


I have a CANBlue II that I’m using in conjunction with the SDK from NuGet (VS2015). Driver is version 4. I can start the DeviceServer, connect, and send/receive messages. I simply can not get the filtering to work. I have tried setting the Control and Message filtering, and neither one seems to work.

Any suggestions or examples? (some relevant code below)

static ICanControl2 mCanCtl;
mCanCtl.InitLine(CanOperatingModes.Extended, CanExtendedOperatingModes.Undefined, CanFilterModes.Inclusive, 100, CanFilterModes.Inclusive, 100, CanBitrate2.CANFD250KBit, CanBitrate2.CANFD250KBit);
mCanCtl.AddFilterIds(CanFilter.Ext,0x0cf777e2, 0x3fffffff); //filter everything except 1 ID


Thank you for the inquiry, I am going to look into this further and get back to you.


There will likely be some more information coming, but for now here is some information that may be helpful with regards to the filter.

Always keep in mind that everything is shifted 1 bit to the left because of the RTR bit at the end (Bit 0).

// allow can ID 0x80 to pass
mCanCtl.SetAccFilter(CanFilter.Ext,  0x100, 0xFFF);

// Filter on ID 0x0cf777e2
mCanCtl.SetAccFilter(CanFilter.Ext, (0x0cf777e2 << 1), 0x3fffffff);