CL2.CreateSingleIdReceiver (FUN)

 

This function of the CAA_CanL2.library registers a single identifier for future calls of CL2.Read. By setting “xAlwaysNewest” to TRUE  the user indicates that he will always read the last message received first. Other­wise, if supported by the driver, he'll get the messages in chronological order. An event which is triggered upon reception of the corresponding driver message can additionally be assigned. A function allocated via “CB_RegisterCallback” (“CAA_Callback.lib”) can then be called. The used class is “CB_FIELDBUS” and the source is “CB_DRIVER”. The lowest byte of the additional callback parameter contains the number of the interface.

If the “CANopen SYNC” service is enabled with CL2.EnableSyncService the parameter “xEnableSyncWindows” can be used to guarantee that the messages can only be sent within the current SYNC window.

Identifiers of messages which are meant for the usage with CL2.Write may also be registered. Messages sent successfully are then returned with a current time stamp. The application of the function CL2.IsTrans­mitMessage on such messages returns TRUE.

The function “CL2.CreateSingleIdReceiver” returns “CAA.gc_hIN­VALID” in case of failure.

Input:

hDriver

CAA.HANDLE

handle of CAN interface

cobId

CL2I.COBID

handle of CAN bus

xRTR

BOOL

bit sign of RTR flag

x29BitId

BOOL

bit sign of message type

xTransmit

BOOL

bit sign of feedback

xAlwaysNewest*

BOOL

TRUE: only the newest message is stored; FALSE: all received messages are stored in chronological order

eEvent*

CB_EVENT

event to be activated when receiving a message

0: no event

xEnableSyncWindow*

BOOL

reception only in Sync window

peError

POINTER TO CL2.ERROR

pointer to error code (enumeration type)

Output:

hRegId

CAA.HANDLE

handle for future read access