Changes done in Munich : Roi CfgChangeHandler, new component, new Headpic, etc.

This commit is contained in:
Milan Hanajik
2017-01-17 16:49:47 +01:00
parent 2ced1417ed
commit cf876aabd2
12 changed files with 204 additions and 135 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 71 KiB

+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.12.393.0")] [assembly: AssemblyVersion("2.12.437.0")]
[assembly: AssemblyFileVersion("2.12.393.0")] [assembly: AssemblyFileVersion("2.12.437.0")]
+1 -1
View File
@@ -32,7 +32,7 @@ namespace TBF.BenchControl
public enum CfgChangeCmd public enum CfgChangeCmd
{ {
None, None,
CfgChange, /// COnfiguation change CfgChange, /// Configuation change
ValveOpen, /// Open a valve ValveOpen, /// Open a valve
ValveClose, /// Close a valve ValveClose, /// Close a valve
RVOpenStep, /// Open a regulation valve (RV only) RVOpenStep, /// Open a regulation valve (RV only)
@@ -31,103 +31,104 @@ namespace TBF.BenchControl.Network.Adapter
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.nameTextBox = new System.Windows.Forms.TextBox(); this.nameTextBox = new System.Windows.Forms.TextBox();
this.nameLabel = new System.Windows.Forms.Label(); this.nameLabel = new System.Windows.Forms.Label();
this.classNameLabel = new System.Windows.Forms.Label(); this.classNameLabel = new System.Windows.Forms.Label();
this.adapterLabel = new System.Windows.Forms.Label(); this.adapterLabel = new System.Windows.Forms.Label();
this.adapterComboBox = new System.Windows.Forms.ComboBox(); this.adapterComboBox = new System.Windows.Forms.ComboBox();
this.tftpEnabledCheckBox = new System.Windows.Forms.CheckBox(); this.tftpEnabledCheckBox = new System.Windows.Forms.CheckBox();
this.tftpDirectoryLabel = new System.Windows.Forms.Label(); this.tftpDirectoryLabel = new System.Windows.Forms.Label();
this.tftpDirectoryTextBox = new System.Windows.Forms.TextBox(); this.tftpDirectoryTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// nameTextBox // nameTextBox
// //
this.nameTextBox.Enabled = false; this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(101, 50); this.nameTextBox.Location = new System.Drawing.Point(101, 50);
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(114, 20); this.nameTextBox.Size = new System.Drawing.Size(114, 20);
this.nameTextBox.TabIndex = 5; this.nameTextBox.TabIndex = 5;
// //
// nameLabel // nameLabel
// //
this.nameLabel.AutoSize = true; this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(9, 53); this.nameLabel.Location = new System.Drawing.Point(9, 53);
this.nameLabel.Name = "nameLabel"; this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13); this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 4; this.nameLabel.TabIndex = 4;
this.nameLabel.Text = "Name"; this.nameLabel.Text = "Name";
// //
// classNameLabel // classNameLabel
// //
this.classNameLabel.AutoSize = true; this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(98, 24); this.classNameLabel.Location = new System.Drawing.Point(98, 24);
this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(83, 13); this.classNameLabel.Size = new System.Drawing.Size(83, 13);
this.classNameLabel.TabIndex = 3; this.classNameLabel.TabIndex = 3;
this.classNameLabel.Text = "ComonentName"; this.classNameLabel.Text = "ComonentName";
// //
// adapterLabel // adapterLabel
// //
this.adapterLabel.AutoSize = true; this.adapterLabel.AutoSize = true;
this.adapterLabel.Location = new System.Drawing.Point(9, 80); this.adapterLabel.Location = new System.Drawing.Point(9, 80);
this.adapterLabel.Name = "adapterLabel"; this.adapterLabel.Name = "adapterLabel";
this.adapterLabel.Size = new System.Drawing.Size(44, 13); this.adapterLabel.Size = new System.Drawing.Size(44, 13);
this.adapterLabel.TabIndex = 6; this.adapterLabel.TabIndex = 6;
this.adapterLabel.Text = "Adapter"; this.adapterLabel.Text = "Adapter";
// //
// adapterComboBox // adapterComboBox
// //
this.adapterComboBox.Location = new System.Drawing.Point(101, 77); this.adapterComboBox.Enabled = false;
this.adapterComboBox.Name = "adapterComboBox"; this.adapterComboBox.Location = new System.Drawing.Point(101, 77);
this.adapterComboBox.Size = new System.Drawing.Size(333, 21); this.adapterComboBox.Name = "adapterComboBox";
this.adapterComboBox.TabIndex = 7; this.adapterComboBox.Size = new System.Drawing.Size(333, 21);
// this.adapterComboBox.TabIndex = 7;
// tftpEnabledCheckBox //
// // tftpEnabledCheckBox
this.tftpEnabledCheckBox.AutoSize = true; //
this.tftpEnabledCheckBox.Enabled = false; this.tftpEnabledCheckBox.AutoSize = true;
this.tftpEnabledCheckBox.Location = new System.Drawing.Point(101, 115); this.tftpEnabledCheckBox.Enabled = false;
this.tftpEnabledCheckBox.Name = "tftpEnabledCheckBox"; this.tftpEnabledCheckBox.Location = new System.Drawing.Point(101, 115);
this.tftpEnabledCheckBox.Size = new System.Drawing.Size(121, 17); this.tftpEnabledCheckBox.Name = "tftpEnabledCheckBox";
this.tftpEnabledCheckBox.TabIndex = 12; this.tftpEnabledCheckBox.Size = new System.Drawing.Size(121, 17);
this.tftpEnabledCheckBox.Text = "Enable TFTP server"; this.tftpEnabledCheckBox.TabIndex = 12;
this.tftpEnabledCheckBox.UseVisualStyleBackColor = true; this.tftpEnabledCheckBox.Text = "Enable TFTP server";
// this.tftpEnabledCheckBox.UseVisualStyleBackColor = true;
// tftpDirectoryLabel //
// // tftpDirectoryLabel
this.tftpDirectoryLabel.AutoSize = true; //
this.tftpDirectoryLabel.Location = new System.Drawing.Point(9, 144); this.tftpDirectoryLabel.AutoSize = true;
this.tftpDirectoryLabel.Name = "tftpDirectoryLabel"; this.tftpDirectoryLabel.Location = new System.Drawing.Point(9, 144);
this.tftpDirectoryLabel.Size = new System.Drawing.Size(79, 13); this.tftpDirectoryLabel.Name = "tftpDirectoryLabel";
this.tftpDirectoryLabel.TabIndex = 13; this.tftpDirectoryLabel.Size = new System.Drawing.Size(79, 13);
this.tftpDirectoryLabel.Text = "TFTP Directory"; this.tftpDirectoryLabel.TabIndex = 13;
// this.tftpDirectoryLabel.Text = "TFTP Directory";
// tftpDirectoryTextBox //
// // tftpDirectoryTextBox
this.tftpDirectoryTextBox.Enabled = false; //
this.tftpDirectoryTextBox.Location = new System.Drawing.Point(101, 141); this.tftpDirectoryTextBox.Enabled = false;
this.tftpDirectoryTextBox.Name = "tftpDirectoryTextBox"; this.tftpDirectoryTextBox.Location = new System.Drawing.Point(101, 141);
this.tftpDirectoryTextBox.Size = new System.Drawing.Size(333, 20); this.tftpDirectoryTextBox.Name = "tftpDirectoryTextBox";
this.tftpDirectoryTextBox.TabIndex = 14; this.tftpDirectoryTextBox.Size = new System.Drawing.Size(333, 20);
// this.tftpDirectoryTextBox.TabIndex = 14;
// NetadapterCfgCtrl //
// // NetadapterCfgCtrl
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.Controls.Add(this.tftpDirectoryTextBox); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tftpDirectoryLabel); this.Controls.Add(this.tftpDirectoryTextBox);
this.Controls.Add(this.tftpEnabledCheckBox); this.Controls.Add(this.tftpDirectoryLabel);
this.Controls.Add(this.adapterComboBox); this.Controls.Add(this.tftpEnabledCheckBox);
this.Controls.Add(this.adapterLabel); this.Controls.Add(this.adapterComboBox);
this.Controls.Add(this.nameTextBox); this.Controls.Add(this.adapterLabel);
this.Controls.Add(this.nameLabel); this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.classNameLabel); this.Controls.Add(this.nameLabel);
this.Name = "NetadapterCfgCtrl"; this.Controls.Add(this.classNameLabel);
this.Size = new System.Drawing.Size(450, 300); this.Name = "NetadapterCfgCtrl";
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load); this.Size = new System.Drawing.Size(450, 300);
this.ResumeLayout(false); this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
this.PerformLayout(); this.ResumeLayout(false);
this.PerformLayout();
} }
@@ -23,9 +23,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
readonly RoiCfg roiCfg; readonly RoiCfg roiCfg;
public readonly CLP1611.Camera NetCamera; public readonly CLP1611.Camera NetCamera;
public readonly Telnet.TelnetClient Telnet;
public readonly Roi PreviousRoi; public readonly Roi PreviousRoi;
public Telnet.TelnetClient Telnet;
/// ///
/// ICamera interface functions /// ICamera interface functions
/// ///
@@ -46,8 +47,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
/// ///
public bool Detected public bool Detected
{ {
get { return Detected; } get { return detected; }
set { Detected = value; } set { detected = value; }
} }
bool detected; bool detected;
/// ///
@@ -67,21 +68,49 @@ namespace TBF.BenchControl.Network.Camera.Roi
{ {
roiCfg = cfg as RoiCfg; roiCfg = cfg as RoiCfg;
NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera; NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera;
if (NetCamera != null) Telnet = NetCamera.Telnet;
PreviousRoi = TbfComponents.FindComponent(roiCfg.PreviousRoi, components) as Roi; PreviousRoi = TbfComponents.FindComponent(roiCfg.PreviousRoi, components) as Roi;
detected = false; detected = false;
RoiX = new Boxes.IntBox(); RoiX = new Boxes.IntBox();
RoiY = new Boxes.IntBox(); RoiY = new Boxes.IntBox();
RoiWid = new Boxes.IntBox(); RoiWid = new Boxes.IntBox();
RoiHgh = new Boxes.IntBox(); RoiHgh = new Boxes.IntBox();
Clear(); Clear();
log.Debug(this.ToString()); log.Debug(this.ToString());
} }
#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)
{
RoiCfg tmpcfg = args.Cfg as RoiCfg;
if (tmpcfg != null && tmpcfg.Name.Equals(Name))
{
if (args.Command == CfgChangeCmd.CfgChange)
{
roiCfg.RoiParams = tmpcfg.RoiParams;
}
}
};
}
#endregion Configuration Change Handling
public void Clear() public void Clear()
{ {
wmPulses = 0; wmPulses = 0;
@@ -93,9 +122,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
public IOperation RoiDetectionOp() public IOperation RoiDetectionOp()
{ {
if (NetCamera != null && Telnet != null) if (NetCamera != null && NetCamera.Telnet != null)
{ {
return new RoiDetectionOp(this, roiCfg.Args, RoiX, RoiY, RoiWid, RoiHgh); Telnet = NetCamera.Telnet;
return new RoiDetectionOp(this, roiCfg.RoiParams, RoiX, RoiY, RoiWid, RoiHgh);
} }
else else
{ {
@@ -15,7 +15,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
/// Serialized parameters /// Serialized parameters
/// ///
public string PreviousRoi; public string PreviousRoi;
public string Args; public string RoiParams;
/// <summary> Procedure parameters </summary> /// <summary> Procedure parameters </summary>
[XmlIgnore] [XmlIgnore]
@@ -40,12 +40,12 @@ namespace TBF.BenchControl.Network.Camera.Roi
Name = name; Name = name;
Factory = factory; Factory = factory;
ParentName = "Camera"; ParentName = "Camera";
Args = string.Empty; RoiParams = string.Empty;
} }
public string ToString(int i) public string ToString(int i)
{ {
return string.Format("Name={0}, Parent={1}, Args={2}", Name, ParentName, Args); return string.Format("Name={0}, Parent={1}, Params={2}", Name, ParentName, RoiParams);
} }
} }
} }
@@ -68,7 +68,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
nameTextBox.Text = config.Name; nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName; parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
previousRoiComboBox.Text = string.IsNullOrEmpty(config.PreviousRoi) ? "---" : config.PreviousRoi; previousRoiComboBox.Text = string.IsNullOrEmpty(config.PreviousRoi) ? "---" : config.PreviousRoi;
argsTextBox.Text = config.Args; argsTextBox.Text = config.RoiParams;
} }
public void Unlock() public void Unlock()
@@ -81,14 +81,36 @@ namespace TBF.BenchControl.Network.Camera.Roi
public CfgUpdateFlags UpdateCfg() public CfgUpdateFlags UpdateCfg()
{ {
CfgUpdateFlags flags = CfgUpdateFlags.RestartRqrd; CfgUpdateFlags flags = CfgUpdateFlags.None;
if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed if (config == null) return CfgUpdateFlags.Error; /// Control was not loaded, settings were not changed
config.Name = nameTextBox.Text; if (config.Name != nameTextBox.Text)
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text; {
config.PreviousRoi = previousRoiComboBox.Text.Equals("---") ? string.Empty : previousRoiComboBox.Text; config.Name = nameTextBox.Text;
config.Args = argsTextBox.Text; flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string newParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
if (config.ParentName != newParentName)
{
config.ParentName = newParentName;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
string newPreviousRoi = previousRoiComboBox.Text.Equals("---") ? string.Empty : previousRoiComboBox.Text;
if (config.PreviousRoi != newPreviousRoi)
{
config.PreviousRoi = newPreviousRoi;
flags |= (CfgUpdateFlags.RestartRqrd | CfgUpdateFlags.AnyChange);
}
if (config.RoiParams != argsTextBox.Text)
{
config.RoiParams = argsTextBox.Text;
flags |= CfgUpdateFlags.AnyChange;
Roi.OnCfgChange(this, new CfgChangeArgs(CfgChangeCmd.CfgChange, config));
}
return flags; return flags;
} }
@@ -111,5 +133,21 @@ namespace TBF.BenchControl.Network.Camera.Roi
return flags; return flags;
} }
}
#region Configuration Change Handling
public static void OnCmdResponse(object sender, CmdResponseArgs args)
{
if (CmdResponseHandler == null) return;
try { CmdResponseHandler(sender, args); }
catch (Exception e) { log.Error("CmdResponseHandler(...) failed", e); }
}
public static event EventHandler<CmdResponseArgs> CmdResponseHandler;
public void StartResponseHandler() { }
public void StopResponseHandler() { }
#endregion Configuration Change Handling
}
} }
@@ -17,10 +17,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
bool failed; bool failed;
bool previousFailed; bool previousFailed;
Boxes.IntBox oroiX; Boxes.IntBox roiX;
Boxes.IntBox oroiY; Boxes.IntBox roiY;
Boxes.IntBox oroiWid; Boxes.IntBox roiWid;
Boxes.IntBox oroiHgh; Boxes.IntBox roiHgh; /// Wid and Hgh are usefull when masking
@@ -28,17 +28,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, string args, Boxes.IntBox oroiX, Boxes.IntBox oroiY, public RoiDetectionOp(Roi roi, string args, Boxes.IntBox roiX, Boxes.IntBox roiY,
Boxes.IntBox oroiWid, Boxes.IntBox oroiHgh) Boxes.IntBox roiWid, Boxes.IntBox roiHgh)
{ {
this.roi = roi; this.roi = roi;
this.camera = roi.NetCamera; this.camera = roi.NetCamera;
this.telnet = roi.Telnet; this.telnet = roi.Telnet;
this.args = args; this.args = args;
this.oroiX = oroiX; this.roiX = roiX;
this.oroiY = oroiY; this.roiY = roiY;
this.oroiWid = oroiWid; this.roiWid = roiWid;
this.oroiHgh = oroiHgh; this.roiHgh = roiHgh;
roiDetectionCommandSent = false; roiDetectionCommandSent = false;
@@ -123,10 +123,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
} }
else else
{ {
oroiX.Val = x; roiX.Val = x;
oroiY.Val = y; roiY.Val = y;
oroiWid.Val = w; roiWid.Val = w;
oroiHgh.Val = h; roiHgh.Val = h;
passed = true; passed = true;
return Event.RoiDetectionPassed; return Event.RoiDetectionPassed;
@@ -124,7 +124,7 @@ namespace TBF.BenchControl.Sequences
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
IntBox remainingTime = new IntBox(); IntBox remainingTime = new IntBox();
State startNew = State.Create("MainSeq : Emptying tanks, Starting cameras") State startNew = State.Create("MainSeq : Emptying tanks")
.AddOperation(checkUiOp); .AddOperation(checkUiOp);
IList<IValve> allEmptyingValves = new List<IValve>(); IList<IValve> allEmptyingValves = new List<IValve>();
if (StateMachine.EmptyTankValve1 != null) allEmptyingValves.Add(StateMachine.EmptyTankValve1); if (StateMachine.EmptyTankValve1 != null) allEmptyingValves.Add(StateMachine.EmptyTankValve1);
@@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number // Build Number
// Revision // Revision
// //
[assembly: AssemblyVersion("2.12.436.1")] [assembly: AssemblyVersion("2.12.437.1")]
[assembly: AssemblyFileVersion("2.12.436.1")] [assembly: AssemblyFileVersion("2.12.437.1")]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 71 KiB