tbf/TestBenchFramework/BenchControl/Modbus/QuidoRS/SetOutputsOp.cs
Milan Hanajik f2da177517 Modbus and QuidoRS components added
WaterMeters folder created, WaterMeter component relocated within the project, iPerl component added
WaterMeters.iPerl implements IRegisterReader interface, TODO: Implement WaterMeter.ReadPulses( ) function
iPerlAdjustment test method added
2015-07-31 19:18:56 +02:00

58 lines
1.5 KiB
C#

///
/// 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;
/// <summary>
/// Events: PressureInDone, PressureOutDone or Error
/// </summary>
/// <param name="quidoRS">Pressure meter reference</param>
/// <param name="pressure">Reference to the measured pressure variable, value is in bar</param>
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
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)
{
}
/// <summary>Start this operation</summary>
public void Start()
{
quidoRS.SetOutputs(outValue);
}
/// <summary>Run this operation</summary>
public Event Run()
{
return eventDone;
}
/// <summary>Stop this operation</summary>
public void Stop()
{
}
}
}