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

48 lines
1.5 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 TBF.BenchControl.Generic;
namespace TBF.BenchControl.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 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);
}
}
}