63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
///
|
|
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
|
///
|
|
using System;
|
|
using log4net;
|
|
using TBF.Boxes;
|
|
|
|
namespace TBF.BenchControl.Elde.TempMeter
|
|
{
|
|
public class ReadTempOp : IOperation
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(ReadTempOp));
|
|
public override string ToString() { return string.Format("ReadTempOp(.,{0},{1},.)", eventDone, tempMeterNr); }
|
|
|
|
/// Set by the constructor
|
|
ControlBoardDev controlBoardDev;
|
|
Event eventDone;
|
|
int tempMeterNr;
|
|
FloatBox temp;
|
|
|
|
/// <summary>
|
|
/// Events: TempInDone, TempOutDone, TempDivDone or Error
|
|
/// </summary>
|
|
/// <param name="tempMeter">TempMeter reference</param>
|
|
/// <param name="temp">Reference to the variable, value is in degree Celsius</param>
|
|
/// <param name="eventDone">Event to be returned by Run() when completed OK</param>
|
|
public ReadTempOp(TempMeter tempMeter, ref FloatBox temp, Event eventDone)
|
|
{
|
|
if (tempMeter == null) throw new ArgumentNullException("tempMeter");
|
|
this.controlBoardDev = tempMeter.ControlBoard;
|
|
this.tempMeterNr = tempMeter.Idx0;
|
|
this.temp = temp;
|
|
this.eventDone = eventDone;
|
|
log.Debug(this.ToString());
|
|
}
|
|
public ReadTempOp(TempMeter tempMeter, ref FloatBox temp)
|
|
: this(tempMeter, ref temp, Event.TempDone)
|
|
{
|
|
}
|
|
|
|
/// <summary>Start this operation</summary>
|
|
public void Start()
|
|
{
|
|
temp.Val = controlBoardDev.Temperature(tempMeterNr);
|
|
}
|
|
|
|
/// <summary>Run this operation</summary>
|
|
/// <returns>
|
|
/// Event.TempInDone, Event.TempOutDone or Event.TempDivDone
|
|
/// </returns>
|
|
public Event Run()
|
|
{
|
|
temp.Val = controlBoardDev.Temperature(tempMeterNr);
|
|
return eventDone;
|
|
}
|
|
|
|
/// <summary>Stop this operation</summary>
|
|
public void Stop()
|
|
{
|
|
}
|
|
}
|
|
}
|