Skip to main content

overwriteMode

Short Summary

This method allows the overwrite of the current mode state with a new mode, provided the current mode state is in IDLE or SUCCESS status, and the input mode object is valid. It determines the outcome of the overwrite operation and returns the appropriate result.

Example

IF (opModeHandler.setMode(mode := automaticMode) = SingleExecutionResult.SUCCESS)
AND_THEN (dispensingStation.overwriteMode(mode := simulatedMode) = SingleExecutionResult.SUCCESS)
THEN
opModeHandler.startMode();
END_IF

Parameters

NameTypeCommentKind
modeCNM_OpModeHandlingInterfaces.IModeBehaviour-input

Code

Declaration

METHOD FINAL overwriteMode : CNM_ReturnTypes.SingleExecutionResult
VAR_INPUT
mode : CNM_OpModeHandlingInterfaces.IModeBehaviour;
END_VAR

Implementation

IF ( THIS^.currentNodeState <> CNM_ReturnTypes.SingleExecutionState.BUSY ) THEN
IF (THIS^.isObjectValid(mode)) THEN
(* clear modes on subtree *)
THIS^.resetLocalModes();
(* overwrite this node mode *)
THIS^.modeOverwrite := mode;
overwriteMode := CNM_ReturnTypes.SingleExecutionResult.SUCCESS;
END_IF
ELSE
overwriteMode := CNM_ReturnTypes.SingleExecutionResult.ABORTED;
END_IF