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

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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.12.393.0")]
[assembly: AssemblyFileVersion("2.12.393.0")]
[assembly: AssemblyVersion("2.12.437.0")]
[assembly: AssemblyFileVersion("2.12.437.0")]

View File

@ -32,7 +32,7 @@ namespace TBF.BenchControl
public enum CfgChangeCmd
{
None,
CfgChange, /// COnfiguation change
CfgChange, /// Configuation change
ValveOpen, /// Open a valve
ValveClose, /// Close a valve
RVOpenStep, /// Open a regulation valve (RV only)

View File

@ -78,6 +78,7 @@ namespace TBF.BenchControl.Network.Adapter
//
// adapterComboBox
//
this.adapterComboBox.Enabled = false;
this.adapterComboBox.Location = new System.Drawing.Point(101, 77);
this.adapterComboBox.Name = "adapterComboBox";
this.adapterComboBox.Size = new System.Drawing.Size(333, 21);

View File

@ -23,9 +23,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
readonly RoiCfg roiCfg;
public readonly CLP1611.Camera NetCamera;
public readonly Telnet.TelnetClient Telnet;
public readonly Roi PreviousRoi;
public Telnet.TelnetClient Telnet;
///
/// ICamera interface functions
///
@ -46,8 +47,8 @@ namespace TBF.BenchControl.Network.Camera.Roi
///
public bool Detected
{
get { return Detected; }
set { Detected = value; }
get { return detected; }
set { detected = value; }
}
bool detected;
///
@ -67,7 +68,6 @@ namespace TBF.BenchControl.Network.Camera.Roi
{
roiCfg = cfg as RoiCfg;
NetCamera = TbfComponents.FindComponent(cfg.ParentName, components) as CLP1611.Camera;
if (NetCamera != null) Telnet = NetCamera.Telnet;
PreviousRoi = TbfComponents.FindComponent(roiCfg.PreviousRoi, components) as Roi;
@ -82,6 +82,35 @@ namespace TBF.BenchControl.Network.Camera.Roi
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()
{
wmPulses = 0;
@ -93,9 +122,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
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
{

View File

@ -15,7 +15,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
/// Serialized parameters
///
public string PreviousRoi;
public string Args;
public string RoiParams;
/// <summary> Procedure parameters </summary>
[XmlIgnore]
@ -40,12 +40,12 @@ namespace TBF.BenchControl.Network.Camera.Roi
Name = name;
Factory = factory;
ParentName = "Camera";
Args = string.Empty;
RoiParams = string.Empty;
}
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);
}
}
}

View File

@ -68,7 +68,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
nameTextBox.Text = config.Name;
parentNameComboBox.Text = string.IsNullOrEmpty(config.ParentName) ? "---" : config.ParentName;
previousRoiComboBox.Text = string.IsNullOrEmpty(config.PreviousRoi) ? "---" : config.PreviousRoi;
argsTextBox.Text = config.Args;
argsTextBox.Text = config.RoiParams;
}
public void Unlock()
@ -81,14 +81,36 @@ namespace TBF.BenchControl.Network.Camera.Roi
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.Name != nameTextBox.Text)
{
config.Name = nameTextBox.Text;
config.ParentName = parentNameComboBox.Text.Equals("---") ? string.Empty : parentNameComboBox.Text;
config.PreviousRoi = previousRoiComboBox.Text.Equals("---") ? string.Empty : previousRoiComboBox.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;
}
@ -111,5 +133,21 @@ namespace TBF.BenchControl.Network.Camera.Roi
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
}
}

View File

@ -17,10 +17,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
bool failed;
bool previousFailed;
Boxes.IntBox oroiX;
Boxes.IntBox oroiY;
Boxes.IntBox oroiWid;
Boxes.IntBox oroiHgh;
Boxes.IntBox roiX;
Boxes.IntBox roiY;
Boxes.IntBox roiWid;
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
/// </summary>
/// <param name="camera">CLP1611.Camera reference</param>
public RoiDetectionOp(Roi roi, string args, Boxes.IntBox oroiX, Boxes.IntBox oroiY,
Boxes.IntBox oroiWid, Boxes.IntBox oroiHgh)
public RoiDetectionOp(Roi roi, string args, Boxes.IntBox roiX, Boxes.IntBox roiY,
Boxes.IntBox roiWid, Boxes.IntBox roiHgh)
{
this.roi = roi;
this.camera = roi.NetCamera;
this.telnet = roi.Telnet;
this.args = args;
this.oroiX = oroiX;
this.oroiY = oroiY;
this.oroiWid = oroiWid;
this.oroiHgh = oroiHgh;
this.roiX = roiX;
this.roiY = roiY;
this.roiWid = roiWid;
this.roiHgh = roiHgh;
roiDetectionCommandSent = false;
@ -123,10 +123,10 @@ namespace TBF.BenchControl.Network.Camera.Roi
}
else
{
oroiX.Val = x;
oroiY.Val = y;
oroiWid.Val = w;
oroiHgh.Val = h;
roiX.Val = x;
roiY.Val = y;
roiWid.Val = w;
roiHgh.Val = h;
passed = true;
return Event.RoiDetectionPassed;

View File

@ -124,7 +124,7 @@ namespace TBF.BenchControl.Sequences
//--------------------------------------------------------------------------------------------
IntBox remainingTime = new IntBox();
State startNew = State.Create("MainSeq : Emptying tanks, Starting cameras")
State startNew = State.Create("MainSeq : Emptying tanks")
.AddOperation(checkUiOp);
IList<IValve> allEmptyingValves = new List<IValve>();
if (StateMachine.EmptyTankValve1 != null) allEmptyingValves.Add(StateMachine.EmptyTankValve1);

View File

@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
[assembly: AssemblyVersion("2.12.436.1")]
[assembly: AssemblyFileVersion("2.12.436.1")]
[assembly: AssemblyVersion("2.12.437.1")]
[assembly: AssemblyFileVersion("2.12.437.1")]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 71 KiB