using System;
using log4net;
namespace TBF.BenchControl.Elde
{
public class StopPreviousOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(StopPreviousOp));
public override string ToString() { return string.Format("StopPreviousOp(.)"); }
/// Set by the constructor
readonly ControlBoardDev controlBoard;
bool stopped = false;
///
/// Stop the previous control board operation (diverter, gate, etc.)
/// Events: None or PreviousStopped
///
/// Control board component reference
public StopPreviousOp(ControlBoardDev controlBoardDev)
{
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
this.controlBoard = controlBoardDev;
log.Debug(this.ToString());
}
/// Start this operation
public void Start()
{
controlBoard.SendCommand(Command.Stop,
0, /// ref. flowmeter number
controlBoard.RRoute, /// route
0, /// ref. pulses
TestMethods.Diverter,
0.0f,
20,
0,
StopDevs.Diverter | StopDevs.GatePulse | StopDevs.Reference | StopDevs.RegValveRegulation);
}
/// Run this operation
///
/// Event.None or Event.PreviousStopped
///
public Event Run()
{
if (stopped) return Event.PreviousStopped;
if (0 == (controlBoard.StatusP & StatusP.TestCompleted))
{
stopped = true;
return Event.PreviousStopped;
}
return Event.None;
}
/// Stop this operation
public void Stop()
{
}
}
}