64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
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;
|
|
|
|
/// <summary>
|
|
/// Stop the previous control board operation (diverter, gate, etc.)
|
|
/// Events: None or PreviousStopped
|
|
/// </summary>
|
|
/// <param name="controlBoardDev">Control board component reference</param>
|
|
public StopPreviousOp(ControlBoardDev controlBoardDev)
|
|
{
|
|
if (controlBoardDev == null) throw new ArgumentNullException("controlBoardDev");
|
|
this.controlBoard = controlBoardDev;
|
|
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
/// <summary>Start this operation</summary>
|
|
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);
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>
|
|
/// Event.None or Event.PreviousStopped
|
|
/// </returns>
|
|
public Event Run()
|
|
{
|
|
if (stopped) return Event.PreviousStopped;
|
|
if (0 == (controlBoard.StatusP & StatusP.TestCompleted))
|
|
{
|
|
stopped = true;
|
|
return Event.PreviousStopped;
|
|
}
|
|
return Event.None;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|