///
/// Copyright (c) 2017 Sensus Metering Systems
///
using System;
using log4net;
using TBF.Boxes;
namespace TBF.BenchControl.Dummy.FlowMeter
{
public class ReadFlowOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ReadFlowOp));
public override string ToString() { return string.Format("ReadFlowOp(.,{0},{1},.)", eventDone); }
/// Set by the constructor
readonly Event eventDone;
DoubleBox flow;
///
/// Events: FlowInDone, FlowOutDone or Error
///
/// Flow meter reference
/// Reference to the measured flow variable, value is in bar
/// Event to be returned by Run() when completed OK
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow, Event eventDone)
{
if (flowMeter == null) throw new ArgumentNullException("flowMeter");
this.eventDone = eventDone;
this.flow = flow;
log.Debug(this.ToString());
}
public ReadFlowOp(FlowMeter flowMeter, ref DoubleBox flow)
: this(flowMeter, ref flow, Event.FlowMeasurementDone)
{
}
/// Start this operation
public void Start()
{
}
/// Run this operation
///
/// Event.FlowInDone or Event.FlowOutDone
///
public Event Run()
{
flow.Val = 1.23f;
return eventDone;
}
/// Stop this operation
public void Stop()
{
}
}
}