LogObjectsBase.UpdateObjectPropertiesFromDataFile (METH) ¶ METHOD PROTECTED UpdateObjectPropertiesFromDataFile : RTS_IEC_RESULT InOut: Scope Name Type Return UpdateObjectPropertiesFromDataFile RTS_IEC_RESULT Input instNumber DWORD
TrendLog.BACnetEventCallback (METH) ¶ METHOD BACnetEventCallback : BOOL Callback callback for IEC_BACNET_CALLBACK_TYPE.BACNET_CALLBACK_WRITE InOut: Scope Name Type Comment Return BACnetEventCallback BOOL Input EventId DWORD If only one event is possibly called, the following Ids can be ignored. If there are more at least the EventId should be checked, to get the right type of pParameter. ID of the occured Event. Contains the class and the event (see CmpBACnet.EVENTIDS) usParamId WORD Id of the parameter structure (see pParameter and CmpBACnet.EVENTIDS) usVersion WORD Version of the parameter structure (see pParameter and CmpBACnet.EVENTIDS) pParameter POINTER TO BYTE Pointer to the event specific parameter, that is specified by Id (see CmpBACnet.EVENTIDS and CmpBACnet, i.e. EVT_BACNET_ACKALARM)
TrendLog.GetCallback (METH) ¶ METHOD GetCallback : BACnet.IBACnetServerPluginCallback InOut: Scope Name Type Return GetCallback BACnet.IBACnetServerPluginCallback Input index UINT
TrendLog.GetHook (METH) ¶ METHOD GetHook : BACnet.IBACnetServerPluginHook InOut: Scope Name Type Return GetHook BACnet.IBACnetServerPluginHook Input index UINT
CreateMaskReceiver (FUN) ¶ FUNCTION CreateMaskReceiver : CAA.HANDLE This function creates a receiver for a specific identifier area. For receiving a message use the returned receiver handle for Read function call. Mask receivers are very similar to Area Receivers (see also RegisterIdArea ). The only difference is that CAN ID filtering is not done by range but by bit mask. Inputs cobIdValue and cobIdMask are interpreted as follows: Value 0 1 0 1 x : this bit may be either TRUE or FALSE 0 : this bit has to be FALSE 1 : this bit hat to be TRUE Mask 0 0 1 1 Result X X 0 1 In general: The values of the masks activate the evaluation of the value parameters. If the mask value is FALSE the value parameter is ignored. There are two kind of receivers: Always Newest Receivers (xAlwaysNewest := TRUE): Receiver holds only the last received message. Receiver with Queue (xAlwaysNewest := FALSE): Receiver holds messages in chronological order. Receivers can be also used for Tx loopback. If xTransmitMask is set to FALSE or xTransmitMask and xTransmitValue are set to TRUE CAN messages which are sent via Write will be received (applies to all transmit messages on the CAN interface). Use function IsTransmitMessage to distinguish between receive and transmit messages. Note To avoid losing receive messages an application has to read all messages of a receiver each cycle. All messages should be processed and released by FreeMessage afterwards. Example VAR hDriver : CAA.HANDLE ; hReceiver : CAA.HANDLE ; hMsg : CAA.HANDLE ; ctMsgLeft : CAA.COUNT ; eError : CL2.ERROR ; END_VAR //Create a MaskReceiver which receives all messages with CAN ID 16#80. hReceiver := CL2.CreateMaskReceiver ( hDriver := hDriver , cobIdValue := 16#80 , //cobID value cobIdMask := 16#FFFFFFFF , //cobID mask ==> all bits of value are relevant xRTRValue := FALSE , //no RTR messages xRTRMask := TRUE , //activate RTR filter ==> xRTRValue will be checked x29BitIdValue := FALSE , //no 29 bit CAN messages x29BitIdMask := TRUE , //activate 29 bit filter ==> x29BitIdValue will be checked xTransmitValue := FALSE , //only receive messages, no transmit message loopback xTransmitMask := TRUE , //activate transmit mask filter ==> xTransmitValue will be checked xAlwaysNewest := FALSE , //FALSE := receiver with queue; TRUE: only newest message eEvent := CB.EVENT.NO_EVENT , //no receive event xEnableSyncWindow := FALSE , //not implemented peError := ADR ( eError ) //optional pointer to error ); REPEAT //receive a message from hReceiver hMsg := CL2.Read ( hReceiverId := hReceiver , pctMsgLeft := ADR ( ctMsgLeft ), peError := ADR ( eError )); IF hMsg <> CAA.gc_hINVALID THEN //TODO: Process message (CL2.GetMessageDataPointer, CL2.GetMessageId, ...) CL2.FreeMessage ( hMsg ); //release message hMsg := CAA.gc_hINVALID ; //to avoid using an already released message END_IF UNTIL ctMsgLeft = 0 END_REPEAT Optionally, an event can be registered which is triggered upon reception of a corresponding message. A callback function can be registerd via CB.RegisterCallback (CAA Callback library). Use event class CB.EVENT_CLASS.FIELDBUS , event source CB.EVENT_SOURCE.CB_DRIVER and any unassigned event number (see CB.EVENT ). Use the same event number for eEvent input. Input variable dwParam of the registered callback function contains the CAN ID of the received message. See CreateSingleIdReceiver for example code. Note Event mechanism is not supported on all systems. Futhermore it is not possible to register an event for extended identifiers (29bit). InOut: Scope Name Type Comment Return CreateMaskReceiver CAA.HANDLE new receiver handle or CAA.gc_hINVALID in case of failure Input hDriver CAA.HANDLE handle of CAN interface cobIdValue CL2I.COBID CobID value cobIdMask CL2I.COBID CobID mask xRTRValue BOOL Value RTR bit; only evaluated if xRTRMask is set to TRUE xRTRMask BOOL Mask RTR bit x29BitIdValue BOOL Value 29 Bit Id; only evaluated if x29BitIdMask is set to TRUE x29BitIdMask BOOL Mask 29 Bit Id xTransmitValue BOOL Value Transmit message; only evaluated if xTransmitMask is set to TRUE xTransmitMask BOOL Mask Transmit message xAlwaysNewest BOOL TRUE : returns only the newest message; FALSE : receiver with queue. eEvent CB.EVENT trigger event when message received xEnableSyncWindow BOOL use SYNC window: not implemented ==> do not care peError POINTER TO ERROR optional pointer to error enum
CreateMessage (FUN) ¶ FUNCTION CreateMessage : CAA.HANDLE This function allocates a new message from the data pool of the driver and makes it available via its handle hMessage . In addition, the function sets the identifier, cobld, data length and RTR flag of the message. Such a message must either be sent with Write or released with FreeMessage . It can also be duplicated by use of CloneMessage . Example See Write . InOut: Scope Name Type Comment Return CreateMessage CAA.HANDLE new message handle or CAA.gc_hINVALID if no resources left Input hDriver CAA.HANDLE handle of CAN interface cobID CL2I.COBID cob ID usiLength USINT length of valid data bytes xRTR BOOL RTR bit x29BitID BOOL 29 Bit ID peError POINTER TO ERROR optional pointer to error enum
CreateSingleIdReceiver (FUN) ¶ FUNCTION CreateSingleIdReceiver : CAA.HANDLE This function creates a receiver for one specific CAN identifier. For receiving a message use the returned receiver handle for Read function call. There are two kind of receivers: Always Newest Receivers (xAlwaysNewest := TRUE): Receiver holds only the last received message. Receiver with Queue (xAlwaysNewest := FALSE): Receiver holds messages in chronological order. Receivers can be also used for Tx loopback. If xTransmit is set to TRUE CAN messages which are sent via Write will be received (applies to all transmit messages on the CAN interface). Use function IsTransmitMessage to distinguish between receive and transmit messages. Note To avoid losing receive messages an application has to read all messages of a receiver each cycle. All messages should be processed and released by FreeMessage afterwards. Example In this example a single ID receiver is created. It receives all RTR messages on CAN ID 16#100. VAR hDriver : CAA.HANDLE ; hReceiver : CAA.HANDLE ; hMsg : CAA.HANDLE ; pData : POINTER TO CL2I.DATA ; eError : CL2.ERROR ; ctMsgLeft : CAA.COUNT ; END_VAR hReceiver := CL2.CreateSingleIdReceiver ( hDriver := hDriver , cobId := 16#100 , xRTR := TRUE , x29BitId := FALSE , xTransmit := FALSE , xAlwaysNewest := FALSE , eEvent := CB.EVENT.NO_EVENT , //no receive event xEnableSyncWindow := FALSE , //not implemented peError := ADR ( eError ) //optional pointer to error ); REPEAT //receive a message from hReceiver hMsg := CL2.Read ( hReceiverId := hReceiver , pctMsgLeft := ADR ( ctMsgLeft ), peError := ADR ( eError )); IF hMsg <> CAA.gc_hINVALID THEN //TODO: Process message (CL2.GetMessageDataPointer, CL2.GetMessageId, ...) CL2.FreeMessage ( hMsg ); //release message hMsg := CAA.gc_hINVALID ; //to avoid using an already released message END_IF UNTIL ctMsgLeft = 0 END_REPEAT Optionally, an event can be registered which is triggered upon reception of a corresponding message. A callback function can be registerd via CB.RegisterCallback (CAA Callback library). Use event class CB.EVENT_CLASS.FIELDBUS , event source CB.EVENT_SOURCE.CB_DRIVER and any unassigned event number (see CB.EVENT ). Use the same event number for eEvent input. Input variable dwParam of the registered callback function contains the CAN ID of the received message. Note Event mechanism is not supported on all systems. Futhermore it is not possible to register an event for extended identifiers (29bit). Example In this example a single ID receiver with event callback is created. Step 1: Define a callback function with following interface (function name can be changed!). FUNCTION CallbackReceiveCANMessage : DWORD VAR_INPUT dwSpec : DWORD ; (* CB.Event and CB.EventClass *) dwSource : DWORD ; (* CB.EventSource *) dwParam : DWORD ; (* CAN ID *) END_VAR Step 2: Activate Enable system call in build settings of CallbackReceiveCANMessage . Step 3: Register callback and create receiver. VAR hDriver : CAA.HANDLE ; hReceiver : CAA.HANDLE ; eError : CL2.ERROR ; callback : CB.CB_CALLBACK ; hEvent : CAA.HANDLE ; eCBError : CB.ERROR ; END_VAR callBack.eClass := CB.EVENT_CLASS.FIELDBUS ; callback.eSource := CB.EVENT_SOURCE.DRIVER ; callback.eEvent := 10000 ; //any unassigned event number callback.pPOUFunc := ADR ( CallbackReceiveCANMessage ); hEvent := CB.RegisterCallback ( callback , ADR ( eCBError )); hReceiver := CL2.CreateSingleIdReceiver ( hDriver := hDriver , cobId := 16#100 , xRTR := FALSE , x29BitId := FALSE , xTransmit := FALSE , xAlwaysNewest := FALSE , eEvent := 10000 , //use the previously registered event number xEnableSyncWindow := FALSE , //not implemented peError := ADR ( eError ) //optional pointer to error ); InOut: Scope Name Type Comment Return CreateSingleIdReceiver CAA.HANDLE new receiver handle or CAA.gc_hINVALID in case of failure Input hDriver CAA.HANDLE handle of CAN interface cobId CL2I.COBID id of message to be received xRTR BOOL TRUE : receive RTR messages, FALSE : receive no RTR messages x29BitId BOOL TRUE : receive 29 Bit Ids, FALSE : receive 11 Bid Ids xTransmit BOOL TRUE : receive Tx messages, FALSE : receive Rx messages xAlwaysNewest BOOL TRUE : returns only the newest message; FALSE : receiver with queue. eEvent CB.EVENT trigger event when message received xEnableSyncWindow BOOL use SYNC window: not implemented ==> do not care peError POINTER TO ERROR optional pointer to error enum
DeleteReceiver (FUN) ¶ FUNCTION DeleteReceiver : ERROR This function releases all ressources of a specific receiver. Note When calling DriverClose all receivers connected to this driver are released automatically. Do not call DeleteReceiver afterwards! InOut: Scope Name Type Comment Return DeleteReceiver ERROR ERROR.NO_ERROR or appropriate error code Input hReceiverId CAA.HANDLE handle of receiver
DriverClose (FUN) ¶ FUNCTION DriverClose : ERROR Closes a CAN interface and frees all resources. InOut: Scope Name Type Comment Return DriverClose ERROR ERROR.NO_ERROR or appropriate error code Input hDriver CAA.HANDLE handle of CAN interface
DriverGetSize (FUN) ¶ FUNCTION DriverGetSize : CAA.SIZE Calculates the needed memory size for DriverOpenP . InOut: Scope Name Type Comment Return DriverGetSize CAA.SIZE Required memory size for DriverOpenP Input usiNetId USINT number of CAN interface [0..n] xSupport29Bit BOOL FALSE : only 11-Bit IDs, TRUE : support also 29-Bit ctMessages CAA.COUNT number of transmit messages which should be allocated peError POINTER TO ERROR optional pointer to error enum