Skip to main content

getRootNodeName

Short Summary

This method returns the instance path of the root node of the operation mode handler. It is used for the HMI tree building mechanism.

  • Return type: CNM_OpModeHandlingInterfaces.Tc2_System.T_MaxString

Parameters

none

Code

Declaration

{attribute 'TcRpcEnable'}
METHOD FINAL getRootNodeName : CNM_OpModeHandlingInterfaces.Tc2_System.T_MaxString
VAR
nodePath, path, name :Tc2_System.T_MaxString;
END_VAR

Implementation

IF (NOT THIS^.plcIsInitialized) THEN
getRootNodeName := 'PLC_NOT_INITIALIZED';
RETURN;
END_IF

IF THIS^.isObjectValid(THIS^.modeHandler) THEN
IF THIS^.isObjectValid(THIS^.modeHandler.rootNode) THEN
nodePath := THIS^.modeHandler.rootNode.name;
Tc2_Utilities.FindAndSplitChar(
sSeparatorChar := '.',
pSrcString := ADR(nodePath),
pLeftString := ADR(path),
nLeftSize := SIZEOF(path),
pRightString := ADR(name),
nRightSize := SIZEOF(name)
);
nodePath := name;
Tc2_Utilities.FindAndSplitChar(
sSeparatorChar := '.',
pSrcString := ADR(nodePath),
pLeftString := ADR(path),
nLeftSize := SIZEOF(path),
pRightString := ADR(name),
nRightSize := SIZEOF(name)
);
ELSE
name := 'NO_ROOTNODE_ASSIGNED';
Tc2_System.ADSLOGSTR(
msgCtrlMask := Tc2_System.Global_Variables.ADSLOG_MSGTYPE_ERROR,
msgFmtStr := '%s: no rootnode asssigned to opmode handler, HMI intialization failed',
strArg := THIS^.name
);
END_IF
ELSE
name := 'NO_MODEHANDLER_INITIALIZED';
Tc2_System.ADSLOGSTR(
msgCtrlMask := Tc2_System.Global_Variables.ADSLOG_MSGTYPE_ERROR,
msgFmtStr := '%s: interface modeHandler not initalized, HMI intialization failed',
strArg := THIS^.name
);
END_IF

getRootNodeName := name;