Camera.CLP1611 : TestImagesMode itroduced, passed to Measurement command, ver. 2.17.719
This commit is contained in:
@@ -297,7 +297,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
if (args.Command == CfgChangeCmd.CfgChange)
|
||||
{
|
||||
CameraCfg.UseTestImages = tmpcfg.UseTestImages;
|
||||
CameraCfg.TestImagesMode = tmpcfg.TestImagesMode;
|
||||
CameraCfg.TestImagesCount = tmpcfg.TestImagesCount;
|
||||
}
|
||||
}
|
||||
@@ -539,7 +539,6 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
|
||||
|
||||
|
||||
public IOperation LiveStreamOp(bool hiRes)
|
||||
{
|
||||
int wid = hiRes ? 1280 : 640;
|
||||
@@ -580,11 +579,29 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
/// Prepare the telent command
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var s in roiParams) sb.AppendFormat(" {0}", s);
|
||||
command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 7 0 0 0",
|
||||
|
||||
int logImagesArg;
|
||||
switch (CameraCfg.TestImagesMode)
|
||||
{
|
||||
default:
|
||||
case TestImagesMode.None:
|
||||
case TestImagesMode.LoadImages:
|
||||
logImagesArg = 0;
|
||||
break;
|
||||
case TestImagesMode.SaveFirstImages:
|
||||
logImagesArg = CameraCfg.TestImagesCount;
|
||||
break;
|
||||
case TestImagesMode.SaveLastImages:
|
||||
logImagesArg = -CameraCfg.TestImagesCount;
|
||||
break;
|
||||
}
|
||||
|
||||
command = string.Format("clp/Measurement -udp {0} {1}{2}{3} 1 7 0 0 {4}",
|
||||
NetAdapter.IPAddress,
|
||||
measurementUdpPortNr,
|
||||
CameraCfg.UseTestImages ? (" -l " + CameraCfg.TestImagesCount.ToString()) : string.Empty,
|
||||
sb);
|
||||
(CameraCfg.TestImagesMode == TestImagesMode.LoadImages) ? (" -l " + CameraCfg.TestImagesCount.ToString()) : string.Empty,
|
||||
sb,
|
||||
logImagesArg);
|
||||
|
||||
measurementCommandSent = false;
|
||||
connectionEstablished = false;
|
||||
|
||||
@@ -9,6 +9,15 @@ using TBF.Resources;
|
||||
|
||||
namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
{
|
||||
public enum TestImagesMode
|
||||
{
|
||||
None,
|
||||
SaveFirstImages,
|
||||
SaveLastImages,
|
||||
LoadImages,
|
||||
Count,
|
||||
}
|
||||
|
||||
public class CameraCfg : ComponentCfgBase, IChildComponentCfg
|
||||
{
|
||||
public static XmlSerializer Serializer = XmlSerializer.FromTypes(new[] { typeof(CameraCfg) })[0];
|
||||
@@ -21,7 +30,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
///
|
||||
public int HardwareAddress;
|
||||
public bool DisplayTerminal;
|
||||
public bool UseTestImages;
|
||||
public TestImagesMode TestImagesMode;
|
||||
public int TestImagesCount;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
@@ -34,18 +43,19 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
Factory = factory;
|
||||
ParentName = "Network.Adapter";
|
||||
HardwareAddress = 1;
|
||||
UseTestImages = false;
|
||||
TestImagesCount = 0;
|
||||
TestImagesMode = TestImagesMode.None;
|
||||
TestImagesCount = 200;
|
||||
DebugLevel = Config.Entities.DebugMode.AutoDetect;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, s/n={1}, Terminal={2}, Use test images={3}, Parent={4}",
|
||||
return string.Format("Name={0}, s/n={1}, Terminal={2}, TestImagesMode={3}, TestImagesCount={4}, Parent={5}",
|
||||
Name,
|
||||
HardwareAddress,
|
||||
DisplayTerminal ? Strings.yes : Strings.no,
|
||||
UseTestImages ? Strings.yes : Strings.no,
|
||||
TestImagesMode,
|
||||
TestImagesCount,
|
||||
ParentName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
}
|
||||
}
|
||||
|
||||
for (TestImagesMode mode = 0; mode < TestImagesMode.Count; mode++)
|
||||
{
|
||||
testImagesModeComboBox.Items.Add(mode.ToString());
|
||||
}
|
||||
|
||||
Redraw();
|
||||
}
|
||||
|
||||
@@ -72,9 +77,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
nameTextBox.Text = config.Name;
|
||||
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
|
||||
hwAddressTextBox.Text = config.HardwareAddress.ToString();
|
||||
useTestImagesCheckBox.Checked = config.UseTestImages;
|
||||
testImagesCountTextBox.Text = config.TestImagesCount.ToString();
|
||||
displayTerminalCheckBox.Checked = config.DisplayTerminal;
|
||||
testImagesModeComboBox.Text = config.TestImagesMode.ToString();
|
||||
testImagesCountTextBox.Text = config.TestImagesCount.ToString();
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@@ -82,9 +87,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
nameTextBox.Enabled = true;
|
||||
parentNameComboBox.Enabled = true;
|
||||
hwAddressTextBox.Enabled = true;
|
||||
useTestImagesCheckBox.Enabled = true;
|
||||
testImagesCountTextBox.Enabled = true;
|
||||
displayTerminalCheckBox.Enabled = true;
|
||||
testImagesModeComboBox.Enabled = true;
|
||||
testImagesCountTextBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@@ -104,13 +109,19 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
message += Environment.NewLine + string.Format("'{0}' is not correct", hwAddressLabel.Text);
|
||||
}
|
||||
|
||||
if (useTestImagesCheckBox.Checked &&
|
||||
(!int.TryParse(testImagesCountTextBox.Text, out dummy) || dummy < 1 || dummy > 50))
|
||||
if (!testImagesModeComboBox.Items.Contains(testImagesModeComboBox.Text))
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + string.Format("'{0}' should be between 1 and 50", testImagesCountLabel.Text);
|
||||
message += Environment.NewLine + string.Format("Invalid {0}", testImagesModeLabel.Text);
|
||||
}
|
||||
|
||||
if (!int.TryParse(testImagesCountTextBox.Text, out dummy) || dummy < 1 || dummy > 200)
|
||||
{
|
||||
flags |= CfgUpdateFlags.Error;
|
||||
message += Environment.NewLine + string.Format("Invalid {0}", testImagesCountLabel.Text);
|
||||
}
|
||||
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
@@ -122,8 +133,14 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
|
||||
string newParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
|
||||
int newHWAddress = int.Parse(hwAddressTextBox.Text);
|
||||
TestImagesMode newTestImagesMode = 0;
|
||||
for (TestImagesMode mode = 0; mode < TestImagesMode.Count; mode++)
|
||||
{
|
||||
if (testImagesModeComboBox.Text == mode.ToString()) newTestImagesMode = mode;
|
||||
}
|
||||
int newTestImagesCount = int.Parse(testImagesCountTextBox.Text);
|
||||
|
||||
|
||||
if (config.Name != nameTextBox.Text ||
|
||||
config.ParentName != newParentName ||
|
||||
config.HardwareAddress != newHWAddress ||
|
||||
@@ -137,10 +154,11 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
|
||||
}
|
||||
|
||||
if (config.UseTestImages != useTestImagesCheckBox.Checked ||
|
||||
|
||||
if (config.TestImagesMode != newTestImagesMode ||
|
||||
config.TestImagesCount != newTestImagesCount)
|
||||
{
|
||||
config.UseTestImages = useTestImagesCheckBox.Checked;
|
||||
config.TestImagesMode = newTestImagesMode;
|
||||
config.TestImagesCount = newTestImagesCount;
|
||||
|
||||
flags |= (CfgUpdateFlags.InvokeCfgChange | CfgUpdateFlags.AnyChange);
|
||||
|
||||
+33
-23
@@ -39,15 +39,16 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
this.classNameLabel = new System.Windows.Forms.Label();
|
||||
this.parentNameComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.displayTerminalCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.useTestImagesCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.testImagesCountTextBox = new System.Windows.Forms.TextBox();
|
||||
this.testImagesCountLabel = new System.Windows.Forms.Label();
|
||||
this.testImagesModeComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.testImagesModeLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// hwAddressTextBox
|
||||
//
|
||||
this.hwAddressTextBox.Enabled = false;
|
||||
this.hwAddressTextBox.Location = new System.Drawing.Point(114, 92);
|
||||
this.hwAddressTextBox.Location = new System.Drawing.Point(132, 92);
|
||||
this.hwAddressTextBox.Name = "hwAddressTextBox";
|
||||
this.hwAddressTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.hwAddressTextBox.TabIndex = 6;
|
||||
@@ -73,7 +74,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
// nameTextBox
|
||||
//
|
||||
this.nameTextBox.Enabled = false;
|
||||
this.nameTextBox.Location = new System.Drawing.Point(114, 41);
|
||||
this.nameTextBox.Location = new System.Drawing.Point(132, 41);
|
||||
this.nameTextBox.Name = "nameTextBox";
|
||||
this.nameTextBox.Size = new System.Drawing.Size(130, 20);
|
||||
this.nameTextBox.TabIndex = 2;
|
||||
@@ -90,7 +91,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
// classNameLabel
|
||||
//
|
||||
this.classNameLabel.AutoSize = true;
|
||||
this.classNameLabel.Location = new System.Drawing.Point(111, 17);
|
||||
this.classNameLabel.Location = new System.Drawing.Point(129, 17);
|
||||
this.classNameLabel.Name = "classNameLabel";
|
||||
this.classNameLabel.Size = new System.Drawing.Size(83, 13);
|
||||
this.classNameLabel.TabIndex = 0;
|
||||
@@ -100,7 +101,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
//
|
||||
this.parentNameComboBox.Enabled = false;
|
||||
this.parentNameComboBox.FormattingEnabled = true;
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(114, 66);
|
||||
this.parentNameComboBox.Location = new System.Drawing.Point(132, 66);
|
||||
this.parentNameComboBox.Name = "parentNameComboBox";
|
||||
this.parentNameComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.parentNameComboBox.TabIndex = 4;
|
||||
@@ -109,28 +110,17 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
//
|
||||
this.displayTerminalCheckBox.AutoSize = true;
|
||||
this.displayTerminalCheckBox.Enabled = false;
|
||||
this.displayTerminalCheckBox.Location = new System.Drawing.Point(114, 122);
|
||||
this.displayTerminalCheckBox.Location = new System.Drawing.Point(133, 122);
|
||||
this.displayTerminalCheckBox.Name = "displayTerminalCheckBox";
|
||||
this.displayTerminalCheckBox.Size = new System.Drawing.Size(99, 17);
|
||||
this.displayTerminalCheckBox.TabIndex = 7;
|
||||
this.displayTerminalCheckBox.Text = "Display terminal";
|
||||
this.displayTerminalCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// useTestImagesCheckBox
|
||||
//
|
||||
this.useTestImagesCheckBox.AutoSize = true;
|
||||
this.useTestImagesCheckBox.Enabled = false;
|
||||
this.useTestImagesCheckBox.Location = new System.Drawing.Point(114, 156);
|
||||
this.useTestImagesCheckBox.Name = "useTestImagesCheckBox";
|
||||
this.useTestImagesCheckBox.Size = new System.Drawing.Size(101, 17);
|
||||
this.useTestImagesCheckBox.TabIndex = 10;
|
||||
this.useTestImagesCheckBox.Text = "Use test images";
|
||||
this.useTestImagesCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// testImagesCountTextBox
|
||||
//
|
||||
this.testImagesCountTextBox.Enabled = false;
|
||||
this.testImagesCountTextBox.Location = new System.Drawing.Point(114, 178);
|
||||
this.testImagesCountTextBox.Location = new System.Drawing.Point(132, 174);
|
||||
this.testImagesCountTextBox.Name = "testImagesCountTextBox";
|
||||
this.testImagesCountTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.testImagesCountTextBox.TabIndex = 12;
|
||||
@@ -138,21 +128,40 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
// testImagesCountLabel
|
||||
//
|
||||
this.testImagesCountLabel.AutoSize = true;
|
||||
this.testImagesCountLabel.Location = new System.Drawing.Point(28, 181);
|
||||
this.testImagesCountLabel.Location = new System.Drawing.Point(28, 177);
|
||||
this.testImagesCountLabel.Name = "testImagesCountLabel";
|
||||
this.testImagesCountLabel.Size = new System.Drawing.Size(71, 13);
|
||||
this.testImagesCountLabel.Size = new System.Drawing.Size(94, 13);
|
||||
this.testImagesCountLabel.TabIndex = 11;
|
||||
this.testImagesCountLabel.Text = "Images count";
|
||||
this.testImagesCountLabel.Text = "Test images count";
|
||||
//
|
||||
// testImagesModeComboBox
|
||||
//
|
||||
this.testImagesModeComboBox.Enabled = false;
|
||||
this.testImagesModeComboBox.FormattingEnabled = true;
|
||||
this.testImagesModeComboBox.Location = new System.Drawing.Point(132, 148);
|
||||
this.testImagesModeComboBox.Name = "testImagesModeComboBox";
|
||||
this.testImagesModeComboBox.Size = new System.Drawing.Size(130, 21);
|
||||
this.testImagesModeComboBox.TabIndex = 14;
|
||||
//
|
||||
// testImagesModeLabel
|
||||
//
|
||||
this.testImagesModeLabel.AutoSize = true;
|
||||
this.testImagesModeLabel.Location = new System.Drawing.Point(28, 151);
|
||||
this.testImagesModeLabel.Name = "testImagesModeLabel";
|
||||
this.testImagesModeLabel.Size = new System.Drawing.Size(93, 13);
|
||||
this.testImagesModeLabel.TabIndex = 13;
|
||||
this.testImagesModeLabel.Text = "Test images mode";
|
||||
//
|
||||
// CameraCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.testImagesModeComboBox);
|
||||
this.Controls.Add(this.testImagesModeLabel);
|
||||
this.Controls.Add(this.hwAddressTextBox);
|
||||
this.Controls.Add(this.hwAddressLabel);
|
||||
this.Controls.Add(this.testImagesCountTextBox);
|
||||
this.Controls.Add(this.testImagesCountLabel);
|
||||
this.Controls.Add(this.useTestImagesCheckBox);
|
||||
this.Controls.Add(this.displayTerminalCheckBox);
|
||||
this.Controls.Add(this.parentNameComboBox);
|
||||
this.Controls.Add(this.parentNameLabel);
|
||||
@@ -177,8 +186,9 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
|
||||
private System.Windows.Forms.Label classNameLabel;
|
||||
private System.Windows.Forms.ComboBox parentNameComboBox;
|
||||
private System.Windows.Forms.CheckBox displayTerminalCheckBox;
|
||||
private System.Windows.Forms.CheckBox useTestImagesCheckBox;
|
||||
private System.Windows.Forms.TextBox testImagesCountTextBox;
|
||||
private System.Windows.Forms.Label testImagesCountLabel;
|
||||
private System.Windows.Forms.ComboBox testImagesModeComboBox;
|
||||
private System.Windows.Forms.Label testImagesModeLabel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.17.718.1")]
|
||||
[assembly: AssemblyFileVersion("2.17.718.1")]
|
||||
[assembly: AssemblyVersion("2.17.719.1")]
|
||||
[assembly: AssemblyFileVersion("2.17.719.1")]
|
||||
|
||||
Reference in New Issue
Block a user