Everything works OK after serious changes:
- 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
This commit is contained in:
@@ -4,34 +4,25 @@ using log4net;
|
||||
|
||||
namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
public class Diverter : Generic.IComponent, GenericDevices.IDiverter
|
||||
public class Diverter : ComponentBase, GenericDevices.IDiverter
|
||||
{
|
||||
/// <summary>
|
||||
/// Info: StartMassMeasurement() and "Balance response = .., Mass = ..."
|
||||
/// Warn: Start measurement when busy is true
|
||||
/// </summary>
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Diverter));
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Diverter({0},{1})", Name, diverterCfg.BitPosition);
|
||||
}
|
||||
public override string ToString() { return string.Format("Diverter({0})", Cfg.ToString(1)); }
|
||||
|
||||
public static void ResetStaticProperties() { }
|
||||
|
||||
private readonly DiverterCfg diverterCfg;
|
||||
public Generic.IComponentCfg Cfg { get { return diverterCfg; } }
|
||||
|
||||
public string Name { get { return diverterCfg.Name; } }
|
||||
|
||||
readonly DiverterCfg diverterCfg;
|
||||
readonly ControlBoardDev controlBoard;
|
||||
|
||||
readonly ulong mask; /// derived from bitPosition in the constructor
|
||||
|
||||
public bool State
|
||||
{
|
||||
get { return (controlBoard.Route & mask) != 0; }
|
||||
}
|
||||
|
||||
|
||||
public Diverter(DiverterCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.diverterCfg = cfg;
|
||||
diverterCfg = cfg;
|
||||
|
||||
controlBoard = (ControlBoardDev)TbfComponents.FindComponent(cfg.ParentName, components);
|
||||
if (controlBoard == null) throw new Exception("Cannot find " + Name + " parent");
|
||||
@@ -41,10 +32,5 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public bool State
|
||||
{
|
||||
get { return (controlBoard.Route & mask) != 0; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
{
|
||||
public int BitPosition;
|
||||
|
||||
/// Parameterless constructor
|
||||
public DiverterCfg()
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
DiverterCfg()
|
||||
{
|
||||
Name = "Div";
|
||||
ParentName = "CB";
|
||||
@@ -25,6 +25,7 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, Parent={1}, Bit={2}",
|
||||
Name,
|
||||
(string.IsNullOrEmpty(ParentName) ? "-" : ParentName),
|
||||
BitPosition);
|
||||
}
|
||||
|
||||
@@ -9,10 +9,6 @@ namespace TBF.BenchControl.Elde.Diverter
|
||||
public class DiverterFactory : IComponentFactory
|
||||
{
|
||||
public string ClassName { get { return "Diverter"; } }
|
||||
public bool HasProcedureParams { get { return false; } }
|
||||
public bool HasTestParams { get { return false; } }
|
||||
public IParamsProvider GetTestParams(Entities.ComponentTest testParams) { return null; }
|
||||
public IParamsProvider GetProcedureParams(Entities.ComponentProcedure procedureParams) { return null; }
|
||||
|
||||
/// <summary>Max. number of components of this class in the system</summary>
|
||||
public int MaxCount { get { return 5; } }
|
||||
|
||||
Reference in New Issue
Block a user