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:
@@ -13,31 +13,23 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
/// IdcCamera object represents all IDC cameras.
|
||||
/// Camera ID is an argument of most methods.
|
||||
/// </summary>
|
||||
public class CameraRoi : ComponentBase, IComponent, GenericDevices.ICameraRoi, GenericDevices.IRegisterReader
|
||||
public class CameraRoi : ComponentBase, GenericDevices.ICameraRoi, GenericDevices.IRegisterReader
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(CameraRoi));
|
||||
public override string ToString() { return string.Format("{0}, roi{1}, parent={2}",
|
||||
cameraRoiCfg.Name, cameraRoiCfg.RoiNr, Cfg.ParentName); }
|
||||
|
||||
public static void ResetStaticProperties()
|
||||
{
|
||||
}
|
||||
public override string ToString() { return string.Format("CameraRoi({0})", Cfg.ToString(1)); }
|
||||
|
||||
readonly CameraRoiCfg cameraRoiCfg;
|
||||
|
||||
readonly GenericDevices.ICamera camera;
|
||||
public GenericDevices.ICamera Camera { get { return camera; } }
|
||||
|
||||
public float PulsesPerLtr
|
||||
{
|
||||
get { return (ProcedureParams as RoiProcedureParams).GradPerLtr; }
|
||||
}
|
||||
public float PulsesPerLtr { get { return cameraRoiCfg.ProcParams.GradPerLtr; } }
|
||||
|
||||
public CameraRoi(CameraRoiCfg cfg, IList<Generic.IComponent> components)
|
||||
: base(cfg)
|
||||
{
|
||||
if (cfg == null) throw new ArgumentNullException("cfg");
|
||||
this.cameraRoiCfg = cfg;
|
||||
cameraRoiCfg = cfg;
|
||||
|
||||
if (cfg.DebugLevel != Entities.DebugMode.Off)
|
||||
{
|
||||
camera = TbfComponents.FindComponent(cfg.ParentName, components) as GenericDevices.ICamera;
|
||||
@@ -46,6 +38,8 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
throw new Exception("Cannot find " + Name + " parent");
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug(this.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,7 +80,7 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
/// <returns>Reference to operation object instance</returns>
|
||||
public IOperation DetectOp()
|
||||
{
|
||||
RoiProcedureParams pp = ProcedureParams as RoiProcedureParams;
|
||||
RoiProcedureParams pp = cameraRoiCfg.ProcParams;
|
||||
return camera.DetectOp(cameraRoiCfg.RoiNr,
|
||||
new Cameras.IdcCamera.Command.Detect(cameraRoiCfg.RoiNr, 0, pp.IRoiX, pp.IRoiY, pp.IRoiW, pp.IRoiH,
|
||||
pp.CX, pp.CY, pp.ORoiW, pp.ORoiH, pp.R1, pp.R2, pp.R3,
|
||||
@@ -102,7 +96,7 @@ namespace TBF.BenchControl.Cameras.CameraRoi
|
||||
/// <returns>Reference to operation object instance</returns>
|
||||
public IOperation MeasureOp()
|
||||
{
|
||||
RoiProcedureParams pp = ProcedureParams as RoiProcedureParams;
|
||||
RoiProcedureParams pp = cameraRoiCfg.ProcParams;
|
||||
return camera.MeasureOp(cameraRoiCfg.RoiNr,
|
||||
new Cameras.IdcCamera.Command.Measure(cameraRoiCfg.RoiNr, true, 0, pp.IRoiX, pp.IRoiY, pp.IRoiW, pp.IRoiH,
|
||||
pp.CX, pp.CY, pp.ORoiW, pp.ORoiH, pp.MinMvmt, pp.MaxMvmt,
|
||||
|
||||
Reference in New Issue
Block a user