Merge branch 'main' of https://slm.sms-esaap.com/la_operations/laa_production
This commit is contained in:
@@ -155,7 +155,7 @@
|
|||||||
</site>
|
</site>
|
||||||
<site name="MeterProcessState" id="2">
|
<site name="MeterProcessState" id="2">
|
||||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||||
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
|
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\LAA_PRODUCTION\Common\Service\MeterProcessState" />
|
||||||
</application>
|
</application>
|
||||||
<bindings>
|
<bindings>
|
||||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||||
|
|||||||
@@ -584,736 +584,6 @@ namespace CordonelAssemblyLine.Model
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var genesisStatus = new GenesisStatus();
|
var genesisStatus = new GenesisStatus();
|
||||||
|
|
||||||
// this calculates all life time values
|
// this calculates all life time values
|
||||||
@@ -1347,8 +617,15 @@ namespace CordonelAssemblyLine.Model
|
|||||||
lblS08Color = _progressError;
|
lblS08Color = _progressError;
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
|
if (_orderDetails.FrequencyIndicator == 0)
|
||||||
|
{
|
||||||
|
if ((342000000 + (genesisStatus.ExceededLifeTime_s * 77.7)) <= genesisStatus.DrainedBatteryLoad_uAs)
|
||||||
|
{
|
||||||
|
lblS08Text = $"UNT Limit überschritten";
|
||||||
|
lblS08Color = _progressError;
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
meter.WriteLog(sbMSG.ToString());
|
meter.WriteLog(sbMSG.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
|
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
|
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
|
||||||
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
|
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
|
||||||
@@ -110,9 +110,7 @@
|
|||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup>
|
<PropertyGroup />
|
||||||
<NoWin32Manifest>true</NoWin32Manifest>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||||
|
|||||||
@@ -159,36 +159,6 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
|||||||
Ok = true;
|
Ok = true;
|
||||||
#endregion
|
#endregion
|
||||||
#region Calculate mean value
|
#region Calculate mean value
|
||||||
|
|
||||||
if (true)
|
|
||||||
{
|
|
||||||
var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(1).ToList().Mean();
|
|
||||||
pp.DebugMessage($"Calculate mean value {meanVal} at {meterctl.Meter.Slot}; PATH{(1 + 1).ToString(pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
|
||||||
//earlier TofAvgMeanTotal
|
|
||||||
//TofAvgMean.Update(Path, meanVal);
|
|
||||||
|
|
||||||
if (meanVal == 0)
|
|
||||||
{
|
|
||||||
pp.DebugMessage($"Mean value is zero at {meterctl.Meter.Slot}; PATH{(1 + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
|
||||||
meterctl.Meter.calibrationResult.AddAdditionalLog($"" +
|
|
||||||
$"PATH {1 + 1}", Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture));
|
|
||||||
|
|
||||||
if (CheckAbort(false, meterctl)) { return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
pp.DebugMessage($"Mean value at {meterctl.Meter.Slot}; PATH{(1 + 1).ToString(pp.Setting.Culture)}; Value = {Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
|
|
||||||
|
|
||||||
meterctl.Meter.calibrationResult.AddAdditionalLog($"Amp. Test Mean value PATH {1 + 1}", $"at {FirstHitLevelPercentage}={Math.Round(meanVal, 4).ToString("000.0000", pp.Setting.Culture)}");
|
|
||||||
var cTofAvgMeanTotal = TofAvgMeanTotal.Get(1).ToList();
|
|
||||||
|
|
||||||
cTofAvgMeanTotal.Add(meanVal);
|
|
||||||
TofAvgMeanTotal.Update(1, cTofAvgMeanTotal);
|
|
||||||
//meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List<Double>());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++)
|
for (UInt16 Path = 0; Path < meterctl.Meter.listOfTotalTimeOfFlightSPerPath.GetPathCount(); Path++)
|
||||||
{
|
{
|
||||||
var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean();
|
var meanVal = meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Get(Path).ToList().Mean();
|
||||||
@@ -213,7 +183,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
|
|||||||
cTofAvgMeanTotal.Add(meanVal);
|
cTofAvgMeanTotal.Add(meanVal);
|
||||||
TofAvgMeanTotal.Update(Path, cTofAvgMeanTotal);
|
TofAvgMeanTotal.Update(Path, cTofAvgMeanTotal);
|
||||||
//meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List<Double>());
|
//meterctl.Meter.listOfTotalTimeOfFlightSPerPath.Update(Path,new List<Double>());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ClassLibrary1
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>f2a9bf82-4dfb-4a5f-8749-1aca1eec7aee</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>ClassLibrary1</RootNamespace>
|
||||||
|
<AssemblyName>ClassLibrary1</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System"/>
|
||||||
|
|
||||||
|
<Reference Include="System.Core"/>
|
||||||
|
<Reference Include="System.Xml.Linq"/>
|
||||||
|
<Reference Include="System.Data.DataSetExtensions"/>
|
||||||
|
|
||||||
|
|
||||||
|
<Reference Include="Microsoft.CSharp"/>
|
||||||
|
|
||||||
|
<Reference Include="System.Data"/>
|
||||||
|
|
||||||
|
<Reference Include="System.Net.Http"/>
|
||||||
|
|
||||||
|
<Reference Include="System.Xml"/>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Class1.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("ClassLibrary1")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("ClassLibrary1")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("f2a9bf82-4dfb-4a5f-8749-1aca1eec7aee")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// 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("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
@@ -45,7 +45,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Limit retries to this value.
|
/// Limit retries to this value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const Int32 MaxRequestRetries = 6;
|
public const Int32 MaxRequestRetries = 6;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send delay between records in milliseconds before
|
/// Send delay between records in milliseconds before
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
public List<ApplicationDefinition> ConfigApplicationDefinitions { get; }
|
public List<ApplicationDefinition> ConfigApplicationDefinitions { get; }
|
||||||
= new List<ApplicationDefinition>();
|
= new List<ApplicationDefinition>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ctor
|
||||||
|
/// </summary>
|
||||||
|
public GenesisConfigurationReader() {}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ctor
|
/// Ctor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -46,7 +51,7 @@
|
|||||||
throw new ApplicationException($" {configFilePath} doesn't exists");
|
throw new ApplicationException($" {configFilePath} doesn't exists");
|
||||||
}
|
}
|
||||||
|
|
||||||
Convert(File.ReadAllText(configFilePath));
|
BuildRegisterList(File.ReadAllText(configFilePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -55,7 +60,7 @@
|
|||||||
/// <param name="configurationJson"></param>
|
/// <param name="configurationJson"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="Exception"></exception>
|
/// <exception cref="Exception"></exception>
|
||||||
private void Convert(String configurationJson)
|
public void BuildRegisterList(String configurationJson)
|
||||||
{
|
{
|
||||||
IDictionary<String, AppSection> sections;
|
IDictionary<String, AppSection> sections;
|
||||||
|
|
||||||
|
|||||||
@@ -1295,6 +1295,68 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a list of all registers based on the interface (configuration.json) and the installed
|
||||||
|
/// meter applications with a specific version.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks date="2024-Apr-04" author="Roland Drabesch/Thomas Wiedebusch">
|
||||||
|
/// - Initial, extracted from <see cref="ReadMeterFirmwareAndAssignRegisters"/>
|
||||||
|
/// </remarks>
|
||||||
|
public void BuildValidMeterRegisters(List<KeyValuePair<RegisterDefinition, Byte[]>> tempConfigRegisters)
|
||||||
|
{
|
||||||
|
if (tempConfigRegisters == null || tempConfigRegisters.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_configRegister.MeterRegisterDic.Clear();
|
||||||
|
// ReSharper disable once CollectionNeverQueried.Local this is used for debug to check the configuration.json
|
||||||
|
// for overlapping versions (indicated multiple assignment of identical register)
|
||||||
|
var configRegisterListForDebug = new List<String>();
|
||||||
|
// ReSharper disable once UnusedVariable this is used for debug to check the configuration.json
|
||||||
|
// for overlapping versions (indicated multiple assignment of identical register)
|
||||||
|
var configRegisterListOverlappingVersionForDebug = new List<String>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (var registerToCheck in tempConfigRegisters)
|
||||||
|
{
|
||||||
|
if (registerToCheck.Key?.RegisterDetail?.Version == null ||
|
||||||
|
MeterAppListVersion.All(f => f.AppId != registerToCheck.Key.AppAddress))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var currentGroup = MeterAppListVersion.First(f => f.AppId == registerToCheck.Key.AppAddress);
|
||||||
|
|
||||||
|
if ( // Legacy registers may not have an version assigned
|
||||||
|
(!registerToCheck.Key.RegisterDetail.Version.First.HasValue &&
|
||||||
|
!registerToCheck.Key.RegisterDetail.Version.Last.HasValue) ||
|
||||||
|
// Normal version assignment with first and last value
|
||||||
|
(registerToCheck.Key.RegisterDetail.Version.Last != null &&
|
||||||
|
registerToCheck.Key.RegisterDetail.Version.First != null &&
|
||||||
|
registerToCheck.Key.RegisterDetail.Version.First.Value <= currentGroup.Version &&
|
||||||
|
registerToCheck.Key.RegisterDetail.Version.Last.Value >= currentGroup.Version))
|
||||||
|
{
|
||||||
|
configRegisterListForDebug.Add(registerToCheck.Key.GetIdent());
|
||||||
|
// Avoid multiple assignment of identical register in dictionary if one has passed the test
|
||||||
|
if (_configRegister.MeterRegisterDic.Any(reg =>
|
||||||
|
reg.Key.GetIdent().Equals(registerToCheck.Key.GetIdent())))
|
||||||
|
{
|
||||||
|
configRegisterListOverlappingVersionForDebug.Add(registerToCheck.Key.GetIdent());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerToCheck.Key.IsAvailable = true;
|
||||||
|
_configRegister.MeterRegisterDic.TryAdd(registerToCheck.Key, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configRegisterListOverlappingVersionForDebug.Sort();
|
||||||
|
configRegisterListForDebug.Sort();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reading all applications which can be found in the configuration.json and have been stored
|
/// Reading all applications which can be found in the configuration.json and have been stored
|
||||||
/// to the meter register dictionary in advance.
|
/// to the meter register dictionary in advance.
|
||||||
@@ -1392,7 +1454,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
//add application always, even if this is not installed. This will be used for FW updates
|
//add application always, even if this is not installed. This will be used for FW updates
|
||||||
MeterAppListVersion.Add(new MeterApplications()
|
MeterAppListVersion.Add(new MeterApplications
|
||||||
{
|
{
|
||||||
AppId = appVersionToRead.AppId,
|
AppId = appVersionToRead.AppId,
|
||||||
Version = readFwVersion,
|
Version = readFwVersion,
|
||||||
@@ -1452,48 +1514,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
|
|
||||||
_logger.Info($"Slot:{Slot} - Meter size: {MeterSize}");
|
_logger.Info($"Slot:{Slot} - Meter size: {MeterSize}");
|
||||||
_logger.Info($"Slot:{Slot} - Upgrade permission: {MetrologyUpgradePermission:X2}");
|
_logger.Info($"Slot:{Slot} - Upgrade permission: {MetrologyUpgradePermission:X2}");
|
||||||
//remove unused registers with invalid version
|
|
||||||
|
// initial list of ALL registers defined in configuration.json
|
||||||
var tempConfigRegisters = _configRegister.MeterRegisterDic.ToList();
|
var tempConfigRegisters = _configRegister.MeterRegisterDic.ToList();
|
||||||
|
|
||||||
_configRegister.MeterRegisterDic.Clear();
|
// reduce registers to valid registers for a specific application with a specific version
|
||||||
// ReSharper disable once CollectionNeverQueried.Local this is used for debug to check the configuration.json
|
BuildValidMeterRegisters(tempConfigRegisters);
|
||||||
// for overlapping versions (indicated multiple assignment of identical register)
|
|
||||||
var configRegisterListForDebug = new List<String>();
|
|
||||||
// ReSharper disable once UnusedVariable this is used for debug to check the configuration.json
|
|
||||||
// for overlapping versions (indicated multiple assignment of identical register)
|
|
||||||
var configRegisterListOverlappingVersionForDebug = new List<String>();
|
|
||||||
|
|
||||||
foreach (var registerToCheck in tempConfigRegisters)
|
|
||||||
{
|
|
||||||
var currentGroup = MeterAppListVersion.First(f => f.AppId == registerToCheck.Key.AppAddress);
|
|
||||||
|
|
||||||
if (registerToCheck.Key?.RegisterDetail?.Version == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (// Legacy registers may not have an version assigned
|
|
||||||
(!registerToCheck.Key.RegisterDetail.Version.First.HasValue &&
|
|
||||||
!registerToCheck.Key.RegisterDetail.Version.Last.HasValue) ||
|
|
||||||
// Normal version assignment with first and last value
|
|
||||||
(registerToCheck.Key.RegisterDetail.Version.Last != null &&
|
|
||||||
registerToCheck.Key.RegisterDetail.Version.First != null &&
|
|
||||||
registerToCheck.Key.RegisterDetail.Version.First.Value <= currentGroup.Version &&
|
|
||||||
registerToCheck.Key.RegisterDetail.Version.Last.Value >= currentGroup.Version))
|
|
||||||
{
|
|
||||||
configRegisterListForDebug.Add(registerToCheck.Key.GetIdent());
|
|
||||||
// Avoid multiple assignment of identical register in dictionary if one has passed the test
|
|
||||||
if (_configRegister.MeterRegisterDic.Any(reg =>
|
|
||||||
reg.Key.GetIdent().Equals(registerToCheck.Key.GetIdent())))
|
|
||||||
{
|
|
||||||
configRegisterListOverlappingVersionForDebug.Add(registerToCheck.Key.GetIdent());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
registerToCheck.Key.IsAvailable = true;
|
|
||||||
_configRegister.MeterRegisterDic.TryAdd(registerToCheck.Key, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
configRegisterListOverlappingVersionForDebug.Sort();
|
|
||||||
configRegisterListForDebug.Sort();
|
|
||||||
|
|
||||||
foreach (var checkMinRegister in Register.GetMinRequiredRegisters())
|
foreach (var checkMinRegister in Register.GetMinRequiredRegisters())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
/// Collect programming parameters from DB.
|
/// Collect programming parameters from DB.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pcbId"></param>
|
/// <param name="pcbId"></param>
|
||||||
/// <param name="recoveryRegisters"></param>
|
/// <param name="recoveryRegistersDb">registers key value pair from data base</param>
|
||||||
/// <returns>recovery registers</returns>
|
/// <returns>recovery registers</returns>
|
||||||
/// <remarks date="2021-Feb-01" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Feb-01" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
@@ -219,9 +219,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
/// - Removed prohibited parameters.
|
/// - Removed prohibited parameters.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <remarks date="2024-02-12" author="Thomas Wiedebusch">
|
/// <remarks date="2024-02-12" author="Thomas Wiedebusch">
|
||||||
/// - Added un-reversed parameters based on data type (string, uint96, uint128).
|
/// - Added un-reversed parameters based on data type (string, uint128).
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static StatusReturn DownloadProgrammingParametersFromDb(String pcbId, List<RecoveryRegisterItem> recoveryRegisters)
|
/// <remarks date="2024-Apr-04..05" author="Thomas Wiedebusch">
|
||||||
|
/// - Check and validate register values with installed or intended to be installed FW and given configuration.json.
|
||||||
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Exported register range check to <see cref="ValidateRegisterRange"/>.
|
||||||
|
/// </remarks>
|
||||||
|
public static StatusReturn DownloadProgrammingParametersFromDb(String pcbId, List<RecoveryRegisterItem> recoveryRegistersDb)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -268,7 +274,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ATTENTION: These parameters are coming out of the DB in wrong order and needed to be reversed
|
// ATTENTION: These parameters are coming out of the DB in wrong byte order and needed to be reversed
|
||||||
// for the entire sequence
|
// for the entire sequence
|
||||||
|
|
||||||
// Add parameter if it is not in the list
|
// Add parameter if it is not in the list
|
||||||
@@ -305,7 +311,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
foreach (var proPar in sortableProgrammingParameters)
|
foreach (var proPar in sortableProgrammingParameters)
|
||||||
{
|
{
|
||||||
var recReg = new RecoveryRegisterItem(proPar.RegisterName, proPar.RegisterValue);
|
var recReg = new RecoveryRegisterItem(proPar.RegisterName, proPar.RegisterValue);
|
||||||
recoveryRegisters.Add(recReg);
|
recoveryRegistersDb.Add(recReg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -349,6 +355,44 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
return WriteRegisters(recoveryRegistersDb, true);
|
return WriteRegisters(recoveryRegistersDb, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate the range of the register.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="recReg">register key value pair</param>
|
||||||
|
/// <param name="regDef">register definition by configuration.json</param>
|
||||||
|
/// <param name="errorMessage">error message if range check failed</param>
|
||||||
|
/// <returns>status</returns>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Initial, imported from <see cref="DownloadProgrammingParametersFromDb"/>
|
||||||
|
/// </remarks>
|
||||||
|
public static StatusReturn ValidateRegisterRange(RecoveryRegisterItem recReg,
|
||||||
|
RegisterDefinition regDef, out String errorMessage)
|
||||||
|
{
|
||||||
|
|
||||||
|
// error message will return on failed check any information
|
||||||
|
errorMessage = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// check the limits and avoid writing if not in range
|
||||||
|
var check = RegisterCheck.CheckRange(regDef, recReg.WriteValue);
|
||||||
|
if (!string.IsNullOrEmpty(check))
|
||||||
|
{
|
||||||
|
errorMessage = $"{Resources.StrRegisterValueOutOfRange}: " +
|
||||||
|
RegisterConverter.GetRegisterContentText(regDef, recReg.WriteValue) +
|
||||||
|
$" - Minimum ({regDef.Minimum})" +
|
||||||
|
$" - Maximum ({regDef.Maximum})";
|
||||||
|
|
||||||
|
return StatusReturn.Warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
return StatusReturn.Okay;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusReturn.Failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recover all registers set from caller. Additional preparation and finalization will be added.
|
/// Recover all registers set from caller. Additional preparation and finalization will be added.
|
||||||
/// settings.
|
/// settings.
|
||||||
@@ -397,6 +441,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
/// <remarks date="2024-Mar-21" author="Thomas Wiedebusch">
|
/// <remarks date="2024-Mar-21" author="Thomas Wiedebusch">
|
||||||
/// - Check register limits, if those are out of range avoid writing and log warning message.
|
/// - Check register limits, if those are out of range avoid writing and log warning message.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Exported register range check to <see cref="ValidateRegisterRange"/>.
|
||||||
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-09" author="Thomas Wiedebusch">
|
||||||
|
/// - Removed skip recovery if already done in previous run to enable a retry.
|
||||||
|
/// </remarks>
|
||||||
public StatusReturn WriteRegisters(List<RecoveryRegisterItem> recoveryRegistersDb, Boolean eolProgramming = false)
|
public StatusReturn WriteRegisters(List<RecoveryRegisterItem> recoveryRegistersDb, Boolean eolProgramming = false)
|
||||||
{
|
{
|
||||||
if (_currentGenesis == null ||
|
if (_currentGenesis == null ||
|
||||||
@@ -407,10 +457,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
|
|
||||||
var retVal = StatusReturn.Okay;
|
var retVal = StatusReturn.Okay;
|
||||||
|
|
||||||
// if not EOL processing and already recovered skip this with positive feedback
|
|
||||||
if (!eolProgramming && _currentGenesis.PcbId == _pcbIdWriteRegisters)
|
|
||||||
return StatusReturn.Okay;
|
|
||||||
|
|
||||||
// remind pcbId of this run to avoid endless repetition
|
// remind pcbId of this run to avoid endless repetition
|
||||||
_pcbIdWriteRegisters = _currentGenesis.PcbId;
|
_pcbIdWriteRegisters = _currentGenesis.PcbId;
|
||||||
|
|
||||||
@@ -523,26 +569,19 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check the limits and avoid writing if not in range
|
// check the limits and avoid writing if not in range
|
||||||
var check = RegisterCheck.CheckRange(regDef, recReg.WriteValue);
|
retVal = ValidateRegisterRange(recReg, regDef, out var errorMessage);
|
||||||
if (!string.IsNullOrEmpty(check))
|
if (StatusReturn.Okay != retVal)
|
||||||
{
|
{
|
||||||
var actualProcessMsg = $"{Resources.StrRegisterValueOutOfRange}: " +
|
_currentGenesis.WriteLog(errorMessage);
|
||||||
RegisterConverter.GetRegisterContentText(regDef, recReg.WriteValue) +
|
|
||||||
$" - Minimum ({regDef.Minimum})" +
|
|
||||||
$" - Maximum ({regDef.Maximum})";
|
|
||||||
_currentGenesis.WriteLog(actualProcessMsg);
|
|
||||||
|
|
||||||
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs($@"{Resources.StrWriteRegister}" +
|
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs($@"{Resources.StrWriteRegister}" +
|
||||||
$@" {_actualRegisterCtr} / {recRegistersCount}",
|
$@" {_actualRegisterCtr} / {recRegistersCount}",
|
||||||
overallProcessCtrPercent, actualProcessMsg));
|
overallProcessCtrPercent, errorMessage));
|
||||||
|
|
||||||
// for EOL signal error, for CUST signal warning being able to go forward
|
|
||||||
retVal = eolProgramming ? StatusReturn.Failed : StatusReturn.Warning;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentGenesis.WriteRegister(recReg.RegisterIdent, recReg.WriteValue);
|
_currentGenesis.WriteRegister(recReg.RegisterIdent, recReg.WriteValue);
|
||||||
|
|
||||||
var strRawAndConvertedValue = "";
|
var strRawAndConvertedValue = "";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1378,6 +1378,45 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracts AppId from binary application file.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks date="2024-Apr-04" author="Thomas Wiedebusch">
|
||||||
|
/// - Initial extracted from <see cref="CheckFileApp"/>
|
||||||
|
/// </remarks>
|
||||||
|
public static Byte GetFileAppAppId(Byte[] binData)
|
||||||
|
{
|
||||||
|
return binData[FileAppAppIdIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracts CRC from binary application file.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks date="2024-Apr-04" author="Thomas Wiedebusch">
|
||||||
|
/// - Initial extracted from <see cref="CheckFileApp"/>
|
||||||
|
/// </remarks>
|
||||||
|
public static UInt16 GetFileAppCrc(Byte[] binData)
|
||||||
|
{
|
||||||
|
return (UInt16)(binData[FileAppCrcIndex] + (binData[FileAppCrcIndex + 1] << 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracts version from binary application file.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks date="2024-Apr-04" author="Thomas Wiedebusch">
|
||||||
|
/// - Initial extracted from <see cref="CheckFileApp"/>
|
||||||
|
/// </remarks>
|
||||||
|
public static UInt32 GetFileAppVersion(Byte[] binData)
|
||||||
|
{
|
||||||
|
return (UInt32)((binData[FileAppVersionIndex] & 0x0F)
|
||||||
|
+ ((binData[FileAppVersionIndex] & 0xF0) >> 4) * 10
|
||||||
|
+ (binData[FileAppVersionIndex + 1] & 0x0F) * 100
|
||||||
|
+ ((binData[FileAppVersionIndex + 1] & 0xF0) >> 4) * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check the content of the binaries:
|
/// Check the content of the binaries:
|
||||||
/// - begins with "APP>",
|
/// - begins with "APP>",
|
||||||
@@ -1395,12 +1434,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
private static Boolean CheckFileApp(FileApplications fileApp)
|
private static Boolean CheckFileApp(FileApplications fileApp)
|
||||||
{
|
{
|
||||||
fileApp.AppId = fileApp.BinData[FileAppAppIdIndex];
|
fileApp.AppId = GetFileAppAppId(fileApp.BinData.ToArray());
|
||||||
fileApp.Crc = (UInt16)(fileApp.BinData[FileAppCrcIndex] + (fileApp.BinData[FileAppCrcIndex + 1] << 8));
|
fileApp.Crc = GetFileAppCrc(fileApp.BinData.ToArray());
|
||||||
fileApp.Version = (UInt32)((fileApp.BinData[FileAppVersionIndex] & 0x0F)
|
fileApp.Version = GetFileAppVersion(fileApp.BinData.ToArray());
|
||||||
+ ((fileApp.BinData[FileAppVersionIndex] & 0xF0) >> 4) * 10
|
|
||||||
+ (fileApp.BinData[FileAppVersionIndex + 1] & 0x0F) * 100
|
|
||||||
+ ((fileApp.BinData[FileAppVersionIndex + 1] & 0xF0) >> 4) * 1000);
|
|
||||||
|
|
||||||
fileApp.StrVersion = GenesisMeter.BuildFwVersionString(fileApp.BinData[FileAppVersionIndex + 1],
|
fileApp.StrVersion = GenesisMeter.BuildFwVersionString(fileApp.BinData[FileAppVersionIndex + 1],
|
||||||
fileApp.BinData[FileAppVersionIndex]);
|
fileApp.BinData[FileAppVersionIndex]);
|
||||||
|
|||||||
@@ -604,19 +604,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
/// <remarks date="2023-Nov-24" author="T.Wiedebusch">
|
/// <remarks date="2023-Nov-24" author="T.Wiedebusch">
|
||||||
/// - Exit multiple read date if retries exceeded.
|
/// - Exit multiple read date if retries exceeded.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-11" author="T.Wiedebusch">
|
||||||
|
/// - Exit multiple read date if retries exceeded increased to <see cref="CommunicationConfig.MaxRequestRetries"/>.
|
||||||
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-11 Version 2" author="T.Wiedebusch">
|
||||||
|
/// - Rewound to version from 06.09.2023 14:44:33 before Commit 8c9d7704.
|
||||||
|
/// </remarks>
|
||||||
public RequestRecord CommandToMeter(Byte command, RegisterDefinition meterRegister = null,
|
public RequestRecord CommandToMeter(Byte command, RegisterDefinition meterRegister = null,
|
||||||
Byte[] payload = null, Int32 expectedLength = 4, Boolean hideDataInLog = false,
|
Byte[] payload = null, Int32? expectedLength = null, Boolean hideDataInLog = false,
|
||||||
UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode)
|
UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode)
|
||||||
{
|
{
|
||||||
if (command == Commands.MultipleReadData && meterRegister != null && meterRegister.DataType == typeof(String))
|
if (command == Commands.MultipleReadData && meterRegister != null && meterRegister.DataType == typeof(String))
|
||||||
{
|
{
|
||||||
var completeResponse = new List<Byte>();
|
var completeResponse = new List<Byte>();
|
||||||
while (!completeResponse.Contains(0) && _recordInProcess.RetryCtr < CommunicationConfig.RequestRetries)
|
//TODO THW check this including the recursive call CommandToMeter
|
||||||
|
while (true)
|
||||||
{
|
{
|
||||||
var cRecord = CommandToMeter(Commands.ReadData, meterRegister, payload, 4, hideDataInLog,
|
var cRecord = CommandToMeter(Commands.ReadData, meterRegister, payload, expectedLength,
|
||||||
skipRetryErrorCode);
|
hideDataInLog, skipRetryErrorCode);
|
||||||
var rest = ProcessRecordList();
|
var rest = ProcessRecordList();
|
||||||
if (rest == RequestAcknowledgeState.Ok && cRecord?.ResponsePayload != null)
|
if (rest == RequestAcknowledgeState.Ok && cRecord != null && cRecord.ResponsePayload != null)
|
||||||
{
|
{
|
||||||
completeResponse.AddRange(cRecord.ResponsePayload);
|
completeResponse.AddRange(cRecord.ResponsePayload);
|
||||||
if (cRecord.ResponsePayload.Contains(0))
|
if (cRecord.ResponsePayload.Contains(0))
|
||||||
@@ -624,11 +631,68 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
cRecord.ResponsePayload = completeResponse;
|
cRecord.ResponsePayload = completeResponse;
|
||||||
OnMeterRegisterUpdated?.Invoke(this,
|
OnMeterRegisterUpdated?.Invoke(this,
|
||||||
new RegisterUpdatedEventArgs(meterRegister, completeResponse.ToArray()));
|
new RegisterUpdatedEventArgs(meterRegister, completeResponse.ToArray()));
|
||||||
|
if (expectedLength.HasValue && completeResponse.Count < expectedLength.Value)
|
||||||
|
{
|
||||||
|
_logger.Debug("Too Short. Payload contains zero");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (expectedLength.HasValue && completeResponse.Any() &&
|
||||||
|
completeResponse.Count < expectedLength.Value)
|
||||||
|
{
|
||||||
|
if (rest != RequestAcknowledgeState.Ok)
|
||||||
|
{
|
||||||
|
_logger.Debug($"Too Short.Request Acknowledge State is {rest}");
|
||||||
|
}
|
||||||
|
else if (cRecord == null)
|
||||||
|
{
|
||||||
|
_logger.Debug("Too Short.Record is empty or null");
|
||||||
|
}
|
||||||
|
else if (cRecord.ResponsePayload == null)
|
||||||
|
{
|
||||||
|
_logger.Debug("Too Short.ResponsePayload is empty or null");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Debug("Too Short.Unkown reason");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return cRecord;
|
return cRecord;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
//if (command == Commands.MultipleReadData && meterRegister != null && meterRegister.DataType == typeof(String))
|
||||||
|
//{
|
||||||
|
// var completeResponse = new List<Byte>();
|
||||||
|
// while (!completeResponse.Contains(0) && _recordInProcess.RetryCtr <= CommunicationConfig.MaxRequestRetries)
|
||||||
|
// {
|
||||||
|
// var cRecord = CommandToMeter(Commands.ReadData, meterRegister, payload, 4, hideDataInLog,
|
||||||
|
// skipRetryErrorCode);
|
||||||
|
// var rest = ProcessRecordList();
|
||||||
|
// if (rest == RequestAcknowledgeState.Ok && cRecord?.ResponsePayload != null)
|
||||||
|
// {
|
||||||
|
// completeResponse.AddRange(cRecord.ResponsePayload);
|
||||||
|
// if (cRecord.ResponsePayload.Contains(0))
|
||||||
|
// {
|
||||||
|
// cRecord.ResponsePayload = completeResponse;
|
||||||
|
// OnMeterRegisterUpdated?.Invoke(this,
|
||||||
|
// new RegisterUpdatedEventArgs(meterRegister, completeResponse.ToArray()));
|
||||||
|
// return cRecord;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (cRecord?.ResponsePayload == null)
|
||||||
|
// {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
//the minimum payload is one 4 byte chunk
|
//the minimum payload is one 4 byte chunk
|
||||||
var chunkSize = RegisterDefinition.ChunkSize;
|
var chunkSize = RegisterDefinition.ChunkSize;
|
||||||
if (payload == null)
|
if (payload == null)
|
||||||
@@ -671,7 +735,20 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
|
|
||||||
if (command == Commands.MultipleReadData)
|
if (command == Commands.MultipleReadData)
|
||||||
{
|
{
|
||||||
var numberOfChunks = (UInt16)(expectedLength / chunkSize);
|
//TODO THW create expected size out of meterRegister.DataType
|
||||||
|
if (!expectedLength.HasValue)
|
||||||
|
{
|
||||||
|
if ((meterRegister.DataType == typeof(UInt64) || meterRegister.DataType == typeof(Int64)))
|
||||||
|
{
|
||||||
|
expectedLength = 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
expectedLength = 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var numberOfChunks = (UInt16)(expectedLength.Value / chunkSize);
|
||||||
if (expectedLength % chunkSize != 0)
|
if (expectedLength % chunkSize != 0)
|
||||||
numberOfChunks++;
|
numberOfChunks++;
|
||||||
requestProtocol.Add((Byte)(numberOfChunks & 0xFF));
|
requestProtocol.Add((Byte)(numberOfChunks & 0xFF));
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
bf6bb8fceb3db5a9977dadc407cf576684bf7127
|
8fbe991b217e7692af4817ad205b768685aa5a72
|
||||||
|
|||||||
+1
-1
@@ -156,7 +156,7 @@ namespace ProductionUiCordonel.ProductionProcesses.Actions
|
|||||||
|
|
||||||
if (genesisStatus.RemainingLifeTimeYears < 20)
|
if (genesisStatus.RemainingLifeTimeYears < 20)
|
||||||
{
|
{
|
||||||
if (genesisStatus.DrainedBatteryLoadPercent > 8)
|
if (genesisStatus.DrainedBatteryLoadPercent > 9)
|
||||||
{
|
{
|
||||||
currentProcessState = ProductionProcessState.Error;
|
currentProcessState = ProductionProcessState.Error;
|
||||||
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
|
UserControl.lblText.Dispatcher.Invoke(DispatcherPriority.Send,
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
247396738e2c5d26ac00f9df05c0cc5c61d7f33a
|
1babc7d629fd8c486aff20f4990c117c2e58a68f
|
||||||
|
|||||||
@@ -870,7 +870,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
sb.AppendLine($"{dt};{rawBat.Item2}");
|
sb.AppendLine($"{dt};{rawBat.Item2}");
|
||||||
}
|
}
|
||||||
|
|
||||||
sb.ToString();
|
File.AppendAllLines(logFileName+ "BAT.CSV", new[] { sb.ToString() });
|
||||||
|
|
||||||
|
|
||||||
}).ContinueWith(delegate
|
}).ContinueWith(delegate
|
||||||
{
|
{
|
||||||
//add a blank line to separate next operation
|
//add a blank line to separate next operation
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Xylem.Common.CommonCore.Configuration;
|
using Xylem.Common.CommonCore.Configuration;
|
||||||
using Xylem.Common.CommonCore.Consts;
|
using Xylem.Common.CommonCore.Consts;
|
||||||
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||||
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||||
@@ -1943,11 +1945,35 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
private void button6_Click(Object sender, EventArgs e)
|
private void button6_Click(Object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//Seal Display test
|
//Seal Display test
|
||||||
for (var c = 0; c < 10; c++)
|
_currentGenesis.WriteRegister("SYSTEM_ExitReason", 21, true, false);
|
||||||
|
var exitResult = RegisterConverter.ByteArrayToValue<Int16>(_currentGenesis.ReadRegister("SYSTEM_ExitReason"));
|
||||||
|
|
||||||
|
MessageBox.Show(exitResult.ToString());
|
||||||
|
|
||||||
|
var _meterResetPsu = new MeterResetPsu(_currentGenesis)
|
||||||
{
|
{
|
||||||
button2_Click_1(this, null);
|
StoreConfigEnable = true
|
||||||
|
};
|
||||||
|
var rebootSucceeded = _meterResetPsu.MeterResetPsuExecute();
|
||||||
|
|
||||||
|
Thread.Sleep(16000);
|
||||||
|
if (!_currentGenesis.Login())
|
||||||
|
|
||||||
|
{
|
||||||
|
_currentGenesis.WriteLog("relogin first attempt Failed");
|
||||||
|
Thread.Sleep(5000);
|
||||||
|
if (!_currentGenesis.Login())
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_currentGenesis.WriteRegister("SYSTEM_ExitReason", 21, true, false);
|
||||||
|
exitResult = RegisterConverter.ByteArrayToValue<Int16>(_currentGenesis.ReadRegister("SYSTEM_ExitReason"));
|
||||||
|
|
||||||
|
MessageBox.Show(exitResult.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2029,6 +2055,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
sbMSG.AppendLine($"Remaining life time in years {genesisStatus.RemainingLifeTimeYears:F2}");
|
sbMSG.AppendLine($"Remaining life time in years {genesisStatus.RemainingLifeTimeYears:F2}");
|
||||||
sbMSG.AppendLine($"Totally drained battery load in % {genesisStatus.DrainedBatteryLoadPercent:F2}");
|
sbMSG.AppendLine($"Totally drained battery load in % {genesisStatus.DrainedBatteryLoadPercent:F2}");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MessageBox.Show(sbMSG.ToString(), $"Battery for {_currentGenesis.PcbId} has remaining life " +
|
MessageBox.Show(sbMSG.ToString(), $"Battery for {_currentGenesis.PcbId} has remaining life " +
|
||||||
$"time of {genesisStatus.RemainingLifeTimeYears:F2} years");
|
$"time of {genesisStatus.RemainingLifeTimeYears:F2} years");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,19 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
/// <remarks date="2020-Dec-22" author="Thomas Wiedebusch">
|
/// <remarks date="2020-Dec-22" author="Thomas Wiedebusch">
|
||||||
/// - Initial
|
/// - Initial
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Try/catch added.
|
||||||
|
/// </remarks>
|
||||||
public static void ProgressBarInvoker(ProgressBar progressBar, Int32 value = 0, Boolean visible = true)
|
public static void ProgressBarInvoker(ProgressBar progressBar, Int32 value = 0, Boolean visible = true)
|
||||||
{
|
{
|
||||||
if (progressBar == null) return;
|
try
|
||||||
if (value > 100) value = 100;
|
{
|
||||||
if (value < 0) value = 0;
|
if (progressBar == null)
|
||||||
|
return;
|
||||||
|
if (value > 100)
|
||||||
|
value = 100;
|
||||||
|
if (value < 0)
|
||||||
|
value = 0;
|
||||||
if (progressBar.InvokeRequired)
|
if (progressBar.InvokeRequired)
|
||||||
{
|
{
|
||||||
progressBar.Invoke(new Action(() =>
|
progressBar.Invoke(new Action(() =>
|
||||||
@@ -37,6 +45,11 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
progressBar.Update();
|
progressBar.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control invoker for enable and disable. The control remains visible.
|
/// Control invoker for enable and disable. The control remains visible.
|
||||||
@@ -50,14 +63,21 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
||||||
/// - Avoid recurrent activation of identical state.
|
/// - Avoid recurrent activation of identical state.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Try/catch added.
|
||||||
|
/// </remarks>
|
||||||
public static void ControlEnableInvoker(Control ctrl, Boolean enabled)
|
public static void ControlEnableInvoker(Control ctrl, Boolean enabled)
|
||||||
{
|
{
|
||||||
if (ctrl == null) return;
|
try
|
||||||
|
{
|
||||||
|
if (ctrl == null)
|
||||||
|
return;
|
||||||
if (ctrl.InvokeRequired)
|
if (ctrl.InvokeRequired)
|
||||||
{
|
{
|
||||||
ctrl.Invoke(new Action(() =>
|
ctrl.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
if (ctrl.Enabled == enabled) return;
|
if (ctrl.Enabled == enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Enabled = enabled;
|
ctrl.Enabled = enabled;
|
||||||
ctrl.Update();
|
ctrl.Update();
|
||||||
@@ -66,13 +86,19 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ctrl.Enabled == enabled) return;
|
if (ctrl.Enabled == enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Enabled = enabled;
|
ctrl.Enabled = enabled;
|
||||||
ctrl.Update();
|
ctrl.Update();
|
||||||
ctrl.Focus();
|
ctrl.Focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control invoker to hide or display control.
|
/// Control invoker to hide or display control.
|
||||||
@@ -85,14 +111,21 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
||||||
/// - Avoid recurrent activation of identical state.
|
/// - Avoid recurrent activation of identical state.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Try/catch added.
|
||||||
|
/// </remarks>
|
||||||
public static void ControlViewInvoker(Control ctrl, Boolean visible)
|
public static void ControlViewInvoker(Control ctrl, Boolean visible)
|
||||||
{
|
{
|
||||||
if (ctrl == null) return;
|
try
|
||||||
|
{
|
||||||
|
if (ctrl == null)
|
||||||
|
return;
|
||||||
if (ctrl.InvokeRequired)
|
if (ctrl.InvokeRequired)
|
||||||
{
|
{
|
||||||
ctrl.Invoke(new Action(() =>
|
ctrl.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible) return;
|
if (ctrl.Visible == visible)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.Update();
|
ctrl.Update();
|
||||||
@@ -100,12 +133,18 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible) return;
|
if (ctrl.Visible == visible)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.Update();
|
ctrl.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Control invoker with message, visibility on and new color.
|
/// Control invoker with message, visibility on and new color.
|
||||||
@@ -116,14 +155,21 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
||||||
/// - Avoid recurrent activation of identical state.
|
/// - Avoid recurrent activation of identical state.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Try/catch added.
|
||||||
|
/// </remarks>
|
||||||
public static void ControlInvoker(Control ctrl, Color color, String msg = "", Boolean visible = true)
|
public static void ControlInvoker(Control ctrl, Color color, String msg = "", Boolean visible = true)
|
||||||
{
|
{
|
||||||
if (ctrl == null) return;
|
try
|
||||||
|
{
|
||||||
|
if (ctrl == null)
|
||||||
|
return;
|
||||||
if (ctrl.InvokeRequired)
|
if (ctrl.InvokeRequired)
|
||||||
{
|
{
|
||||||
ctrl.Invoke(new Action(() =>
|
ctrl.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color) return;
|
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.ForeColor = color;
|
ctrl.ForeColor = color;
|
||||||
@@ -133,7 +179,8 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color) return;
|
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.ForeColor = color;
|
ctrl.ForeColor = color;
|
||||||
@@ -141,6 +188,11 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
ctrl.Update();
|
ctrl.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tool strip invoker with message, visibility on and new color.
|
/// Tool strip invoker with message, visibility on and new color.
|
||||||
@@ -151,14 +203,22 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
||||||
/// - Avoid recurrent activation of identical state.
|
/// - Avoid recurrent activation of identical state.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static void ToolStripLabelInvoker(ToolStripStatusLabel ctrl, Color color, String msg = "", Boolean visible = true)
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Try/catch added.
|
||||||
|
/// </remarks>
|
||||||
|
public static void ToolStripLabelInvoker(ToolStripStatusLabel ctrl, Color color, String msg = "",
|
||||||
|
Boolean visible = true)
|
||||||
{
|
{
|
||||||
if (ctrl?.GetCurrentParent() == null) return;
|
try
|
||||||
|
{
|
||||||
|
if (ctrl?.GetCurrentParent() == null)
|
||||||
|
return;
|
||||||
if (ctrl.GetCurrentParent().InvokeRequired)
|
if (ctrl.GetCurrentParent().InvokeRequired)
|
||||||
{
|
{
|
||||||
ctrl.GetCurrentParent().Invoke(new Action(() =>
|
ctrl.GetCurrentParent().Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color) return;
|
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.ForeColor = color;
|
ctrl.ForeColor = color;
|
||||||
@@ -167,13 +227,19 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color) return;
|
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.ForeColor = color;
|
ctrl.ForeColor = color;
|
||||||
ctrl.Text = $@"{msg}";
|
ctrl.Text = $@"{msg}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tool strip invoker with message, visibility on and new color.
|
/// Tool strip invoker with message, visibility on and new color.
|
||||||
@@ -184,14 +250,21 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Apr-09" author="Thomas Wiedebusch">
|
||||||
/// - Avoid recurrent activation of identical state.
|
/// - Avoid recurrent activation of identical state.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Try/catch added.
|
||||||
|
/// </remarks>
|
||||||
public static void ToolStripInvoker(ToolStrip ctrl, Color color, String msg = "", Boolean visible = true)
|
public static void ToolStripInvoker(ToolStrip ctrl, Color color, String msg = "", Boolean visible = true)
|
||||||
{
|
{
|
||||||
if (ctrl == null) return;
|
try
|
||||||
|
{
|
||||||
|
if (ctrl == null)
|
||||||
|
return;
|
||||||
if (ctrl.InvokeRequired)
|
if (ctrl.InvokeRequired)
|
||||||
{
|
{
|
||||||
ctrl.Invoke(new Action(() =>
|
ctrl.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color) return;
|
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.ForeColor = color;
|
ctrl.ForeColor = color;
|
||||||
@@ -201,7 +274,8 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color) return;
|
if (ctrl.Visible == visible && ctrl.Text == msg && ctrl.ForeColor == color)
|
||||||
|
return;
|
||||||
|
|
||||||
ctrl.Visible = visible;
|
ctrl.Visible = visible;
|
||||||
ctrl.ForeColor = color;
|
ctrl.ForeColor = color;
|
||||||
@@ -209,5 +283,10 @@ namespace Xylem.Common.Utils.UiInvoker
|
|||||||
ctrl.Update();
|
ctrl.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,10 @@
|
|||||||
<Project>{A25A96FD-604B-43BE-80CD-A953152C2175}</Project>
|
<Project>{A25A96FD-604B-43BE-80CD-A953152C2175}</Project>
|
||||||
<Name>Cryptology</Name>
|
<Name>Cryptology</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\Applications\Applications.csproj">
|
||||||
|
<Project>{315E94B8-B82F-4B25-B5BD-297DF3BC1D54}</Project>
|
||||||
|
<Name>Applications</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
||||||
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||||
<Name>GenesisCore</Name>
|
<Name>GenesisCore</Name>
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ using System.Windows.Forms;
|
|||||||
using Xylem.Common.CommonCore.Consts;
|
using Xylem.Common.CommonCore.Consts;
|
||||||
using Xylem.Common.CommonCore.ThreadWatcher;
|
using Xylem.Common.CommonCore.ThreadWatcher;
|
||||||
using Xylem.Common.Cryptology.Security;
|
using Xylem.Common.Cryptology.Security;
|
||||||
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Applications;
|
||||||
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
|
||||||
using Xylem.Common.Logic.ProductionOrderCore.FW;
|
using Xylem.Common.Logic.ProductionOrderCore.FW;
|
||||||
@@ -45,6 +47,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
|||||||
private static readonly Color ColorBackGround = Color.White;
|
private static readonly Color ColorBackGround = Color.White;
|
||||||
private static readonly Color ColorDefault = Color.Black;
|
private static readonly Color ColorDefault = Color.Black;
|
||||||
private static readonly Color ColorSuccess = Color.Green;
|
private static readonly Color ColorSuccess = Color.Green;
|
||||||
|
private static readonly Color ColorProcessWarning = Color.DarkOrange;
|
||||||
private static readonly Color ColorProcessFailed = Color.Red;
|
private static readonly Color ColorProcessFailed = Color.Red;
|
||||||
//private static readonly Color ColorOngoingProcess = Color.Blue;
|
//private static readonly Color ColorOngoingProcess = Color.Blue;
|
||||||
//private static readonly Color ColorUnknownStatus = Color.Gray;
|
//private static readonly Color ColorUnknownStatus = Color.Gray;
|
||||||
@@ -1437,6 +1440,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
|||||||
// load a recovery file
|
// load a recovery file
|
||||||
fwUpdateCapability.RecoveryNotNeededOrLoaded = GetRecoveryRegistersFromDb(cordonelDeviceInfo);
|
fwUpdateCapability.RecoveryNotNeededOrLoaded = GetRecoveryRegistersFromDb(cordonelDeviceInfo);
|
||||||
|
|
||||||
|
// avoid multiple assignments with deviating information before adding the new generated object
|
||||||
foreach (var x in _fwUpdateCapability.Where(x => x.PcbId == cordonelDeviceInfo.PcbId))
|
foreach (var x in _fwUpdateCapability.Where(x => x.PcbId == cordonelDeviceInfo.PcbId))
|
||||||
{
|
{
|
||||||
_fwUpdateCapability.Remove(x);
|
_fwUpdateCapability.Remove(x);
|
||||||
@@ -1457,6 +1461,9 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
|||||||
/// <remarks date="2021-Apr-13" author="Thomas Wiedebusch">
|
/// <remarks date="2021-Apr-13" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-11" author="Thomas Wiedebusch">
|
||||||
|
/// - Added builder operator id.
|
||||||
|
/// </remarks>
|
||||||
private void CheckUserRegistration()
|
private void CheckUserRegistration()
|
||||||
{
|
{
|
||||||
if (_fwUpdateDbAccess == null || _regUser == null)
|
if (_fwUpdateDbAccess == null || _regUser == null)
|
||||||
@@ -1477,6 +1484,7 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
|||||||
{
|
{
|
||||||
_regUser.AccountActive = user.AccountActive;
|
_regUser.AccountActive = user.AccountActive;
|
||||||
_regUser.FullName = user.FullName;
|
_regUser.FullName = user.FullName;
|
||||||
|
_regUser.Id = user.Id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2394,6 +2402,15 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
|||||||
_logger.Info(txtHistory);
|
_logger.Info(txtHistory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Output exclusively to user update remarks text window.
|
||||||
|
/// </summary>
|
||||||
|
private void LogWarningText(String txtHistory)
|
||||||
|
{
|
||||||
|
InfoWindowColoredText(txtHistory, ColorProcessWarning);
|
||||||
|
_logger.Info(txtHistory);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Output exclusively to user update remarks text window.
|
/// Output exclusively to user update remarks text window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -5073,29 +5090,134 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skip if recovery registers are not needed, else collect all recovery registers from DB.
|
/// Skip if recovery registers are not needed, else collect all recovery registers from DB.
|
||||||
|
/// - To validate the register range, the configuration.json and the list of applications
|
||||||
|
/// intended to be installed are needed. Therefore the <see cref="GetFwPackageFromDb"/>
|
||||||
|
/// and <see cref="BuildFwUpdateSwContainerFromDb"/> have to be executed to collect the
|
||||||
|
/// information.
|
||||||
|
/// - Uses a mockGenesis to extract valid registers based on application versions from
|
||||||
|
/// the configuration.json.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cordonel"></param>
|
/// <param name="cordonel"></param>
|
||||||
/// <returns>true if successfully loaded or not needed</returns>
|
/// <returns>true if successfully loaded or not needed</returns>
|
||||||
/// <remarks date="2023-Oct-09" author="Thomas Wiedebusch">
|
/// <remarks date="2023-Oct-09" author="Thomas Wiedebusch">
|
||||||
/// - Initial.
|
/// - Initial.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-04" author="Thomas Wiedebusch">
|
||||||
|
/// - Added register values with installed or intended to be installed FW to be able to check
|
||||||
|
/// limits of registers based on the installed applications and the configuration.json.
|
||||||
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-08" author="Thomas Wiedebusch">
|
||||||
|
/// - Split downloading of recovery registers and validate range of registers to two separated
|
||||||
|
/// functions.
|
||||||
|
/// </remarks>
|
||||||
private Boolean GetRecoveryRegistersFromDb(CordonelDeviceInfo cordonel)
|
private Boolean GetRecoveryRegistersFromDb(CordonelDeviceInfo cordonel)
|
||||||
{
|
{
|
||||||
if (!cordonel.RegisterRecoveryRequired)
|
if (!cordonel.RegisterRecoveryRequired)
|
||||||
return true;
|
return true;
|
||||||
var reties = 2;
|
var retries = 2;
|
||||||
|
var meterApps = new List<MeterApplications>();
|
||||||
|
cordonel.RecoveryRegisters = new List<RecoveryRegisterItem>();
|
||||||
|
var statusReturn = StatusReturn.Okay;
|
||||||
|
String msg;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
cordonel.RecoveryRegisters = new List<RecoveryRegisterItem>();
|
try
|
||||||
if (_fwUpdateDbAccess == null ||
|
{
|
||||||
!_fwUpdateDbAccess.DownloadCordonelRecoveryRegistersFromDb(cordonel.PcbId, ref cordonel.RecoveryRegisters))
|
// get the programming parameters from DB
|
||||||
|
if (_fwUpdateDbAccess != null && _fwUpdateDbAccess.DownloadCordonelRecoveryRegistersFromDb(
|
||||||
|
cordonel.PcbId, ref cordonel.RecoveryRegisters))
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LogErrorText(e.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (retries-- > 0);
|
||||||
|
|
||||||
|
// DB download failed
|
||||||
|
if (retries <= 0)
|
||||||
|
{
|
||||||
|
msg = Resources.StrCordonelRecoveryRegisterLoadFailed + " " + cordonel.PcbId + " - " +
|
||||||
|
cordonel.CustomerSerialNumber;
|
||||||
|
LogErrorText(msg);
|
||||||
|
MessageBoxShow(msg, Resources.StrError, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// start to build a mock genesis based on the required application versions
|
||||||
|
var mockGenesis = new GenesisMeter();
|
||||||
|
var configRegisters = new GenesisConfigurationReader();
|
||||||
|
var configurationJson = "";
|
||||||
|
|
||||||
|
// get the configuration.json out of the SW package which has to be downloaded in advance
|
||||||
|
if (_fwUpdateSwContainer?.RegisterDefinitionFile?.FileContent?.Length > 0)
|
||||||
|
{
|
||||||
|
configurationJson = Encoding.Default.GetString(
|
||||||
|
_fwUpdateSwContainer.RegisterDefinitionFile.FileContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the application list out of the FW package which has to be downloaded in advance
|
||||||
|
if (_fwUpdatePackage?.BinaryApplicationFiles?.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var fileApp in _fwUpdatePackage.BinaryApplicationFiles)
|
||||||
|
{
|
||||||
|
meterApps.Add(new MeterApplications
|
||||||
|
{
|
||||||
|
AppId = MeterFwUpdate.GetFileAppAppId(fileApp.FileContent),
|
||||||
|
Version = MeterFwUpdate.GetFileAppVersion(fileApp.FileContent),
|
||||||
|
Crc = MeterFwUpdate.GetFileAppCrc(fileApp.FileContent),
|
||||||
|
IsInstalled = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build a list of all accessible registers if the interface and meter applications are defined on
|
||||||
|
// an input of applications and configurationJson as those are from a mock GenesisMeter. If the meterApps
|
||||||
|
// and the configurationJson are null, the _currentGenesis is a real device and all valid registers based
|
||||||
|
// on the application versions are already defined!
|
||||||
|
if (!string.IsNullOrEmpty(configurationJson) && meterApps.Count > 0)
|
||||||
|
{
|
||||||
|
// read the raw configuration.json to build a register list of ALL registers defined there
|
||||||
|
configRegisters.BuildRegisterList(configurationJson);
|
||||||
|
// inject registers to mock Genesis
|
||||||
|
mockGenesis.SetConfigRegisterDefinitions(configRegisters.ConfigRegistersDefinitions);
|
||||||
|
// take the created dictionary to extract the valid registers for the applications
|
||||||
|
var configDefRegisters = mockGenesis.GetConfigRegistersDefinitions().MeterRegisterDic.ToList();
|
||||||
|
// set the (intended to be) installed applications
|
||||||
|
mockGenesis.MeterAppListVersion.AddRange(meterApps);
|
||||||
|
// extract the valid meter registers for the target application versions
|
||||||
|
mockGenesis.BuildValidMeterRegisters(configDefRegisters);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the pre-defined dictionary
|
||||||
|
var meterRegisters = mockGenesis.GetConfigRegistersDefinitions();
|
||||||
|
|
||||||
|
foreach (var recReg in cordonel.RecoveryRegisters)
|
||||||
|
{
|
||||||
|
// if this call does not throw an exception, the register is present
|
||||||
|
var regDef = meterRegisters.GetRegisterDefinitionByName(recReg.RegisterIdent);
|
||||||
|
|
||||||
|
RegisterRestorer.ValidateRegisterRange(recReg, regDef, out var errorMessage);
|
||||||
|
if (string.IsNullOrEmpty(errorMessage))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
LogSuccessText(Resources.StrCordonelRecoveryRegistersAdded + " " + cordonel.PcbId + " - " + cordonel.CustomerSerialNumber);
|
statusReturn = StatusReturn.Failed;
|
||||||
return true;
|
LogErrorText(errorMessage);
|
||||||
} while (reties-- > 0);
|
}
|
||||||
|
|
||||||
var msg = Resources.StrCordonelRecoveryRegisterLoadFailed + " " + cordonel.PcbId + " - " + cordonel.CustomerSerialNumber;
|
if (statusReturn == StatusReturn.Okay)
|
||||||
|
{
|
||||||
|
LogSuccessText(Resources.StrCordonelRecoveryRegistersAdded + " " + cordonel.PcbId + " - " +
|
||||||
|
cordonel.CustomerSerialNumber);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = Resources.StrCordonelRecoveryRegisterLoadFailed + " " + cordonel.PcbId + " - " +
|
||||||
|
cordonel.CustomerSerialNumber;
|
||||||
LogErrorText(msg);
|
LogErrorText(msg);
|
||||||
MessageBoxShow(msg, Resources.StrError, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBoxShow(msg, Resources.StrError, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -192,6 +192,14 @@
|
|||||||
<Project>{A25A96FD-604B-43BE-80CD-A953152C2175}</Project>
|
<Project>{A25A96FD-604B-43BE-80CD-A953152C2175}</Project>
|
||||||
<Name>Cryptology</Name>
|
<Name>Cryptology</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\Applications\Applications.csproj">
|
||||||
|
<Project>{315E94B8-B82F-4B25-B5BD-297DF3BC1D54}</Project>
|
||||||
|
<Name>Applications</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\GenesisCore\GenesisCore.csproj">
|
||||||
|
<Project>{04201E95-90A0-4B73-A72F-379739B2A3AE}</Project>
|
||||||
|
<Name>GenesisCore</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\GenesisFile\GenesisFile.csproj">
|
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\Genesis\GenesisFile\GenesisFile.csproj">
|
||||||
<Project>{2C6378C6-6BA1-4CEE-8992-8404D8369A90}</Project>
|
<Project>{2C6378C6-6BA1-4CEE-8992-8404D8369A90}</Project>
|
||||||
<Name>GenesisFile</Name>
|
<Name>GenesisFile</Name>
|
||||||
@@ -200,6 +208,10 @@
|
|||||||
<Project>{F4AAF7E6-7333-4284-B735-E32DEB076C64}</Project>
|
<Project>{F4AAF7E6-7333-4284-B735-E32DEB076C64}</Project>
|
||||||
<Name>Registers</Name>
|
<Name>Registers</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\..\Common\Hardware\WaterMeter\WaterMeterCore\WaterMeterRegisters\WaterMeterRegisters.csproj">
|
||||||
|
<Project>{26AFCF1E-1287-48B8-A506-32B1E8A0DD0E}</Project>
|
||||||
|
<Name>WaterMeterRegisters</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\Common\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
|
<ProjectReference Include="..\..\..\Common\Logic.PrdoctionToProductMapper\Logic.ProductionToProductMapper.csproj">
|
||||||
<Project>{d0c859d9-d55e-4e85-ac50-0ff31b1ce50d}</Project>
|
<Project>{d0c859d9-d55e-4e85-ac50-0ff31b1ce50d}</Project>
|
||||||
<Name>Logic.ProductionToProductMapper</Name>
|
<Name>Logic.ProductionToProductMapper</Name>
|
||||||
|
|||||||
@@ -4060,6 +4060,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
/// <remarks date="2024-Mar-12" author="Thomas Wiedebusch">
|
/// <remarks date="2024-Mar-12" author="Thomas Wiedebusch">
|
||||||
/// - If verify meter files succeeded the lblFileErase can be set to success as every file could be read.
|
/// - If verify meter files succeeded the lblFileErase can be set to success as every file could be read.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-09" author="Thomas Wiedebusch">
|
||||||
|
/// - ReLogin replaced with Logout, Delay 250 ms and Login.
|
||||||
|
/// </remarks>
|
||||||
private void ReadMeterFiles(ProcessState successExitState, ProcessState errorExitState = ProcessState.Error)
|
private void ReadMeterFiles(ProcessState successExitState, ProcessState errorExitState = ProcessState.Error)
|
||||||
{
|
{
|
||||||
// remind the invoker being able to generate error messages based on the last state
|
// remind the invoker being able to generate error messages based on the last state
|
||||||
@@ -4082,7 +4085,10 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
InfoProcessActive(lblFileRestore, Resources.StrFileAccessActive, false);
|
InfoProcessActive(lblFileRestore, Resources.StrFileAccessActive, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_currentGenesis.ReLogin();
|
|
||||||
|
_currentGenesis.Logout();
|
||||||
|
Thread.Sleep(250);
|
||||||
|
_currentGenesis.Login();
|
||||||
// read all meter files
|
// read all meter files
|
||||||
_meterFile = new MeterFile(_currentGenesis);
|
_meterFile = new MeterFile(_currentGenesis);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user