Refactorization : BenchControl -> Rig
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
///
|
||||
/// Copyright (c) 2015-2020 Sensus Slovensko a.s.
|
||||
///
|
||||
using System;
|
||||
using log4net;
|
||||
using TBF.Boxes;
|
||||
|
||||
namespace TBF.Rig.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;
|
||||
UInt32 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, UInt32 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, UInt32 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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user