TestMethods.GrabImage : ImageFileName etc. added to cfg, GrabImageCfg implemented, interfaces changes, ver. 2.15.627
This commit is contained in:
@@ -370,4 +370,13 @@ namespace Config.Entities
|
|||||||
#endif
|
#endif
|
||||||
Count
|
Count
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ImageRotation
|
||||||
|
{
|
||||||
|
[Description("0 deg")] None,
|
||||||
|
[Description("90 deg")] Deg90,
|
||||||
|
[Description("180 deg")] Deg180,
|
||||||
|
[Description("270 deg")] Deg270,
|
||||||
|
Count
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2017 Sensus Metering Systems
|
/// Copyright (c) 2017 Sensus Metering Systems
|
||||||
///
|
///
|
||||||
|
using Config.Entities;
|
||||||
using TBF.BenchControl;
|
using TBF.BenchControl;
|
||||||
|
|
||||||
namespace TBF.BenchControl.GenericDevices
|
namespace TBF.BenchControl.GenericDevices
|
||||||
@@ -29,6 +30,6 @@ namespace TBF.BenchControl.GenericDevices
|
|||||||
/// Grab images.
|
/// Grab images.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Reference to operation object instance</returns>
|
/// <returns>Reference to operation object instance</returns>
|
||||||
IOperation GrabImagesOp(string[] imgFileNames);
|
IOperation GrabImagesOp(string[] imgFileNames, bool blackAndWhite, bool lowResolution, ImageRotation imageRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// Copyright (c) 2017 Sensus Metering Systems
|
/// Copyright (c) 2017 Sensus Metering Systems
|
||||||
///
|
///
|
||||||
|
using Config.Entities;
|
||||||
using TBF.BenchControl.Generic;
|
using TBF.BenchControl.Generic;
|
||||||
|
|
||||||
namespace TBF.BenchControl.GenericDevices
|
namespace TBF.BenchControl.GenericDevices
|
||||||
@@ -24,7 +25,7 @@ namespace TBF.BenchControl.GenericDevices
|
|||||||
/// Watermeter wheel/arrow detection process.
|
/// Watermeter wheel/arrow detection process.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Reference to operation object instance</returns>
|
/// <returns>Reference to operation object instance</returns>
|
||||||
IOperation GrabImageOp(string imageFileName);
|
IOperation GrabImageOp(string imageFileName, bool blackAndWhite, bool lowResolution, ImageRotation imageRotation);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Watermeter wheel/arrow detection process.
|
/// Watermeter wheel/arrow detection process.
|
||||||
|
|||||||
@@ -420,9 +420,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IOperation GrabImagesOp(string[] imgFileNames)
|
public IOperation GrabImagesOp(string[] imgFileNames, bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
|
||||||
{
|
{
|
||||||
return new GrabImageOp(this, imgFileNames);
|
return new GrabImagesOp(this, imgFileNames, blackAndWhite, lowResolution, imageRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-3
@@ -1,20 +1,24 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
using Config.Entities;
|
||||||
using TBF.BenchControl.Network.Telnet;
|
using TBF.BenchControl.Network.Telnet;
|
||||||
|
|
||||||
namespace TBF.BenchControl.Network.Camera.CLP1611
|
namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||||
{
|
{
|
||||||
public class GrabImageOp : IOperation
|
public class GrabImagesOp : IOperation
|
||||||
{
|
{
|
||||||
/// TODO: Implement support for grabbing multiple images, now imgFileNames.Lenght should be 1
|
/// TODO: Implement support for grabbing multiple images, now imgFileNames.Lenght should be 1
|
||||||
|
|
||||||
private static readonly ILog log = LogManager.GetLogger(typeof(GrabImageOp));
|
private static readonly ILog log = LogManager.GetLogger(typeof(GrabImagesOp));
|
||||||
public override string ToString() { return string.Format("GrabImageOp()"); }
|
public override string ToString() { return string.Format("GrabImageOp()"); }
|
||||||
|
|
||||||
readonly Camera camera;
|
readonly Camera camera;
|
||||||
readonly Telnet.TelnetClient telnet;
|
readonly Telnet.TelnetClient telnet;
|
||||||
readonly string[] imgFileNames;
|
readonly string[] imgFileNames;
|
||||||
|
readonly bool blackAndWhite;
|
||||||
|
readonly bool lowResolution;
|
||||||
|
readonly ImageRotation imageRotation;
|
||||||
|
|
||||||
string command;
|
string command;
|
||||||
bool grabImageCommandSent;
|
bool grabImageCommandSent;
|
||||||
@@ -28,13 +32,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
|||||||
/// Events: Event.None or Event.Error
|
/// Events: Event.None or Event.Error
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="camera">CLP1611.Camera reference</param>
|
/// <param name="camera">CLP1611.Camera reference</param>
|
||||||
public GrabImageOp(Camera camera, string[] imgFileNames)
|
public GrabImagesOp(Camera camera, string[] imgFileNames, bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
|
||||||
{
|
{
|
||||||
/// TODO: Implement support for grabbing multiple images, now imgFileNames.Lenght should be 1
|
/// TODO: Implement support for grabbing multiple images, now imgFileNames.Lenght should be 1
|
||||||
|
|
||||||
this.camera = camera;
|
this.camera = camera;
|
||||||
this.telnet = camera.Telnet;
|
this.telnet = camera.Telnet;
|
||||||
this.imgFileNames = imgFileNames;
|
this.imgFileNames = imgFileNames;
|
||||||
|
this.blackAndWhite = blackAndWhite;
|
||||||
|
this.lowResolution = lowResolution;
|
||||||
|
this.imageRotation = imageRotation;
|
||||||
|
|
||||||
grabImageCommandSent = false;
|
grabImageCommandSent = false;
|
||||||
transferringGrabbedImage = false;
|
transferringGrabbedImage = false;
|
||||||
@@ -27,8 +27,6 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
public readonly CLP1611.Camera NetCamera;
|
public readonly CLP1611.Camera NetCamera;
|
||||||
public readonly Roi PreviousRoi;
|
public readonly Roi PreviousRoi;
|
||||||
|
|
||||||
public Telnet.TelnetClient Telnet;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// ICamera interface functions
|
/// ICamera interface functions
|
||||||
///
|
///
|
||||||
@@ -124,6 +122,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
|
StartChangeHandler();
|
||||||
|
|
||||||
log.Debug(this.ToString());
|
log.Debug(this.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,21 +171,20 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
{
|
{
|
||||||
if (NetCamera != null && NetCamera.Telnet != null)
|
if (NetCamera != null && NetCamera.Telnet != null)
|
||||||
{
|
{
|
||||||
Telnet = NetCamera.Telnet;
|
|
||||||
detectedImageName = string.Format("{0}{1}-det-{2}.jpg", Program.ImagesDir, RoiCfg.Name, StateMachine.Time);
|
detectedImageName = string.Format("{0}{1}-det-{2}.jpg", Program.ImagesDir, RoiCfg.Name, StateMachine.Time);
|
||||||
return new RoiDetectionOp(this, RoiX, RoiY, RoiWid, RoiHgh);
|
return new RoiDetectionOp(this, NetCamera, detectedImageName, RoiX, RoiY, RoiWid, RoiHgh);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IOperation GrabImageOp(string imageFileName)
|
public IOperation GrabImageOp(string imageFileName, bool blackAndWhite, bool lowResolution, ImageRotation imageRotation)
|
||||||
{
|
{
|
||||||
if (NetCamera != null && NetCamera.Telnet != null)
|
if (NetCamera != null && NetCamera.Telnet != null)
|
||||||
{
|
{
|
||||||
/// TODO: Implement support for sharing one camera by multiple ROI-s
|
/// TODO: Implement support for sharing one camera by multiple ROI-s
|
||||||
return NetCamera.GrabImagesOp(new string[] { imageFileName });
|
return NetCamera.GrabImagesOp(new string[] { imageFileName }, blackAndWhite, lowResolution, imageRotation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
readonly RoiCfg roiCfg;
|
readonly RoiCfg roiCfg;
|
||||||
readonly CLP1611.Camera camera;
|
readonly CLP1611.Camera camera;
|
||||||
readonly Telnet.TelnetClient telnet;
|
readonly Telnet.TelnetClient telnet;
|
||||||
|
readonly string detectedImageName;
|
||||||
|
|
||||||
string command;
|
string command;
|
||||||
bool roiDetectionCommandSent;
|
bool roiDetectionCommandSent;
|
||||||
@@ -37,15 +38,17 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
/// Events: Event.None or Event.Error
|
/// Events: Event.None or Event.Error
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="camera">CLP1611.Camera reference</param>
|
/// <param name="camera">CLP1611.Camera reference</param>
|
||||||
public RoiDetectionOp(Roi roi, Boxes.IntBox roiX, Boxes.IntBox roiY,
|
public RoiDetectionOp(Roi roi, CLP1611.Camera camera, string detectedImageName,
|
||||||
Boxes.IntBox roiWid, Boxes.IntBox roiHgh)
|
Boxes.IntBox roiX, Boxes.IntBox roiY,
|
||||||
|
Boxes.IntBox roiWid, Boxes.IntBox roiHgh)
|
||||||
{
|
{
|
||||||
this.roi = roi;
|
this.roi = roi;
|
||||||
this.roiCfg = roi.RoiCfg;
|
this.roiCfg = roi.RoiCfg;
|
||||||
this.camera = roi.NetCamera;
|
this.camera = camera;
|
||||||
this.telnet = roi.Telnet;
|
this.telnet = camera.Telnet;
|
||||||
this.roiX = roiX;
|
this.detectedImageName = detectedImageName;
|
||||||
this.roiY = roiY;
|
this.roiX = roiX;
|
||||||
|
this.roiY = roiY;
|
||||||
this.roiWid = roiWid;
|
this.roiWid = roiWid;
|
||||||
this.roiHgh = roiHgh;
|
this.roiHgh = roiHgh;
|
||||||
|
|
||||||
@@ -125,7 +128,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
/// ROI detection passed and image transfer is in progress
|
/// ROI detection passed and image transfer is in progress
|
||||||
return Event.RoiDetectionPassed;
|
return Event.RoiDetectionPassed;
|
||||||
}
|
}
|
||||||
else if (0 == camera.WscpTransferFile("detected.jpg", roi.DetectedImageName))
|
else if (0 == camera.WscpTransferFile("detected.jpg", detectedImageName))
|
||||||
{
|
{
|
||||||
/// File transfer successfully started
|
/// File transfer successfully started
|
||||||
transferringDetectedImage = true;
|
transferringDetectedImage = true;
|
||||||
@@ -176,7 +179,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
|
|||||||
///
|
///
|
||||||
/// Start the file transfer
|
/// Start the file transfer
|
||||||
///
|
///
|
||||||
if (0 == camera.WscpTransferFile("detected.jpg", roi.DetectedImageName))
|
if (0 == camera.WscpTransferFile("detected.jpg", detectedImageName))
|
||||||
{
|
{
|
||||||
/// File transfer successfully started
|
/// File transfer successfully started
|
||||||
transferringDetectedImage = true;
|
transferringDetectedImage = true;
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
///
|
|
||||||
/// Copyright (c) 2017 Sensus Metering Systems
|
|
||||||
///
|
|
||||||
using System;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using log4net;
|
|
||||||
using TBF.BenchControl.Generic;
|
|
||||||
|
|
||||||
namespace TBF.BenchControl.TestMethods.GrabImage
|
|
||||||
{
|
|
||||||
public partial class CfgCtrl : UserControl, IComponentCfgCtrl
|
|
||||||
{
|
|
||||||
static readonly ILog log = LogManager.GetLogger(typeof(CfgCtrl));
|
|
||||||
|
|
||||||
public bool ShowMore { get { return false; } }
|
|
||||||
|
|
||||||
Cfg config;
|
|
||||||
public IComponentCfg Config
|
|
||||||
{
|
|
||||||
get { return config as IComponentCfg; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
config = value as Cfg;
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public CfgCtrl()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EntryFormCfgCtrl_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Closing()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Redraw()
|
|
||||||
{
|
|
||||||
if (config == null) return; /// Control was not loaded, settings were not changed
|
|
||||||
classNameLabel.Text = config.Factory.ClassName;
|
|
||||||
nameTextBox.Text = config.Name;
|
|
||||||
hiResolutionCheckBox.Checked = config.LowResolution;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Unlock()
|
|
||||||
{
|
|
||||||
nameTextBox.Enabled = true;
|
|
||||||
hiResolutionCheckBox.Enabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
|
||||||
{
|
|
||||||
return CfgUpdateFlags.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CfgUpdateFlags UpdateCfg()
|
|
||||||
{
|
|
||||||
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
|
||||||
|
|
||||||
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
|
||||||
|
|
||||||
if (config.Name != nameTextBox.Text)
|
|
||||||
{
|
|
||||||
config.Name = nameTextBox.Text;
|
|
||||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.LowResolution != hiResolutionCheckBox.Checked)
|
|
||||||
{
|
|
||||||
config.LowResolution = hiResolutionCheckBox.Checked;
|
|
||||||
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return flags;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
///
|
|
||||||
/// Copyright (c) 2017 Sensus Metering Systems
|
|
||||||
///
|
|
||||||
namespace TBF.BenchControl.TestMethods.GrabImage
|
|
||||||
{
|
|
||||||
partial class CfgCtrl
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Component Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.nameTextBox = new System.Windows.Forms.TextBox();
|
|
||||||
this.nameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.classNameLabel = new System.Windows.Forms.Label();
|
|
||||||
this.hiResolutionCheckBox = new System.Windows.Forms.CheckBox();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// nameTextBox
|
|
||||||
//
|
|
||||||
this.nameTextBox.Enabled = false;
|
|
||||||
this.nameTextBox.Location = new System.Drawing.Point(134, 69);
|
|
||||||
this.nameTextBox.Name = "nameTextBox";
|
|
||||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
|
||||||
this.nameTextBox.TabIndex = 7;
|
|
||||||
//
|
|
||||||
// nameLabel
|
|
||||||
//
|
|
||||||
this.nameLabel.AutoSize = true;
|
|
||||||
this.nameLabel.Location = new System.Drawing.Point(24, 72);
|
|
||||||
this.nameLabel.Name = "nameLabel";
|
|
||||||
this.nameLabel.Size = new System.Drawing.Size(35, 13);
|
|
||||||
this.nameLabel.TabIndex = 6;
|
|
||||||
this.nameLabel.Text = "Name";
|
|
||||||
//
|
|
||||||
// classNameLabel
|
|
||||||
//
|
|
||||||
this.classNameLabel.AutoSize = true;
|
|
||||||
this.classNameLabel.Location = new System.Drawing.Point(131, 43);
|
|
||||||
this.classNameLabel.Name = "classNameLabel";
|
|
||||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
|
||||||
this.classNameLabel.TabIndex = 5;
|
|
||||||
this.classNameLabel.Text = "ComonentName";
|
|
||||||
//
|
|
||||||
// hiResolutionCheckBox
|
|
||||||
//
|
|
||||||
this.hiResolutionCheckBox.AutoSize = true;
|
|
||||||
this.hiResolutionCheckBox.Enabled = false;
|
|
||||||
this.hiResolutionCheckBox.Location = new System.Drawing.Point(134, 104);
|
|
||||||
this.hiResolutionCheckBox.Name = "hiResolutionCheckBox";
|
|
||||||
this.hiResolutionCheckBox.Size = new System.Drawing.Size(96, 17);
|
|
||||||
this.hiResolutionCheckBox.TabIndex = 8;
|
|
||||||
this.hiResolutionCheckBox.Text = "High resolution";
|
|
||||||
this.hiResolutionCheckBox.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// CfgCtrl
|
|
||||||
//
|
|
||||||
this.Controls.Add(this.hiResolutionCheckBox);
|
|
||||||
this.Controls.Add(this.nameTextBox);
|
|
||||||
this.Controls.Add(this.nameLabel);
|
|
||||||
this.Controls.Add(this.classNameLabel);
|
|
||||||
this.Name = "CfgCtrl";
|
|
||||||
this.Size = new System.Drawing.Size(300, 240);
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.TextBox nameTextBox;
|
|
||||||
private System.Windows.Forms.Label nameLabel;
|
|
||||||
private System.Windows.Forms.Label classNameLabel;
|
|
||||||
private System.Windows.Forms.CheckBox hiResolutionCheckBox;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,40 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
public bool Publish(Test test) { return false; }
|
public bool Publish(Test test) { return false; }
|
||||||
public bool CanTest(MetersKind meters) { return true; }
|
public bool CanTest(MetersKind meters) { return true; }
|
||||||
|
|
||||||
Cfg cfg;
|
|
||||||
|
GrabImageCfg cfg;
|
||||||
|
|
||||||
|
#region Configuration Change Handling
|
||||||
|
|
||||||
|
public static void OnCfgChange(object sender, CfgChangeArgs args)
|
||||||
|
{
|
||||||
|
if (CfgChangeHandler == null) return;
|
||||||
|
try { CfgChangeHandler(sender, args); }
|
||||||
|
catch (Exception e) { log.Error("CfgChangeHandler(...) failed", e); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static event EventHandler<CfgChangeArgs> CfgChangeHandler;
|
||||||
|
|
||||||
|
public override void StartChangeHandler()
|
||||||
|
{
|
||||||
|
CfgChangeHandler += delegate(object sender, CfgChangeArgs args)
|
||||||
|
{
|
||||||
|
GrabImageCfg tmpcfg = args.Cfg as GrabImageCfg;
|
||||||
|
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
|
||||||
|
{
|
||||||
|
if (args.Command == CfgChangeCmd.CfgChange)
|
||||||
|
{
|
||||||
|
cfg.ImageFileName = tmpcfg.ImageFileName;
|
||||||
|
cfg.BlackAndWhite = tmpcfg.BlackAndWhite;
|
||||||
|
cfg.LowResolution = tmpcfg.LowResolution;
|
||||||
|
cfg.ImageRotation = tmpcfg.ImageRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion Configuration Change Handling
|
||||||
|
|
||||||
|
|
||||||
public Component()
|
public Component()
|
||||||
{
|
{
|
||||||
@@ -27,13 +60,15 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
public Component(Generic.IComponentCfg cfg)
|
public Component(Generic.IComponentCfg cfg)
|
||||||
: base(cfg)
|
: base(cfg)
|
||||||
{
|
{
|
||||||
|
this.cfg = cfg as GrabImageCfg;
|
||||||
|
StartChangeHandler();
|
||||||
log.Debug(this.ToString());
|
log.Debug(this.ToString());
|
||||||
this.cfg = cfg as Cfg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<Event> Execute(Test test, bool bdummy, int idummy)
|
public IList<Event> Execute(Test test, bool bdummy, int idummy)
|
||||||
{
|
{
|
||||||
return (new GrabImageSeq()).Execute(test, cfg.LowResolution);
|
return (new GrabImageSeq()).Execute(test, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
|
|
||||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||||
|
|
||||||
public IComponentCfg DefaultConfig() { return new Cfg(this, this.GetType().Namespace.Substring(29)); }
|
public IComponentCfg DefaultConfig() { return new GrabImageCfg(this, this.GetType().Namespace.Substring(29)); }
|
||||||
|
|
||||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||||
{
|
{
|
||||||
return ComponentCfgBase.CreateFromDbEntity(Cfg.Serializer, component, this);
|
return ComponentCfgBase.CreateFromDbEntity(GrabImageCfg.Serializer, component, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-6
@@ -5,27 +5,30 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
using Config.Entities;
|
||||||
using TBF.BenchControl.Generic;
|
using TBF.BenchControl.Generic;
|
||||||
using TBF.Resources;
|
using TBF.Resources;
|
||||||
|
|
||||||
namespace TBF.BenchControl.TestMethods.GrabImage
|
namespace TBF.BenchControl.TestMethods.GrabImage
|
||||||
{
|
{
|
||||||
public class Cfg : ComponentCfgBase, Generic.IComponentCfg
|
public class GrabImageCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||||
{
|
{
|
||||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Cfg) })[0];
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(GrabImageCfg) })[0];
|
||||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||||
|
|
||||||
public IComponentCfgCtrl GetControl() { return new CfgCtrl(); }
|
public IComponentCfgCtrl GetControl() { return new GrabImageCfgCtrl(); }
|
||||||
|
|
||||||
|
|
||||||
|
public string ImageFileName;
|
||||||
public bool BlackAndWhite;
|
public bool BlackAndWhite;
|
||||||
public bool LowResolution;
|
public bool LowResolution;
|
||||||
|
public ImageRotation ImageRotation;
|
||||||
|
|
||||||
|
|
||||||
/// Private parameterless constructor invoked by all other (public) constructors
|
/// Private parameterless constructor invoked by all other (public) constructors
|
||||||
Cfg() {}
|
GrabImageCfg() {}
|
||||||
|
|
||||||
public Cfg(IComponentFactory factory, string name)
|
public GrabImageCfg(IComponentFactory factory, string name)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
this.Factory = factory;
|
this.Factory = factory;
|
||||||
@@ -33,11 +36,13 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
ParentName = string.Empty;
|
ParentName = string.Empty;
|
||||||
BlackAndWhite = false;
|
BlackAndWhite = false;
|
||||||
LowResolution = false;
|
LowResolution = false;
|
||||||
|
ImageRotation = ImageRotation.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToString(int i)
|
public string ToString(int i)
|
||||||
{
|
{
|
||||||
return string.Format("Name={0}, B&W={1}, LowRes={2}", Name, BlackAndWhite, LowResolution);
|
return string.Format("Name={0}, Img={1}, B&W={2}, LowRes={3}, Rotation={4}",
|
||||||
|
Name, ImageFileName, BlackAndWhite, LowResolution, ImageRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2017 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using log4net;
|
||||||
|
using Config.Entities;
|
||||||
|
using TBF.BenchControl.Generic;
|
||||||
|
using TBF.Resources;
|
||||||
|
|
||||||
|
namespace TBF.BenchControl.TestMethods.GrabImage
|
||||||
|
{
|
||||||
|
public partial class GrabImageCfgCtrl : UserControl, IComponentCfgCtrl
|
||||||
|
{
|
||||||
|
static readonly ILog log = LogManager.GetLogger(typeof(GrabImageCfgCtrl));
|
||||||
|
|
||||||
|
public bool ShowMore { get { return false; } }
|
||||||
|
|
||||||
|
GrabImageCfg config;
|
||||||
|
public IComponentCfg Config
|
||||||
|
{
|
||||||
|
get { return config as IComponentCfg; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
config = value as GrabImageCfg;
|
||||||
|
Redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GrabImageCfgCtrl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GrabImageCfgCtrl_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
for (ImageRotation ir = 0; ir < ImageRotation.Count; ir++)
|
||||||
|
{
|
||||||
|
imageRotationComboBox.Items.Add(ir.ToDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
Redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Closing()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Redraw()
|
||||||
|
{
|
||||||
|
if (config == null) return; /// Control was not loaded, settings were not changed
|
||||||
|
classNameLabel.Text = config.Factory.ClassName;
|
||||||
|
nameTextBox.Text = config.Name;
|
||||||
|
imageNameTextBox.Text = config.ImageFileName;
|
||||||
|
blackAndWhiteCheckBox.Checked = config.BlackAndWhite;
|
||||||
|
loResolutionCheckBox.Checked = config.LowResolution;
|
||||||
|
imageRotationComboBox.Text = config.ImageRotation.ToDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Unlock()
|
||||||
|
{
|
||||||
|
nameTextBox.Enabled = true;
|
||||||
|
imageNameTextBox.Enabled = true;
|
||||||
|
blackAndWhiteCheckBox.Enabled = true;
|
||||||
|
loResolutionCheckBox.Enabled = true;
|
||||||
|
imageRotationComboBox.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||||
|
{
|
||||||
|
for (ImageRotation ir = 0; ir < ImageRotation.Count; ir++)
|
||||||
|
{
|
||||||
|
if (imageRotationComboBox.Text == ir.ToDescription()) return CfgUpdateFlags.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
message += Environment.NewLine + string.Format(Strings.Invalid_0, imageRotationLabel.Text);
|
||||||
|
return CfgUpdateFlags.Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CfgUpdateFlags UpdateCfg()
|
||||||
|
{
|
||||||
|
CfgUpdateFlags flags = CfgUpdateFlags.None;
|
||||||
|
|
||||||
|
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
|
||||||
|
|
||||||
|
if (config.Name != nameTextBox.Text)
|
||||||
|
{
|
||||||
|
config.Name = nameTextBox.Text;
|
||||||
|
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.RestartRqrd);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.ImageFileName != imageNameTextBox.Text)
|
||||||
|
{
|
||||||
|
config.ImageFileName = imageNameTextBox.Text;
|
||||||
|
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.BlackAndWhite != blackAndWhiteCheckBox.Checked)
|
||||||
|
{
|
||||||
|
config.BlackAndWhite = blackAndWhiteCheckBox.Checked;
|
||||||
|
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.LowResolution != loResolutionCheckBox.Checked)
|
||||||
|
{
|
||||||
|
config.LowResolution = loResolutionCheckBox.Checked;
|
||||||
|
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ImageRotation ir = 0; ir < ImageRotation.Count; ir++)
|
||||||
|
{
|
||||||
|
if (imageRotationComboBox.Text == ir.ToDescription())
|
||||||
|
{
|
||||||
|
if (config.ImageRotation != ir)
|
||||||
|
{
|
||||||
|
config.ImageRotation = ir;
|
||||||
|
flags |= (CfgUpdateFlags.AnyChange | CfgUpdateFlags.InvokeCfgChange);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((flags & CfgUpdateFlags.InvokeCfgChange) != 0)
|
||||||
|
{
|
||||||
|
Component.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
|
||||||
|
}
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+159
@@ -0,0 +1,159 @@
|
|||||||
|
///
|
||||||
|
/// Copyright (c) 2017 Sensus Metering Systems
|
||||||
|
///
|
||||||
|
namespace TBF.BenchControl.TestMethods.GrabImage
|
||||||
|
{
|
||||||
|
partial class GrabImageCfgCtrl
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Component Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.nameTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.nameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.classNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.loResolutionCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
|
this.blackAndWhiteCheckBox = new System.Windows.Forms.CheckBox();
|
||||||
|
this.imageNameTextBox = new System.Windows.Forms.TextBox();
|
||||||
|
this.imageNameLabel = new System.Windows.Forms.Label();
|
||||||
|
this.imageRotationLabel = new System.Windows.Forms.Label();
|
||||||
|
this.imageRotationComboBox = new System.Windows.Forms.ComboBox();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// nameTextBox
|
||||||
|
//
|
||||||
|
this.nameTextBox.Enabled = false;
|
||||||
|
this.nameTextBox.Location = new System.Drawing.Point(149, 69);
|
||||||
|
this.nameTextBox.Name = "nameTextBox";
|
||||||
|
this.nameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||||
|
this.nameTextBox.TabIndex = 2;
|
||||||
|
//
|
||||||
|
// nameLabel
|
||||||
|
//
|
||||||
|
this.nameLabel.AutoSize = true;
|
||||||
|
this.nameLabel.Location = new System.Drawing.Point(24, 72);
|
||||||
|
this.nameLabel.Name = "nameLabel";
|
||||||
|
this.nameLabel.Size = new System.Drawing.Size(95, 13);
|
||||||
|
this.nameLabel.TabIndex = 1;
|
||||||
|
this.nameLabel.Text = "Test method name";
|
||||||
|
//
|
||||||
|
// classNameLabel
|
||||||
|
//
|
||||||
|
this.classNameLabel.AutoSize = true;
|
||||||
|
this.classNameLabel.Location = new System.Drawing.Point(146, 43);
|
||||||
|
this.classNameLabel.Name = "classNameLabel";
|
||||||
|
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||||
|
this.classNameLabel.TabIndex = 0;
|
||||||
|
this.classNameLabel.Text = "ComonentName";
|
||||||
|
//
|
||||||
|
// loResolutionCheckBox
|
||||||
|
//
|
||||||
|
this.loResolutionCheckBox.AutoSize = true;
|
||||||
|
this.loResolutionCheckBox.Enabled = false;
|
||||||
|
this.loResolutionCheckBox.Location = new System.Drawing.Point(149, 149);
|
||||||
|
this.loResolutionCheckBox.Name = "loResolutionCheckBox";
|
||||||
|
this.loResolutionCheckBox.Size = new System.Drawing.Size(94, 17);
|
||||||
|
this.loResolutionCheckBox.TabIndex = 6;
|
||||||
|
this.loResolutionCheckBox.Text = "Low resolution";
|
||||||
|
this.loResolutionCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// blackAndWhiteCheckBox
|
||||||
|
//
|
||||||
|
this.blackAndWhiteCheckBox.AutoSize = true;
|
||||||
|
this.blackAndWhiteCheckBox.Enabled = false;
|
||||||
|
this.blackAndWhiteCheckBox.Location = new System.Drawing.Point(149, 126);
|
||||||
|
this.blackAndWhiteCheckBox.Name = "blackAndWhiteCheckBox";
|
||||||
|
this.blackAndWhiteCheckBox.Size = new System.Drawing.Size(93, 17);
|
||||||
|
this.blackAndWhiteCheckBox.TabIndex = 5;
|
||||||
|
this.blackAndWhiteCheckBox.Text = "Black && White";
|
||||||
|
this.blackAndWhiteCheckBox.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// imageNameTextBox
|
||||||
|
//
|
||||||
|
this.imageNameTextBox.Enabled = false;
|
||||||
|
this.imageNameTextBox.Location = new System.Drawing.Point(149, 95);
|
||||||
|
this.imageNameTextBox.Name = "imageNameTextBox";
|
||||||
|
this.imageNameTextBox.Size = new System.Drawing.Size(171, 20);
|
||||||
|
this.imageNameTextBox.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// imageNameLabel
|
||||||
|
//
|
||||||
|
this.imageNameLabel.AutoSize = true;
|
||||||
|
this.imageNameLabel.Location = new System.Drawing.Point(24, 98);
|
||||||
|
this.imageNameLabel.Name = "imageNameLabel";
|
||||||
|
this.imageNameLabel.Size = new System.Drawing.Size(81, 13);
|
||||||
|
this.imageNameLabel.TabIndex = 3;
|
||||||
|
this.imageNameLabel.Text = "Image file name";
|
||||||
|
//
|
||||||
|
// imageRotationLabel
|
||||||
|
//
|
||||||
|
this.imageRotationLabel.AutoSize = true;
|
||||||
|
this.imageRotationLabel.Location = new System.Drawing.Point(24, 175);
|
||||||
|
this.imageRotationLabel.Name = "imageRotationLabel";
|
||||||
|
this.imageRotationLabel.Size = new System.Drawing.Size(103, 13);
|
||||||
|
this.imageRotationLabel.TabIndex = 7;
|
||||||
|
this.imageRotationLabel.Text = "Image rotation (ccw)";
|
||||||
|
//
|
||||||
|
// imageRotationComboBox
|
||||||
|
//
|
||||||
|
this.imageRotationComboBox.Enabled = false;
|
||||||
|
this.imageRotationComboBox.FormattingEnabled = true;
|
||||||
|
this.imageRotationComboBox.Location = new System.Drawing.Point(149, 172);
|
||||||
|
this.imageRotationComboBox.Name = "imageRotationComboBox";
|
||||||
|
this.imageRotationComboBox.Size = new System.Drawing.Size(171, 21);
|
||||||
|
this.imageRotationComboBox.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// GrabImageCfgCtrl
|
||||||
|
//
|
||||||
|
this.Controls.Add(this.imageRotationComboBox);
|
||||||
|
this.Controls.Add(this.imageRotationLabel);
|
||||||
|
this.Controls.Add(this.imageNameTextBox);
|
||||||
|
this.Controls.Add(this.imageNameLabel);
|
||||||
|
this.Controls.Add(this.blackAndWhiteCheckBox);
|
||||||
|
this.Controls.Add(this.loResolutionCheckBox);
|
||||||
|
this.Controls.Add(this.nameTextBox);
|
||||||
|
this.Controls.Add(this.nameLabel);
|
||||||
|
this.Controls.Add(this.classNameLabel);
|
||||||
|
this.Name = "GrabImageCfgCtrl";
|
||||||
|
this.Size = new System.Drawing.Size(400, 250);
|
||||||
|
this.Load += new System.EventHandler(this.GrabImageCfgCtrl_Load);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TextBox nameTextBox;
|
||||||
|
private System.Windows.Forms.Label nameLabel;
|
||||||
|
private System.Windows.Forms.Label classNameLabel;
|
||||||
|
private System.Windows.Forms.CheckBox loResolutionCheckBox;
|
||||||
|
private System.Windows.Forms.CheckBox blackAndWhiteCheckBox;
|
||||||
|
private System.Windows.Forms.TextBox imageNameTextBox;
|
||||||
|
private System.Windows.Forms.Label imageNameLabel;
|
||||||
|
private System.Windows.Forms.Label imageRotationLabel;
|
||||||
|
private System.Windows.Forms.ComboBox imageRotationComboBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using log4net;
|
using log4net;
|
||||||
using Config.Entities;
|
using Config.Entities;
|
||||||
using TBF.UiBridge;
|
using TBF.UiBridge;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace TBF.BenchControl.TestMethods.GrabImage
|
namespace TBF.BenchControl.TestMethods.GrabImage
|
||||||
{
|
{
|
||||||
@@ -13,7 +14,7 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
private static readonly ILog log = LogManager.GetLogger(typeof(GrabImageSeq));
|
private static readonly ILog log = LogManager.GetLogger(typeof(GrabImageSeq));
|
||||||
|
|
||||||
|
|
||||||
public IList<Event> Execute(Test test, bool hiResolution)
|
public IList<Event> Execute( Test test, GrabImageCfg cfg)
|
||||||
{
|
{
|
||||||
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
IList<Event> e = new List<Event>(); /// Events from currently running operations
|
||||||
Event retVal = Event.Done;
|
Event retVal = Event.Done;
|
||||||
@@ -32,22 +33,19 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
//------------------------------------------------
|
//------------------------------------------------
|
||||||
State state = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
|
State state = State.Create(string.Format("{0}({1}) : Grabbing images", test.Method, test.Name))
|
||||||
.AddOperation(checkUiOp);
|
.AddOperation(checkUiOp);
|
||||||
|
for (int i = 0; i < sensPath.RegisterReaders.Length; i++)
|
||||||
foreach (var rr in sensPath.RegisterReaders)
|
|
||||||
{
|
{
|
||||||
if (rr is GenericDevices.IRoi)
|
GenericDevices.IRoi roi = sensPath.RegisterReaders[i] as GenericDevices.IRoi;
|
||||||
|
if (roi != null)
|
||||||
{
|
{
|
||||||
GenericDevices.ICamera camera = (rr as GenericDevices.IRoi).Camera;
|
string directory = Path.Combine(Program.ImagesDir, BatchRslts.Batch.BatchNr.ToString(), i.ToString());
|
||||||
if (!cameras.Contains(camera))
|
Directory.CreateDirectory(directory);
|
||||||
{
|
state.AddOperation(roi.GrabImageOp(Path.Combine(directory, cfg.ImageFileName),
|
||||||
cameras.Add(camera);
|
cfg.BlackAndWhite,
|
||||||
grabImagesOp.Add(camera.LiveStreamOp(hiResolution));
|
cfg.LowResolution,
|
||||||
}
|
cfg.ImageRotation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state.AddOperations(grabImagesOp);
|
|
||||||
|
|
||||||
state.EnterState();
|
state.EnterState();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -55,17 +53,10 @@ namespace TBF.BenchControl.TestMethods.GrabImage
|
|||||||
|
|
||||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Test));
|
||||||
|
|
||||||
if (e.Contains(Event.Error))
|
if (e.Contains(Event.Error)) { retVal = Event.Error; break; }
|
||||||
{
|
if (TestAndLogUiCmdStop(test, e)) { retVal = Event.UiCmdStop; break; }
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TestAndLogUiCmdStop(test,e))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
while (true);
|
while (e.Contains(Event.CameraBusy));
|
||||||
|
|
||||||
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
|
Bridge.OnTestProgress(this, new TestProgressEventArgs(test, 1, Config.Entities.Progress.Completed));
|
||||||
|
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ namespace TBF.BenchControl.TestMethods.LiveStream
|
|||||||
|
|
||||||
public bool ShowMore { get { return false; } }
|
public bool ShowMore { get { return false; } }
|
||||||
|
|
||||||
Cfg config;
|
LiveStreamCfg config;
|
||||||
public IComponentCfg Config
|
public IComponentCfg Config
|
||||||
{
|
{
|
||||||
get { return config as IComponentCfg; }
|
get { return config as IComponentCfg; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
config = value as Cfg;
|
config = value as LiveStreamCfg;
|
||||||
Redraw();
|
Redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
|
|||||||
public bool Publish(Test test) { return false; }
|
public bool Publish(Test test) { return false; }
|
||||||
public bool CanTest(MetersKind meters) { return true; }
|
public bool CanTest(MetersKind meters) { return true; }
|
||||||
|
|
||||||
Cfg cfg;
|
LiveStreamCfg cfg;
|
||||||
|
|
||||||
public Component()
|
public Component()
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ namespace TBF.BenchControl.TestMethods.LiveStream
|
|||||||
: base(cfg)
|
: base(cfg)
|
||||||
{
|
{
|
||||||
log.Debug(this.ToString());
|
log.Debug(this.ToString());
|
||||||
this.cfg = cfg as Cfg;
|
this.cfg = cfg as LiveStreamCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IList<Event> Execute(Test test, bool bdummy, int idummy)
|
public IList<Event> Execute(Test test, bool bdummy, int idummy)
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ namespace TBF.BenchControl.TestMethods.LiveStream
|
|||||||
|
|
||||||
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
public IComponent GetComponent(IComponentCfg cfg, IList<IComponent> components) { return new Component(cfg); }
|
||||||
|
|
||||||
public IComponentCfg DefaultConfig() { return new Cfg(this, this.GetType().Namespace.Substring(29)); }
|
public IComponentCfg DefaultConfig() { return new LiveStreamCfg(this, this.GetType().Namespace.Substring(29)); }
|
||||||
|
|
||||||
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
public IComponentCfg CmpntCfgFromCmpntEntity(Config.Entities.Component component)
|
||||||
{
|
{
|
||||||
return ComponentCfgBase.CreateFromDbEntity(Cfg.Serializer, component, this);
|
return ComponentCfgBase.CreateFromDbEntity(LiveStreamCfg.Serializer, component, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -10,9 +10,9 @@ using TBF.Resources;
|
|||||||
|
|
||||||
namespace TBF.BenchControl.TestMethods.LiveStream
|
namespace TBF.BenchControl.TestMethods.LiveStream
|
||||||
{
|
{
|
||||||
public class Cfg : ComponentCfgBase, Generic.IComponentCfg
|
public class LiveStreamCfg : ComponentCfgBase, Generic.IComponentCfg
|
||||||
{
|
{
|
||||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(Cfg) })[0];
|
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(LiveStreamCfg) })[0];
|
||||||
protected override XmlSerializer GetSerializer() { return Serializer; }
|
protected override XmlSerializer GetSerializer() { return Serializer; }
|
||||||
|
|
||||||
public IComponentCfgCtrl GetControl() { return new CfgCtrl(); }
|
public IComponentCfgCtrl GetControl() { return new CfgCtrl(); }
|
||||||
@@ -22,9 +22,9 @@ namespace TBF.BenchControl.TestMethods.LiveStream
|
|||||||
|
|
||||||
|
|
||||||
/// Private parameterless constructor invoked by all other (public) constructors
|
/// Private parameterless constructor invoked by all other (public) constructors
|
||||||
Cfg() {}
|
LiveStreamCfg() {}
|
||||||
|
|
||||||
public Cfg(IComponentFactory factory, string name)
|
public LiveStreamCfg(IComponentFactory factory, string name)
|
||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
this.Factory = factory;
|
this.Factory = factory;
|
||||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("2.15.626.1")]
|
[assembly: AssemblyVersion("2.15.627.1")]
|
||||||
[assembly: AssemblyFileVersion("2.15.626.1")]
|
[assembly: AssemblyFileVersion("2.15.627.1")]
|
||||||
|
|||||||
@@ -599,7 +599,7 @@
|
|||||||
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
|
<DependentUpon>CameraCfgCtrl.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BenchControl\Network\Camera\CLP1611\Factory.cs" />
|
<Compile Include="BenchControl\Network\Camera\CLP1611\Factory.cs" />
|
||||||
<Compile Include="BenchControl\Network\Camera\CLP1611\GrabImageOp.cs" />
|
<Compile Include="BenchControl\Network\Camera\CLP1611\GrabImagesOp.cs" />
|
||||||
<Compile Include="BenchControl\Network\Camera\CLP1611\LiveStreamOp.cs" />
|
<Compile Include="BenchControl\Network\Camera\CLP1611\LiveStreamOp.cs" />
|
||||||
<Compile Include="BenchControl\Network\Camera\CLP1611\TerminalDlg.cs">
|
<Compile Include="BenchControl\Network\Camera\CLP1611\TerminalDlg.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@@ -843,12 +843,12 @@
|
|||||||
<Compile Include="BenchControl\TestMethods\FlyingStart\HeatMeters\TestParams.cs" />
|
<Compile Include="BenchControl\TestMethods\FlyingStart\HeatMeters\TestParams.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\FlyingStart\Single\Component.cs" />
|
<Compile Include="BenchControl\TestMethods\FlyingStart\Single\Component.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\FlyingStart\Single\Factory.cs" />
|
<Compile Include="BenchControl\TestMethods\FlyingStart\Single\Factory.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\GrabImage\Cfg.cs" />
|
<Compile Include="BenchControl\TestMethods\GrabImage\GrabImageCfg.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\GrabImage\CfgCtrl.cs">
|
<Compile Include="BenchControl\TestMethods\GrabImage\GrabImageCfgCtrl.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BenchControl\TestMethods\GrabImage\CfgCtrl.designer.cs">
|
<Compile Include="BenchControl\TestMethods\GrabImage\GrabImageCfgCtrl.designer.cs">
|
||||||
<DependentUpon>CfgCtrl.cs</DependentUpon>
|
<DependentUpon>GrabImageCfgCtrl.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BenchControl\TestMethods\GrabImage\Component.cs" />
|
<Compile Include="BenchControl\TestMethods\GrabImage\Component.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\GrabImage\Factory.cs" />
|
<Compile Include="BenchControl\TestMethods\GrabImage\Factory.cs" />
|
||||||
@@ -890,7 +890,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="BenchControl\TestMethods\iPerlCommunication\TestMethodFactory.cs" />
|
<Compile Include="BenchControl\TestMethods\iPerlCommunication\TestMethodFactory.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\LiveStream\Component.cs" />
|
<Compile Include="BenchControl\TestMethods\LiveStream\Component.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\LiveStream\Cfg.cs" />
|
<Compile Include="BenchControl\TestMethods\LiveStream\LiveStreamCfg.cs" />
|
||||||
<Compile Include="BenchControl\TestMethods\LiveStream\CfgCtrl.cs">
|
<Compile Include="BenchControl\TestMethods\LiveStream\CfgCtrl.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -2074,8 +2074,8 @@
|
|||||||
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\CycleDlg.ru.resx">
|
<EmbeddedResource Include="BenchControl\TestMethods\Endurance\CycleDlg.ru.resx">
|
||||||
<DependentUpon>CycleDlg.cs</DependentUpon>
|
<DependentUpon>CycleDlg.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="BenchControl\TestMethods\GrabImage\CfgCtrl.resx">
|
<EmbeddedResource Include="BenchControl\TestMethods\GrabImage\GrabImageCfgCtrl.resx">
|
||||||
<DependentUpon>CfgCtrl.cs</DependentUpon>
|
<DependentUpon>GrabImageCfgCtrl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="BenchControl\TestMethods\iPerlCommunication\iPerlHead\IperlHeadCfgCtrl.resx">
|
<EmbeddedResource Include="BenchControl\TestMethods\iPerlCommunication\iPerlHead\IperlHeadCfgCtrl.resx">
|
||||||
<DependentUpon>IperlHeadCfgCtrl.cs</DependentUpon>
|
<DependentUpon>IperlHeadCfgCtrl.cs</DependentUpon>
|
||||||
|
|||||||
Reference in New Issue
Block a user