- all components, componentCfg-s and parameter providers use base classes - less boilerplate code, simpler access to test/procedure parameters from code - CreateTestParams(test), CreateProcedureParams(procedure) methods added - TestBenchSim class is made static, it is not inheritted by any device anymore
66 lines
2.3 KiB
C#
66 lines
2.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using log4net;
|
|
using TBF.Boxes;
|
|
|
|
namespace TBF.BenchControl.Elde.RegisterReader
|
|
{
|
|
public class RegisterReader : ComponentBase, GenericDevices.IRegisterReader
|
|
{
|
|
private static readonly ILog log = LogManager.GetLogger(typeof(RegisterReader));
|
|
public override string ToString() { return string.Format("RegisterReader({0})", Cfg.ToString(1)); }
|
|
|
|
readonly RegisterReaderCfg registerReaderCfg;
|
|
|
|
public int Position { get { return registerReaderCfg.Position; } } /// 1 .. inf
|
|
public float PulsesPerLtr { get { return registerReaderCfg.ProcParams.PulsesPerLtr; } }
|
|
|
|
public readonly ControlBoardDev ControlBoard;
|
|
|
|
|
|
public RegisterReader(RegisterReaderCfg cfg, IList<Generic.IComponent> components)
|
|
: base(cfg)
|
|
{
|
|
registerReaderCfg = cfg;
|
|
|
|
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
|
|
|
|
log.Debug(this.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Events: Event.ReadRegisterDone, Event.Error
|
|
/// </summary>
|
|
/// <param name="pulses">Reference to a variable for the water meter pulses</param>
|
|
/// <returns>ReadWaterMeter instance reference casted to IOperaton</returns>
|
|
public IOperation ReadRegisterOp(ref IntBox pulses)
|
|
{
|
|
return new ReadRegisterOp(this, ref pulses);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Events: Event.ReadRegisterDone, Event.Error
|
|
/// </summary>
|
|
/// <param name="pulses">Reference to a variable for the water meter pulses</param>
|
|
/// <param name="pulses">Reference to a variable for the related reference flowmeter pulses</param>
|
|
/// <returns>Reference to operation object instance</returns>
|
|
public IOperation ReadRegisterOp(ref IntBox pulses, ref IntBox refPulses)
|
|
{
|
|
return new ReadRegisterOp(this, ref pulses, ref refPulses);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Events: ReadReferenceDone, Error
|
|
/// </summary>
|
|
/// <param name="pulses">Reference to a variable for the water meter pulses</param>
|
|
/// <returns>Reference to operation object instance</returns>
|
|
public IOperation ReadReferenceForRegisterOp(ref IntBox pulses, ref IntBox refPulses)
|
|
{
|
|
return new ReadReferenceForRegisterOp(this, ref pulses);
|
|
}
|
|
}
|
|
}
|