/// /// Copyright (c) 2015 Sensus Metering Systems /// using System; using log4net; using TBF.Boxes; namespace TBF.BenchControl.Modbus.QuidoRS { public class SetOutputsOp : IOperation { private static readonly ILog log = LogManager.GetLogger(typeof(SetOutputsOp)); public override string ToString() { return string.Format("SetOutputsOp(.,{0},{1})", outValue, eventDone); } /// Set by the constructor readonly QuidoRS quidoRS; readonly Event eventDone; ushort outValue; /// /// Events: PressureInDone, PressureOutDone or Error /// /// Pressure meter reference /// Reference to the measured pressure variable, value is in bar /// Event to be returned by Run() when completed OK public SetOutputsOp(QuidoRS quidoRS, ushort outValue, Event eventDone) { if (quidoRS == null) throw new ArgumentNullException("quidoRS"); this.quidoRS = quidoRS; this.outValue = outValue; this.eventDone = eventDone; log.Debug(this.ToString()); } public SetOutputsOp(QuidoRS quidoRS, ushort outValue) : this(quidoRS, outValue, Event.SetOutputsDone) { } /// Start this operation public void Start() { quidoRS.SetOutputs(outValue); } /// Run this operation public Event Run() { return eventDone; } /// Stop this operation public void Stop() { } } }