This function prepares one mailbox through the index to RX or TX function with filter settings. It can be used as a replacement for the deprecated CANSetMode() function.
The Keith & Koep CAN driver has an internal software-based Fifo structure. K+K offers the possibility to redirect the received packets to another Mailbox Fifo.
BOOL CANPrepareMB(HANDLE hCAN, DWORD Index, CAN_MODE Mode, CAN_FRAME_FORMAT Frameformat, DWORD Id, DWORD AcceptMask);
Parameters
HANDLE hCAN
HANDLE handle of the CAN Driver got from CANOpenHandle(LPCWSTR lpDevName);
DWORD index
index of mailbox (0..63) The upper 16 Bit of this parameter (if != 0) may redirect the input of this mailbox to another mailbox fifo. e.g. ((1<<16)|2) would parameterize Mailbox 2 with redirection to Mailbox 1.
CAN_MODE mode
mode CAN_RX or CAN_TX
CAN_FRAME_FORMAT Frameformat
Frameformat CAN_STANDARD or CAN_EXTENDED
DWORD Id
Parameter to configure CAN receive Filter CAN Id to be received.
DWORD AcceptMask
Parameter to configure CAN receive Filter CAN AcceptanceMask specifies significant filter bits. 0 means, no bit is significant.
Return Values
If this function succeeds, the returns TRUE
If the function fails, the return value is FALSE.
Remarks
Requirements
OS Versions: Windows CE 6RE3 and later.
canbus.h
Link Library: cansdk.lib