tbf/TBF/Rig/DataContainers/BenchInfo/Extended/Component.cs

55 lines
1.9 KiB
C#

///
/// Copyright (c) 2018-2020 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using log4net;
using Common;
using Config;
using TBF.Rig.Generic;
namespace TBF.Rig.DataContainers.BenchInfo.Extended
{
/// <summary>
/// Holds information identifying the test bench.
/// </summary>
public class Component : ComponentBase, GenericDevices.IBenchInfo
{
private static readonly ILog log = LogManager.GetLogger(typeof(Component));
public override string ToString() { return string.Format("{0}({1})", ClassName, Cfg.ToString(-1)); }
readonly ComponentCfg myCfg;
public string TestBenchName { get { return myCfg.TestBenchName; } }
public int TestBenchId { get { return myCfg.TestBenchId; } }
public string Address1 { get { return myCfg.Address1; } }
public string Address2 { get { return myCfg.Address2; } }
public string Address3 { get { return myCfg.Address3; } }
public string Address4 { get { return myCfg.Address4; } }
public string Address5 { get { return myCfg.Address5; } }
public RemoteDBUse RemoteDBUse { get { return myCfg.RemoteDBUse; } }
public Unit VolumeUnit { get { return myCfg.VolumeUnit; } }
public Unit FlowUnit { get { return myCfg.FlowUnit; } }
public Unit MassUnit { get { return myCfg.MassUnit; } }
public Unit TempUnit { get { return myCfg.TempUnit; } }
public Unit PressUnit { get { return myCfg.PressUnit; } }
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
public Component() { }
public Component(Generic.IComponentCfg cfg)
: base(cfg)
{
myCfg = cfg as ComponentCfg;
}
public override void Initialize()
{
Events.DB.SetBenchName(myCfg.TestBenchName);
log.FatalFormat("{0} initialized: {1}", Name, this);
}
}
}