Software
SYS TEC electronic GmbH 2001 L-487e_6
49
Return value: Error code of the function.
USBCAN_SUCCESSFUL
USBCAN_ERR_MAXINSTANCES
USBCAN_ERR_ILLHANDLE
USBCAN_ERR_CANNOTINIT
USBCAN_ERR_ILLPARAM
USBCAN_WARN_NODATA
USBCAN_WARN_SYS_RXOVERRUN
USBCAN_WARN_DLL_RXOVERRUN
Description:
Reads a CAN message from the buffer. If the buffer contains no CAN
messages, this function returns a warning. If a buffer overrun
occurred, this function returns a valid CAN message and a warning.
Example:
tUcanHandle UcanHandle;
tCabMsgStruct CanMsg;
BYTE bRet;
...
//read CAN messages
bRet = UcanReadCanMsg (UcanHandle, &CanMsg);
// no errors? print CAN message
if (!bRet) PrintCanMsg (&CanMsg);
else
{
// no warning? print error
if (!(bRet & USBCAN_WARNING)) PrintError (bRet);
else
{
// valid message in CanMsg?
if (bRet != USBCAN_WARN_NODATA)
{
// print CAN message
PrintCanMsg (&CanMsg);
// print warning
PrintWarning (bRet);
}
}
}
...