tbf/TestBenchFramework/BenchControl/Elde/StopPreviousOp.cs
2015-04-15 20:32:56 +02:00

67 lines
2.1 KiB
C#

///
/// Copyright (c) 2013-2015 Sensus Metering Systems
///
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()
{
}
}
}