65 lines
1.9 KiB
C#
65 lines
1.9 KiB
C#
///
|
|
/// Copyright (c) 2016 Sensus Metering Systems
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using log4net;
|
|
using TBF.Boxes;
|
|
using TBF.BenchControl.Keithley.RS232;
|
|
|
|
namespace TBF.BenchControl.Keithley.TempMeter
|
|
{
|
|
public class TempMeter : ComponentBase, GenericDevices.ITempMeter
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(TempMeter));
|
|
public override string ToString() { return string.Format("Keithley.TempMeter({0})", Cfg.ToString(1)); }
|
|
|
|
readonly TempMeterCfg tempMtrCfg; /// configuration
|
|
|
|
public readonly Multimeter Multimeter; /// parent component
|
|
|
|
public int Idx0 { get { return tempMtrCfg.Idx0; } } /// 0..3
|
|
|
|
public TempMeter()
|
|
{
|
|
}
|
|
|
|
public TempMeter(Generic.IComponentCfg cfg, IList<Generic.IComponent> components)
|
|
: base(cfg)
|
|
{
|
|
tempMtrCfg = cfg as TempMeterCfg;
|
|
|
|
Multimeter = (Multimeter)TbfComponents.FindComponent(cfg.ParentName, components);
|
|
if (Multimeter == null) throw new Exception("Cannot find " + Name + " parent");
|
|
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
public float ReadTemperature()
|
|
{
|
|
return Multimeter.ReadTemperature(Idx0);
|
|
}
|
|
|
|
/// <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);
|
|
}
|
|
}
|
|
}
|