I do not get all of your points. Please see my version that works as I expected:
Declaration:
PROGRAM script_manager_fbtypes_DiagInfo
VAR
strMyInstancename : STRING := 'MyInstance';
bRead: BOOL;
bExecute: BOOL;
strNodePath: STRING(255);
fbDL_ReadNodeValue: DL_ReadNodeValue;
bDone: BOOL;
bActive: BOOL;
bError: BOOL;
ErrorID: CXA_Datalayer.ERROR_CODE;
ErrorIdent: CXA_Datalayer.ERROR_STRUCT;
DataRead: CXA_Datalayer.DL_NodeValue;
fbDiagInfo: cxa_automationcore_fbs.script_manager_fbtypes_DiagInfo;
udiLastMainDiag: UDINT;
udiLastDetailDiag: UDINT;
strLastErrText: STRING(255);
udiLastErrTraceLength: UDINT;
i: INT;
arstrLastErrTrace: ARRAY [0..99] OF STRING;
pLastErrTrace: POINTER TO STRING;
END_VAR
Implementation:
IF bRead THEN
bRead := FALSE;
strNodePath := CONCAT('script/instances/',strMyInstancename);
strNodePath := CONCAT(strNodePath,'/diag');
bExecute := TRUE;
END_IF
IF fbDL_ReadNodeValue.Done THEN
fbDiagInfo.getRootAsDiagInfo(data:= DataRead.GetData(), size:= DataRead.GetSize());
udiLastMainDiag := fbDiagInfo.getLastMainDiag();
udiLastDetailDiag := fbDiagInfo.getLastDetailDiag();
strLastErrText := fbDiagInfo.getLastErrText();
udiLastErrTraceLength := fbDiagInfo.getLastErrTraceLength();
FOR i := 0 TO TO_INT(udiLastErrTraceLength)-1 BY 1 DO
pLastErrTrace := fbDiagInfo.getLastErrTrace(i);
arstrLastErrTrace[i] := pLastErrTrace^;
END_FOR
bExecute := FALSE;
END_IF
fbDL_ReadNodeValue(
Execute:= bExecute,
Done=> bDone,
Active=> bActive,
Error=> bError,
ErrorID=> ErrorID,
ErrorIdent=> ErrorIdent,
ClientId:= ,
NodeName:= strNodePath,
NodeValue:= DataRead);
Picture:
... View more