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:
Milan Hanajik
2015-01-02 12:51:27 +01:00
parent 752719bd62
commit 94de991bf6
126 changed files with 1117 additions and 1629 deletions
@@ -13,20 +13,12 @@ namespace TBF.BenchControl.Greco
/// Ambient temperature / humidity / pressure meter 'Greco' connected via serial interface (RS232)
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
/// </summary>
public class Ambient : TestBenchSim, IComponent, IDevice, IOperation, GenericDevices.IAmbient
public class Ambient : ComponentBase, IDevice, IOperation, GenericDevices.IAmbient
{
/// <summary>
/// Info: Successful measurement
/// Warn: Invalid serial response format
/// </summary>
private static readonly ILog log = LogManager.GetLogger(typeof(Ambient));
public static void ResetStaticProperties() { }
public override string ToString() { return string.Format("Ambient({0})", Cfg.ToString(1)); }
private readonly AmbientCfg ambientCfg;
public Generic.IComponentCfg Cfg { get { return ambientCfg; } }
public string Name { get { return ambientCfg.Name; } }
/// Private fields
SerialPort serialPort;
@@ -52,12 +44,13 @@ namespace TBF.BenchControl.Greco
/// Connection settings: 19200 Bd 8-bits No-parity 1-stop-bit Flow control: none or hardware.
/// </summary>
public Ambient(AmbientCfg cfg, IList<Generic.IComponent> components)
: base(cfg)
{
if (cfg == null) throw new ArgumentNullException("cfg");
this.ambientCfg = cfg;
ambientCfg = cfg;
log.Debug(this.ToString());
}
public new void Initialize()
public void Initialize()
{
if (ambientCfg.DebugLevel == Entities.DebugMode.Simulate)
{
@@ -65,7 +58,7 @@ namespace TBF.BenchControl.Greco
humidity = 40.0f;
pressure = 1.0f;
msrmntTimeStamp = StateMachine.Time;
msrmntState = BenchControl.MsrmntState.Valid;
msrmntState = MsrmntState.Valid;
return;
}