Skip to main content

enter

Short summary

This method performs the given invoke only in the first cycle of the current step.

Parameters

NameTypeCommentKind
invokeCNM_CommandInterfaces.ISingleAttemptcommand to executeinput
errorStepDINTstep to proceed with in case of errorinput

Code

Declaration

METHOD enter
VAR_INPUT
(* command to execute *)
invoke :CNM_CommandInterfaces.ISingleAttempt;
(* step to proceed with in case of error *)
errorStep :DINT := CNM_ReturnTypes.DefaultSteps.STEP.ERROR;
END_VAR

Implementation

THIS^.registeredEnter := TRUE;

RETURN (
THIS^.executeStep
OR_ELSE THIS^.state <> CNM_ReturnTypes.SingleExecutionState.BUSY
);

IF (THIS^.isObjectNull(invoke) OR_ELSE (invoke.invoke() <> CNM_ReturnTypes.SingleExecutionResult.SUCCESS)) THEN
THIS^.wasError := TRUE;
THIS^.wasSuccess := FALSE;
IF ((errorStep <> CNM_ReturnTypes.DefaultSteps.STEP.ERROR)
AND_THEN (errorStep <> THIS^.currentErrorStep)
) THEN
THIS^.currentErrorStep := errorStep;
END_IF
END_IF