2014-07-28 07:54:35 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using log4net;
|
|
|
|
|
|
using TBF.BenchControl.Generic;
|
2014-07-31 15:04:09 +00:00
|
|
|
|
using TBF.Boxes;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
namespace TBF.BenchControl.Elde.TempMeter
|
|
|
|
|
|
{
|
2014-12-31 12:46:33 +00:00
|
|
|
|
public class TempMeter : ComponentBase, GenericDevices.ITempMeter
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
|
|
|
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
|
2014-12-31 12:46:33 +00:00
|
|
|
|
public override string ToString() { return string.Format("TempMeter({0})", Cfg.ToString(1)); }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
2014-12-31 12:46:33 +00:00
|
|
|
|
readonly TempMeterCfg tempMtrCfg;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
public readonly ControlBoardDev ControlBoard;
|
|
|
|
|
|
|
2014-12-31 12:46:33 +00:00
|
|
|
|
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..7
|
|
|
|
|
|
public float A1 { get { return tempMtrCfg.A1; } }
|
|
|
|
|
|
public float A2 { get { return tempMtrCfg.A2; } }
|
|
|
|
|
|
public float A3 { get { return tempMtrCfg.A3; } }
|
|
|
|
|
|
public float A4 { get { return tempMtrCfg.A4; } }
|
|
|
|
|
|
public float A5 { get { return tempMtrCfg.A5; } }
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
public TempMeter(TempMeterCfg cfg, IList<Generic.IComponent> components)
|
2014-12-31 12:46:33 +00:00
|
|
|
|
: base(cfg)
|
2014-07-28 07:54:35 +00:00
|
|
|
|
{
|
2014-12-31 12:46:33 +00:00
|
|
|
|
tempMtrCfg = cfg;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
ControlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
|
|
|
|
|
if (ControlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
|
|
|
|
|
|
|
|
|
|
|
/// Prepare data for SendCalibData() control board component method
|
2014-09-10 10:05:49 +00:00
|
|
|
|
ControlBoard.TempCalibData[Idx0, 0] = A1;
|
|
|
|
|
|
ControlBoard.TempCalibData[Idx0, 1] = A2;
|
|
|
|
|
|
ControlBoard.TempCalibData[Idx0, 2] = A3;
|
|
|
|
|
|
ControlBoard.TempCalibData[Idx0, 3] = A4;
|
|
|
|
|
|
ControlBoard.TempCalibData[Idx0, 4] = A5;
|
2014-07-28 07:54:35 +00:00
|
|
|
|
|
|
|
|
|
|
log.Debug(this.ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Events: TempDone, Error
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
|
|
|
|
|
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
|
|
|
|
|
public IOperation ReadTempOp(ref FloatBox temp)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ReadTempOp(this, ref temp);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Events: tempDone, Error
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="temp">Reference to a variable for the temperature in Celsius</param>
|
|
|
|
|
|
/// <param name="tempDone">Event returned when measurement done</param>
|
|
|
|
|
|
/// <returns>ReadTempOp instance reference casted to IOperaton</returns>
|
|
|
|
|
|
public IOperation ReadTempOp(ref FloatBox temp, Event tempDone)
|
|
|
|
|
|
{
|
|
|
|
|
|
return new ReadTempOp(this, ref temp, tempDone);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|