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:
@@ -15,9 +15,9 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
public class IdcCamera : ComponentBase, IDevice, IOperation, GenericDevices.ICamera
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(IdcCamera));
|
||||
public override string ToString() { return string.Format("{0}, com{1}, {2}, roi{3}",
|
||||
idcCameraCfg.Name, idcCameraCfg.ComPortNr,
|
||||
currentOp, currentRoiId); }
|
||||
public override string ToString() { return string.Format("IdcCamera({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly IdcCameraCfg idcCameraCfg;
|
||||
|
||||
const int MaxRoisCount = 4;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
/// Enumeration of cameras via static fields and methods
|
||||
/// </summary>
|
||||
static int nextCameraNr = 0;
|
||||
public static void ResetStaticProperties()
|
||||
public static new void ResetStaticProperties()
|
||||
{
|
||||
nextCameraNr = 0;
|
||||
}
|
||||
@@ -35,8 +35,6 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
|
||||
public float Brightness { get { return idcCameraCfg.BrightnessCam; } }
|
||||
|
||||
private readonly IdcCameraCfg idcCameraCfg;
|
||||
|
||||
/// <summary>
|
||||
/// Currently running camera operation.
|
||||
/// ReadRegisterOp-s are not included in this list, they are independent.
|
||||
@@ -63,10 +61,9 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
public IdcCamera(IdcCameraCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.idcCameraCfg = cfg;
|
||||
|
||||
idcCameraCfg = cfg;
|
||||
cameraNr = nextCameraNr++;
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
||||
@@ -11,8 +11,8 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
public int BaudRate; /// Baud rate 57600 or 115200
|
||||
public float BrightnessCam; /// Relative brightness 0 .. 1.0f
|
||||
|
||||
/// Parameterless constructor
|
||||
public IdcCameraCfg()
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
IdcCameraCfg()
|
||||
{
|
||||
Name = "Idc";
|
||||
ParentName = string.Empty;
|
||||
@@ -29,7 +29,11 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("COM{0}, {1}Bd, brightness={2}%", ComPortNr, BaudRate, (int)(100.0f * BrightnessCam));
|
||||
return string.Format("Name={0}, Com{1}, {2}Bd, brght={3}%",
|
||||
Name,
|
||||
ComPortNr,
|
||||
BaudRate,
|
||||
(int)(100.0f * BrightnessCam));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,12 +30,6 @@ namespace TBF.BenchControl.Cameras.IdcCamera
|
||||
return ComponentCfgBase.CreateFromDbEntity(typeof(IdcCameraCfg), component, this);
|
||||
}
|
||||
|
||||
public bool HasProcedureParams { get { return false; } }
|
||||
public bool HasTestParams { get { return false; } }
|
||||
//
|
||||
public IParamsProvider GetProcedureParams(Entities.ComponentProcedure procedureParams) { return null; }
|
||||
public IParamsProvider GetTestParams(Entities.ComponentTest testParams) { return null; }
|
||||
|
||||
public void ResetStaticProperties() { IdcCamera.ResetStaticProperties(); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user