FB_BACnet_RcpList
The sample shows the parameterization of the recipient list of the message/event class objects. This sample must be adapted to the project in question.
Syntax
FUNCTION_BLOCK FB_BACnet_RcpList
VAR
bWrite : BOOL ;
// Recipient list to write (to all event classes):
aRecipientList : T_BACnet_RecipientList := [(
nProcessId := 10000,
stValidDays := F_BACnet_ValidDays(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE),
stFromTime := F_BA_ToSTTime(T#0H),
stToTime := F_BA_ToSTTime(T#23H59M59S),
bIssueConfirmed := FALSE,
stEventTransitions := F_BACnet_EventTransitionBits(TRUE, TRUE, TRUE),
stRecipient := F_BACnet_DeviceRecipient(nDeviceInstance:=1445709)
),(
nProcessId := 30100,
stValidDays := F_BACnet_ValidDays(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE),
stFromTime := F_BA_ToSTTime(T#0H),
stToTime := F_BA_ToSTTime(T#23H59M59S),
bIssueConfirmed := TRUE,
stEventTransitions := F_BACnet_EventTransitionBits(TRUE, TRUE, TRUE),
stRecipient := F_BACnet_EthernetRecipient(nIPAddress1:=192,168,10,200, nPort:=47808, nNetworkNr:=444)
),(
nProcessId := 40100,
stValidDays := F_BACnet_ValidDays(TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE),
stFromTime := F_BA_ToSTTime(T#0H),
stToTime := F_BA_ToSTTime(T#23H59M59S),
bIssueConfirmed := TRUE,
stEventTransitions := F_BACnet_EventTransitionBits(TRUE, TRUE, TRUE),
stRecipient := F_BACnet_EthernetRecipient(nIPAddress1:=192,168,15,200, nPort:=47808, nNetworkNr:=555)
)];
END_VAR
VAR
bResult : BOOL;
_iObj : I_BA_Object;
_fbBACnetObj : POINTER TO FB_BACnet_BaseObject;
_hRes : HRESULT;
END_VAR
Implementation part
IF (XBA_Globals.Top.ProjectState = E_BA_ProjectState.eFirstOpCycle) THEN
bWrite := TRUE;
END_IF
IF (bWrite) THEN
bWrite := FALSE;
// Iterate over all event class objects:
_iObj := 0;
WHILE (F_BA_IterateObjectIndex(_iObj, E_BA_ObjectType.eEventClass)) DO
// Receive internal BACnet object from BA object:
IF (NOT _iObj.GetBACnetObject(fbObject=>_fbBACnetObj)) THEN
_iObj.LogMsg.Show(ADSLOG_MSGTYPE_ERROR, 'RL09', 'Failed to receive internal BACnet object!', TRUE);
ELSE
// Write recipient list:
_hRes := _fbBACnetObj^.WritePropertyRecipientList(aRecipientList);
IF (FAILED(_hRes)) THEN
; // Do some error handling (An error message has already been logged here).
END_IF
END_IF
END_WHILE
END_IF
Requirements
Development environment | Necessary function |
---|---|
TwinCAT from v3.1.4024.35 | TF8040 | TwinCAT Building Automation from V5.0.0.0 |