You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
using FSM.Machines;
|
|
using FSM.Recipes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FSM.States
|
|
{
|
|
class PausedState : IEquipmentState
|
|
{
|
|
private Recipe _currentRecipe;
|
|
|
|
public PausedState(Recipe recipe)
|
|
{
|
|
_currentRecipe = recipe;
|
|
}
|
|
|
|
public void Enter()
|
|
{
|
|
Console.WriteLine("Entering PausedState");
|
|
}
|
|
|
|
public void Exit()
|
|
{
|
|
Console.WriteLine("Exiting PausedState");
|
|
}
|
|
|
|
public bool HandleEvent(EquipmentEvent equipmentEvent, Machines.EquipmentStateMachine machine)
|
|
{
|
|
switch (equipmentEvent)
|
|
{
|
|
case EquipmentEvent.Resume:
|
|
machine.SetState(new RunningState(_currentRecipe));
|
|
return true;
|
|
case EquipmentEvent.Stop:
|
|
machine.SetState(new IdleState());
|
|
return true;
|
|
case EquipmentEvent.EmergencyStop:
|
|
machine.SetState(new EmergencyStoppedState());
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|