Network.Camera bug fixes, Operations.ReturnGivenEventOp added, usefull for debuging, ver.2.12.451

This commit is contained in:
Milan Hanajik 2017-01-27 16:35:51 +01:00
parent 3f311d8603
commit f318cfe6f0
7 changed files with 54 additions and 9 deletions

View File

@ -528,8 +528,15 @@ ControlComponent_Izrael2014.UserControl1 ctrlBrdComponent,
float requiredFlowLo, float requiredFlowHi,
int refPulses, float filterConstant)
{
return new StartMeasurementOp(this, outputPath, method,
requiredFlowLo, requiredFlowHi, refPulses, filterConstant);
if (controlBoardCfg.DebugLevel == DebugMode.Simulate)
{
return new Operations.ReturnGivenEventOp(Event.MeasurementStarted);
}
else
{
return new StartMeasurementOp(this, outputPath, method, requiredFlowLo, requiredFlowHi,
refPulses, filterConstant);
}
}
/// <summary>

View File

@ -75,13 +75,11 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
public int GetResult(int roiHandle)
{
if (roiHandle > 0 && roiHandle <= roiParams.Count)
{
return 0;
}
else
{
return result[roiHandle - 1];
}
return 0;
}
@ -371,7 +369,7 @@ namespace TBF.BenchControl.Network.Camera.CLP1611
for (int i = 0; i < result.Length; i++)
{
int val;
if (int.TryParse(pulsesArr[i + 1], out val)) result[i] = val;
if (int.TryParse(pulsesArr[i + 1], out val)) result[i] = Math.Abs(val);
}
}
}

View File

@ -112,6 +112,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
int to = response.IndexOf(']');
if (!response.Contains("RESULT=0\r\n") || from < 0 || to < 0 || to < from)
{
roi.Detected = false;
failed = true;
return Event.RoiDetectionFailed;
}
@ -123,6 +124,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
if (terms.Length != 5 || !int.TryParse(terms[0], out x) || !int.TryParse(terms[1], out y)
|| !int.TryParse(terms[2], out w) || !int.TryParse(terms[3], out h))
{
roi.Detected = false;
failed = true;
return Event.RoiDetectionFailed;
}
@ -133,6 +135,7 @@ namespace TBF.BenchControl.Network.Camera.Roi
roiWid.Val = w;
roiHgh.Val = h;
roi.Detected = true;
passed = true;
return Event.RoiDetectionPassed;
}

View File

@ -0,0 +1,36 @@
///
/// Copyright (c) 2017 Sensus Metering Systems
///
using log4net;
namespace TBF.BenchControl.Operations
{
/// <summary>
/// Operation usefull for debugging
/// </summary>
class ReturnGivenEventOp : IOperation
{
private static readonly ILog log = LogManager.GetLogger(typeof(ReturnGivenEventOp));
public override string ToString() { return string.Format("ReturnGivenEventOp({0})", givenEvent); }
/// Set by the constructor
readonly Event givenEvent;
/// <summary>
/// Constructor
/// </summary>
public ReturnGivenEventOp(Event givenEvent)
{
this.givenEvent = givenEvent;
}
public void Start() {}
public Event Run()
{
return givenEvent;
}
public void Stop() {}
}
}

View File

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

View File

@ -561,6 +561,7 @@
<Compile Include="BenchControl\Network\Tftp\TftpServer.cs" />
<Compile Include="BenchControl\Operations\EnduranceDataLoggingOp.cs" />
<Compile Include="BenchControl\Operations\EnthalpyCalculationOp.cs" />
<Compile Include="BenchControl\Operations\ReturnGivenEventOp.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryCompound.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactoryHeatMeters.cs" />
<Compile Include="BenchControl\Output\FileWriters\Basic\FactorySingle.cs" />