This commit is contained in:
Roland Drabesch 2026-02-10 15:11:36 +01:00
commit ddaf4081a1
477 changed files with 29203 additions and 136101 deletions

3
.gitignore vendored
View File

@ -400,5 +400,4 @@ FodyWeavers.xsd
/Common/CommonConsole
/Common/Common.v3.ncrunchsolution
/TBF_V2/Sources/TBF/TBF/BenchControl/TestMethods/GenesisCommunication.zip
/Common.zip
/TBF_V2/Sources/TBF
/Common/Hardware/WaterMeter/Genesis/GenesisCore/configuration2013.json

View File

@ -3,84 +3,84 @@
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<variable name="BasePath" value="\\delaz1fsops01\cordonelds$"/>
<targets>
<!--CalibrationHelper-->
<target name="CalibrationHelper" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\CalibrationHelper.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_CalibrationHelper.log" />
<variable name="BasePath" value="\\DELAZ1FSOPS01-1\CordonelDS$\${loggerpc}" />
<targets>
<!--LedRawData-->
<target xsi:type="BufferingWrapper"
name="TargetLedRawDataBase"
bufferSize="10000"
flushTimeout="-1"
slidingTimeout="true"
<!--CalibrationHelper-->
<target name="CalibrationHelper" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\CalibrationHelper.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}CalibrationHelper.log" />
<!--LedRawData-->
<target xsi:type="BufferingWrapper"
name="TargetLedRawDataBase"
bufferSize="10000"
flushTimeout="-1"
slidingTimeout="true"
>
<target name="LedRawDataBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\LedRawData_BASE.log" CreateDirs="True" layout ="${longdate} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_LedRawData_BASE.log" />
</target>
<!--C:\GenesisLog\${shortdate}
<target name="LedRawDataBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\LedRawData_BASE.log" CreateDirs="True" layout ="${longdate} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_LedRawData_BASE.log" />
</target>
<!--C:\GenesisLog\${shortdate}
C:\GenesisLog\${shortdate}-->
<!--MeterBatch-->
<target name="MeterBatch" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_Meter_BASE.log" />
<!--MeterBatch-->
<target name="MeterBatch" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_Meter_BASE.log" />
<!--Meter-->
<target name="MeterBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_Meter_BASE.log" />
<target name="Slot:0" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_SlotSlot:0.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_Meter_SlotSlot:0.log" />
<!--Meter-->
<target name="MeterBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_Meter_BASE.log" />
<target name="Slot:0" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\Meter_SlotSlot:0.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_Meter_SlotSlot:0.log" />
<!--COM-->
<target name="COMBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\COM_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_COM_BASE.log" />
<!--ServiceFwUpdateBuilder-->
<target name="ServiceFwUpdateBuilder" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateBuilder.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ServiceFwUpdateBuilder.log" />
<!--COM-->
<target name="COMBase" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\COM_BASE.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_COM_BASE.log" />
<!--ServiceFwUpdateLoader-->
<target name="ServiceFwUpdateLoader" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateLoader.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ServiceFwUpdateLoader.log" />
<!--ServiceFwUpdateBuilder-->
<target name="ServiceFwUpdateBuilder" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateBuilder.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_ServiceFwUpdateBuilder.log" />
<!--ServiceFwUpdateSw-->
<target name="ServiceFwUpdateSw" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateSw.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ServiceFwUpdateSw.log" />
<!--ServiceFwUpdateLoader-->
<target name="ServiceFwUpdateLoader" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateLoader.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_ServiceFwUpdateLoader.log" />
<!--default-->
<target name="default" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\default.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_default.log" />
<target name="PreAdjWr" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\PreAdjWr.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
<!--ServiceFwUpdateSw-->
<target name="ServiceFwUpdateSw" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ServiceFwUpdateSw.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_ServiceFwUpdateSw.log" />
<target name="ctlBatch" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ctlBatch.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="C:\GenesisLog\${shortdate}\${processname}\{##}_ctlBatch.log" />
<target name="StreamingQualityFile" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\StreamingQuality.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
<target name="ProductionUIFile" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ProductionUIFile.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
</targets>
<rules>
<!--ServiceFwUpdateBuilder-->
<logger name="ServiceFwUpdateBuilder" minLevel="Trace" appendTo="ServiceFwUpdateSw"/>
<!--ServiceFwUpdateLoader-->
<logger name="ServiceFwUpdateLoader" minLevel="Trace" appendTo="ServiceFwUpdateLoader"/>
<!--ServiceFwUpdateSw-->
<logger name="ServiceFwUpdateSw" minLevel="Trace" appendTo="ServiceFwUpdateSw"/>
<!--CalibrationHelper-->
<logger name="CalibrationHelper" minLevel="Trace" appendTo="CalibrationHelper"/>
<!--LedRawData-->
<logger name="LedRawDataBase" minLevel="Trace" appendTo="TargetLedRawDataBase"/>
<!--MeterBatch-->
<logger name="MeterBatch" minLevel="Trace" appendTo="MeterBatch"/>
<!--Meter-->
<logger name="MeterBase" minLevel="Trace" appendTo="MeterBase"/>
<logger name="Slot:0" minLevel="Trace" appendTo="Slot:0"/>
<logger name="GenesisRequestProtocolBase" minLevel="Trace" appendTo="MeterBase"/>
<logger name="MeasurementBase" minLevel="Trace" appendTo="MeterBase"/>
<!--COM-->
<logger name="SerialComPortBase" minLevel="Trace" appendTo="COMBase"/>
<logger name="IrdaBase" minLevel="Trace" appendTo="COMBase"/>
<logger name="RfidBase" minLevel="Trace" appendTo="COMBase"/>
<logger name="TransmitProtocolBase" minLevel="Trace" appendTo="COMBase"/>
<!--default-->
<logger name="*" minLevel="Debug" appendTo="default"/>
<!--default-->
<target name="default" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\default.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_default.log" />
<target name="PreAdjWr" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\PreAdjWr.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
<!--Ui logger-->
<logger name="ctlBatch" minLevel="Trace" appendTo="ctlBatch"/>
<logger name="StreamingQuality" minLevel="Trace" appendTo="StreamingQualityFile"/>
<logger name="PreAdjWr" minLevel="Trace" appendTo="PreAdjWr"/>
<target name="ctlBatch" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ctlBatch.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" archiveAboveSize="50000000" archiveFileName="${BasePath}\${shortdate}\${processname}\{##}_ctlBatch.log" />
<target name="StreamingQualityFile" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\StreamingQuality.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
<target name="ProductionUIFile" xsi:type="File" fileName="${BasePath}\${shortdate}\${processname}\ProductionUIFile.log" CreateDirs="True" layout ="${longdate} | ${level} | ${message} ${exception:format=toString}" />
</targets>
<rules>
<!--ServiceFwUpdateBuilder-->
<logger name="ServiceFwUpdateBuilder" minLevel="Trace" appendTo="ServiceFwUpdateSw"/>
<!--ServiceFwUpdateLoader-->
<logger name="ServiceFwUpdateLoader" minLevel="Trace" appendTo="ServiceFwUpdateLoader"/>
<!--ServiceFwUpdateSw-->
<logger name="ServiceFwUpdateSw" minLevel="Trace" appendTo="ServiceFwUpdateSw"/>
<!--CalibrationHelper-->
<logger name="CalibrationHelper" minLevel="Trace" appendTo="CalibrationHelper"/>
<!--LedRawData-->
<logger name="LedRawDataBase" minLevel="Trace" appendTo="TargetLedRawDataBase"/>
<!--MeterBatch-->
<logger name="MeterBatch" minLevel="Trace" appendTo="MeterBatch"/>
<!--Meter-->
<logger name="MeterBase" minLevel="Trace" appendTo="MeterBase"/>
<logger name="Slot:0" minLevel="Trace" appendTo="Slot:0"/>
<logger name="ProductionUI" minLevel="Trace" appendTo="ProductionUIFile"/>
</rules>
<logger name="GenesisRequestProtocolBase" minLevel="Trace" appendTo="MeterBase"/>
<logger name="MeasurementBase" minLevel="Trace" appendTo="MeterBase"/>
<!--COM-->
<logger name="SerialComPortBase" minLevel="Trace" appendTo="COMBase"/>
<logger name="IrdaBase" minLevel="Trace" appendTo="COMBase"/>
<logger name="RfidBase" minLevel="Trace" appendTo="COMBase"/>
<logger name="TransmitProtocolBase" minLevel="Trace" appendTo="COMBase"/>
<!--default-->
<logger name="*" minLevel="Debug" appendTo="default"/>
<!--Ui logger-->
<logger name="ctlBatch" minLevel="Trace" appendTo="ctlBatch"/>
<logger name="StreamingQuality" minLevel="Trace" appendTo="StreamingQualityFile"/>
<logger name="PreAdjWr" minLevel="Trace" appendTo="PreAdjWr"/>
<logger name="ProductionUI" minLevel="Trace" appendTo="ProductionUIFile"/>
</rules>
</nlog>

View File

@ -13,5 +13,4 @@ using System.Reflection;
//
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.7.3.*")]
[assembly: AssemblyVersion("2.8.16.*")]

View File

@ -160,6 +160,22 @@
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
</bindings>
</site>
<site name="MeterProcessState(1)" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56015:localhost" />
</bindings>
</site>
<site name="MeterProcessState(2)" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:50075:localhost" />
</bindings>
</site>
<siteDefaults>
<!-- To enable logging, please change the below attribute "enabled" to "true" -->

View File

@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@ -168,6 +168,30 @@
<bindings>
<binding protocol="http" bindingInformation="*:59615:localhost" />
</bindings>
</site>
<site name="MeterProcessState(1)" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56015:localhost" />
</bindings>
</site>
<site name="MeterProcessState(2)" id="5">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="E:\REPO\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:50015:localhost" />
</bindings>
</site>
<site name="MeterProcessState(3)" id="6">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:50075:localhost" />
</bindings>
</site>
<siteDefaults>
<!-- To enable logging, please change the below attribute "enabled" to "true" -->

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings>
<add key="LocalFolder" value="\\sla12file\vorlagen\Stoyan\Laser"/>
<add key="SharedFolder" value="\\sla12file\auftrag\Stoyan\Laser"/>
</appSettings>
</configuration>

View File

@ -0,0 +1,76 @@
<?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>{6746517C-BE89-4637-A283-0A932A50497A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Common.Services.LaserImport</RootNamespace>
<AssemblyName>Common.Services.LaserImport</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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.Configuration" />
<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="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,130 @@
namespace Common.Services.LaserImport
{
using System;
using System.Configuration;
using System.IO;
using System.Threading;
class Program
{
static readonly KeyValueConfigurationCollection appsettings
= ConfigurationManager
.OpenExeConfiguration(typeof(Program).Assembly.Location)
.AppSettings
.Settings;
static readonly string sharedFolder = appsettings["SharedFolder"].Value;
static readonly string localFolder = appsettings["LocalFolder"].Value;
static readonly FileSystemWatcher serverWatcher = new FileSystemWatcher(sharedFolder);
static readonly FileSystemWatcher clientWhatcher = new FileSystemWatcher(localFolder);
static readonly ManualResetEventSlim awaiter = new ManualResetEventSlim();
static string fileToDelete;
static void Main()
{
serverWatcher.Created += ServerWatcher_FileCreated;
serverWatcher.NotifyFilter = NotifyFilters.FileName;
serverWatcher.IncludeSubdirectories = false;
serverWatcher.EnableRaisingEvents = true;
clientWhatcher.Deleted += CleintWatcher_FileDeleted;
clientWhatcher.NotifyFilter = NotifyFilters.FileName;
clientWhatcher.IncludeSubdirectories = false;
clientWhatcher.EnableRaisingEvents = true;
WaithLaserReady();
}
private static void WaithLaserReady()
{
var fg = ConsoleColor.DarkGray;
Console.ForegroundColor = fg;
while (true)
{
awaiter.Reset();
awaiter.Wait();
Console.ForegroundColor = ConsoleColor.White;
Console.Write($"LASERUNG BESTÄTIGEN");
Console.ReadLine();
Console.ForegroundColor = fg;
while (File.Exists(fileToDelete))
{
try
{
File.Delete(fileToDelete);
Console.WriteLine($"{fileToDelete} - deleted");
break;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Thread.Sleep(100);
}
}
Console.Clear();
}
}
/// <summary>
/// Occures when file deleted on laser PC
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private static void CleintWatcher_FileDeleted(object _, FileSystemEventArgs args)
{
fileToDelete = Path.Combine(sharedFolder, args.Name);
if (!File.Exists(fileToDelete))
{
Console.WriteLine($"{fileToDelete} - dose not exists!");
fileToDelete = string.Empty;
}
else
{
awaiter.Set();
}
}
/// <summary>
/// Occures when file created from the laserkennzeichnung
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
private static void ServerWatcher_FileCreated(object _, FileSystemEventArgs args)
{
var sourceFilePath = args.FullPath;
var destinationFilePath = Path.Combine(localFolder, args.Name);
Thread.Sleep(1000);
if (File.Exists(sourceFilePath))
{
while (true)
{
try
{
File.Copy(sourceFilePath, destinationFilePath, true);
break;
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Thread.Sleep(100);
}
}
Console.WriteLine($"{sourceFilePath} copied to {destinationFilePath}");
}
else
{
Console.WriteLine($"{sourceFilePath} - dose not exists!");
}
}
}
}

View File

@ -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("Common.Services.LaserImport")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Common.Services.LaserImport")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[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("6746517c-be89-4637-a283-0a932a50497a")]
// 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")]

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,60 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeEditing/ContextActionTable/DisabledContextActions/=JetBrains_002EReSharper_002EAI_002ECore_002EContextActions_002EOpenAIAssistantContextAction/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AdditionalAliasItemsToCorrectCommonErrors/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteBasicCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteImportCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutoCompleteSmartCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/AutopopupEnabled/AutopopupEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ConfirmReferenceAdd/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ImportItemsInBasicCompletion/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/InsertSpacingAfterKeywordsWhenRequired/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntellisenseGloballyEnabled/IntellisenseEnabled/@EntryValue">Enabled</s:String>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/MiddleMatchingCompletion/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ParenthesesInsertType/@EntryValue">Left</s:String>
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/ReplaceKeywordsWithTemplates/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IdentifierHighlightingEnabled/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeMissingParentheses/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexedValue">SUGGESTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedLocalFunction/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedLocalFunction_002ECompiler/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedType_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PARENTHESES_GROUP_NON_OBVIOUS_OPERATIONS/@EntryValue">Arithmetic, Relational, Conditional</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PARENTHESES_NON_OBVIOUS_OPERATIONS/@EntryValue">Arithmetic, Shift, Relational, Equality, Bitwise, Conditional, NullCoalescing, Lowest</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PARENTHESES_REDUNDANCY_STYLE/@EntryValue">Remove</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PREFER_ROSLYN_RULES_FOR_PARENTHESES_CLARITY/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ACCESSOR_OWNER_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">120</s:Int64>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DN/@EntryIndexedValue">DN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FW/@EntryIndexedValue">FW</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LUT/@EntryIndexedValue">LUT</s:String>
<s:Boolean x:Key="/Default/Environment/AIAssistantOptions/AiRenameSuggestions/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AIAssistantOptions/IsAccessToCodeEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AIAssistantOptions/IsContextActionsEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AIAssistantOptions/IsContextSlidingWindowEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AIAssistantOptions/IsExplainExceptionEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/AIInplaceSuggestionHintsOptions/ShowInPlaceSuggestionHints/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/GrayCodeCompletion/IsEnabled/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchBehaviour/=InjectedSettings/@EntryIndexedValue">DO_NOTHING</s:String>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchConflictResolutionMode/=InjectedSettings/@EntryIndexedValue"></s:String>
<s:Boolean x:Key="/Default/Environment/PerformanceGuide/SwitchConflictResolutionMode/=InjectedSettings/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/SaveExtendedSearch/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SearchAndNavigation/UseReSharperMouseBackForwardNavigation/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/GrammarAndSpelling/GrammarChecking/Exceptions/=na2walarms/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/GrammarAndSpelling/GrammarChecking/LanguagesStates/=Asturianu/@EntryIndexedValue">Disabled</s:String>
<s:Boolean x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=5B50CE537BBA2B4D9879790BFA6A0E3D/@KeyIndexDefined">True</s:Boolean>
<s:Boolean x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=5B50CE537BBA2B4D9879790BFA6A0E3D/MatchComments/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=5B50CE537BBA2B4D9879790BFA6A0E3D/Name/@EntryValue">TODO</s:String>
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=5B50CE537BBA2B4D9879790BFA6A0E3D/Pattern/@EntryValue">TODO</s:String>
<s:String x:Key="/Default/PatternsAndTemplates/Todo/TodoPatterns/=5B50CE537BBA2B4D9879790BFA6A0E3D/TodoIconStyle/@EntryValue">Normal</s:String>
@ -23,6 +68,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Battey/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=binfile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=BUGFIX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=BUPS/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Calib/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=catalogue/@EntryIndexedValue">True</s:Boolean>
@ -32,6 +78,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonel/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CUST/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DIAVASO/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=dispached/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=DNMAX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Drabesch/@EntryIndexedValue">True</s:Boolean>
@ -40,9 +87,12 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=endian/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FFFF/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Flexnet/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLEXNETSERIAL/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FLEXNETVERSION/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Flowrate/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fwdl/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=GENESISFLOW/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gensis/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=GENSISFLOW/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Irda/@EntryIndexedValue">True</s:Boolean>
@ -54,20 +104,29 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Milli/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Modbus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=MOXA/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=naproduct/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=OPTICALINTERFACE/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PCBID/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=perc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=PERIODICLOG/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=POWEMON/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=POWERMON/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Preadjustment/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=prot/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pwds/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=restorable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=RFID/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=rowproduct/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sensus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SENSUSRADIO/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Sirt/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=storecalibration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=storeconfiguration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=TESTMANAGER/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Thermo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Uart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=uintxx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Uniontown/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Vako/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=walarms/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Wiedebusch/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -1,5 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeMissingParentheses/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002ELocal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/PREFER_ROSLYN_RULES_FOR_PARENTHESES_CLARITY/@EntryValue">True</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/AutoNamingCompletedVersion/@EntryValue">2</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNamingAutoDetectionCompleted/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpAutoNaming/IsNotificationDisabled/@EntryValue">True</s:Boolean>
@ -36,7 +38,12 @@
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=d5d84997_002D9b95_002D490a_002Da9a3_002Da461c5e0d514/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Solution /&gt;&#xD;
&lt;Not&gt;&#xD;
&lt;TestAncestor&gt;&#xD;
&lt;TestId&gt;VsTest::48DA0272-9B14-4CC8-976F-A91E42DE4680::.NETFramework,Version=v4.8.1::executor://nunit3testexecutor/#Xylem.Common.Production.ProductionUiCordonel.UnitTests.Features.CheckProductionStateFeature&lt;/TestId&gt;&#xD;
&lt;TestId&gt;VsTest::48DA0272-9B14-4CC8-976F-A91E42DE4680::.NETFramework,Version=v4.8.1::executor://nunit3testexecutor/#Xylem.Common.Production.ProductionUiCordonel.UnitTests.Features.FinalParamSequence_Write_Store_Reboot_Read_VerifyFeature&lt;/TestId&gt;&#xD;
&lt;/TestAncestor&gt;&#xD;
&lt;/Not&gt;&#xD;
&lt;/SessionState&gt;</s:String>

View File

@ -32,7 +32,7 @@
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
<<<<<<< HEAD
=======
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Thomas Müller\AppData\Local\Temp\JetBrains\ReSharperPlatformVs17\vAny_ab6433f6\CoverageData\_Common.-1885154465\Snapshot\snapshot.utdcvr</s:String>
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Thomas\AppData\Local\Temp\JetBrains\ReSharperPlatformVs17\vAny_ab6433f6\CoverageData\_Common.-1885154465\Snapshot\snapshot.utdcvr</s:String>
>>>>>>> origin/main
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>

View File

@ -37,68 +37,14 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Office.Client.Policy, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.Office.Client.Policy.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Client.TranslationServices, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.Office.Client.TranslationServices.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.SharePoint.Tools, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.Office.SharePoint.Tools.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Online.SharePoint.Client.Tenant, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.Online.SharePoint.Client.Tenant.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ProjectServer.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.ProjectServer.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.DocumentManagement, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.DocumentManagement.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Publishing, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.Publishing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Runtime, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.Runtime.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Search, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.Search.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Search.Applications, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.Search.Applications.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.Taxonomy, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.Taxonomy.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.UserProfiles, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.UserProfiles.dll</HintPath>
</Reference>
<Reference Include="Microsoft.SharePoint.Client.WorkflowServices, Version=16.1.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SharePointOnline.CSOM.16.1.26017.12000\lib\net45\Microsoft.SharePoint.Client.WorkflowServices.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Hardware\Common.Hardware.SIRT\Common.Hardware.SIRT.csproj">
<Project>{8de8e742-ee0a-4004-aa49-3d08d748e5ac}</Project>
@ -108,35 +54,10 @@
<Project>{4e8bb839-d40a-488c-88ce-f21811f1f476}</Project>
<Name>Common.Hardware.WaterMeter.eRegister</Name>
</ProjectReference>
<ProjectReference Include="..\Hardware\WaterMeter\Genesis\Registers\Registers.csproj">
<Project>{f4aaf7e6-7333-4284-b735-e32deb076c64}</Project>
<Name>Registers</Name>
</ProjectReference>
<ProjectReference Include="..\LaaPackages\LaaPackages.SqlClient\LaaPackages.SqlClient.csproj">
<Project>{F90B940C-9A83-496D-AAE0-11CD02CE0A22}</Project>
<Name>LaaPackages.SqlClient</Name>
</ProjectReference>
<ProjectReference Include="..\Stichproben\Stichproben.csproj">
<Project>{F69A79FA-548D-4E21-887E-01FABDAD9E73}</Project>
<Name>Stichproben</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions">
<Version>8.3.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.SharePointOnline.CSOM">
<Version>16.1.26121.12000</Version>
</PackageReference>
<PackageReference Include="NUnit">
<Version>4.3.2</Version>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter">
<Version>5.0.0</Version>
</PackageReference>
<PackageReference Include="SpecFlow.NUnit">
<Version>3.9.74</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,201 +1,540 @@
namespace CommonConsole
{
public static class Program
using System;
public static partial class Program
{
public static void Main()
static void Main()
{
////var x = (625L * 65536) | 0x80_00_00_00;
////Console.WriteLine((int)x);
////var semiBytes25747925 = new byte[] { 0x08, 0x03, 0x12, 0x6B, 0x78, 0x41, 0x00, 0x00, 0x01, 0xF4, 0x00, 0x00, 0x83, 0x0C, 0x00, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x13, 0x01, 0x88, 0xE1, 0xD5, 0x07, 0x0E, 0x10, 0xEC, 0x56, 0x13, 0xDA, 0x4C, 0x00, 0x00, 0x7F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x1E, 0x00, 0x03, 0x01, 0x2F, 0xBE, 0xCA, 0x47, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xEF, 0xA6 };
////var semi25747925 = new SEMI(semiBytes25747925, 868, 0);
////var debugBytes25747925 = new byte[] { 0x0B, 0x10, 0x12, 0x6B, 0x78, 0x41, 0x00, 0x0C, 0x11, 0x0B, 0x11, 0x08, 0x04, 0x02, 0x7C, 0x4C, 0x12, 0x84, 0x15, 0x00, 0x66, 0x00, 0x35, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4A, 0x8F, 0xD2, 0x02, 0x01, 0x01, 0x16, 0x00, 0x1B, 0x02, 0x71, 0x00, 0x00, 0x82, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xA0, 0xA5 };
////var debug25747925 = new DEBUG(debugBytes25747925, 0);
////var siteUrl = "https://1xylemeur.sharepoint.com/sites/geckoSrc/customer/Pub_CSD/Forms/AllItems.aspx";
////var userName = "stoyan.zlatev@xylem.com";
////var password = "****************";
////var securePassword = new SecureString();
////foreach (var c in password)
////{
//// securePassword.AppendChar(c);
////}
////using (var context = new ClientContext(siteUrl))
////{
//// context.Credentials = new SharePointOnlineCredentials(userName, securePassword);
//// var web = context.Web;
//// context.Load(web);
//// context.ExecuteQuery();
//// Console.WriteLine("Site Title: " + web.Title);
////}
}
//public static void Main()
static void Main_ProgrammingParameters_Cordonel()
{
var alarmMask = 0 << AlarmMask.ALARM_REBOOT
| 1 << AlarmMask.ALARM_LOW_BATTERY
| 0 << AlarmMask.ALARM_VERY_LOW_BATTERY
| 0 << AlarmMask.ALARM_CONFIG_ERROR
| 1 << AlarmMask.ALARM_EMPTY_PIPE
| 0 << AlarmMask.ALARM_MAGNETIC_TAMPER
| 1 << AlarmMask.ALARM_REVERSE_FLOW
| 1 << AlarmMask.ALARM_SUSPECT_LEAK
| 1 << AlarmMask.ALARM_BROKEN_PIPE
| 0 << AlarmMask.ALARM_LOW_PRESSURE
| 0 << AlarmMask.ALARM_HIGH_PRESSURE
| 0 << AlarmMask.ALARM_LOW_TEMPERATURE
| 0 << AlarmMask.ALARM_HIGH_TEMPERATURE
| 0 << AlarmMask.ALARM_RADIO_ERROR
| 0 << AlarmMask.ALARM_METROLOGY_PARAMS
| 0 << AlarmMask.ALARM_METROLOGY_MEASURE
| 0 << AlarmMask.ALARM_MAX;
var alarmBytes = BitConverter.GetBytes(alarmMask);
Array.Reverse(alarmBytes);
Console.WriteLine($"{"ALARMS:",11} {alarmMask,11} - {BitConverter.ToString(alarmBytes).Replace("-", "")}");
uint content = // (uint)1 << LogContentBits.AlarmStatus // ALWAYS ON
//| (uint)1 << LogContentBits.BillingCounter // ALWAYS ON
(uint)0 << LogContentBits.ReverseCounter //
| (uint)0 << LogContentBits.MaxFlow //
| (uint)0 << LogContentBits.MaxFlowTime //
| (uint)0 << LogContentBits.PeakFlow //
| (uint)0 << LogContentBits.PeakFlowTime //
| (uint)0 << LogContentBits.AvgFlow //
| (uint)0 << LogContentBits.BrokenPipe //
| (uint)0 << LogContentBits.BrokenPipeTime //
| (uint)0 << LogContentBits.MinFlow //
| (uint)0 << LogContentBits.MinFlowTime //
| (uint)0 << LogContentBits.ForwardCounter //
| (uint)0 << LogContentBits._UTC32 // ALWAYS ON
//| (uint)0 << LogContentBits._MaskSelector_1_1 //
//| (uint)0 << LogContentBits._MaskSelector_1_2 //
| (uint)0 << LogContentBits.MinPress //
| (uint)0 << LogContentBits.MinPressTime //
| (uint)0 << LogContentBits.MaxPress //
| (uint)0 << LogContentBits.MaxPressTime //
| (uint)0 << LogContentBits.MinTemp //
| (uint)0 << LogContentBits.MinTempTime //
| (uint)0 << LogContentBits.MaxTemp //
| (uint)0 << LogContentBits.MaxTempTime //
| (uint)0 << LogContentBits.CurrentPress //
| (uint)0 << LogContentBits.CurrentTemp; //
//| (uint)1 << LogContentBits.ExtendedAlarm // ALWAYS ON
//| (uint)1 << LogContentBits._RecordCheckSum; // ALWAYS ON
var contentBytes = BitConverter.GetBytes(content);
Array.Reverse(contentBytes);
Console.WriteLine($"{"DATALOGGER:",11} {content,11} - {BitConverter.ToString(contentBytes).Replace("-", "")}");
uint fdr = // (uint)1 << LogContentBits.AlarmStatus // ALWAYS ON
//| (uint)1 << LogContentBits.BillingCounter // ALWAYS ON
(uint)0 << LogContentBits.ReverseCounter //
| (uint)0 << LogContentBits.MaxFlow //
| (uint)0 << LogContentBits.MaxFlowTime //
| (uint)0 << LogContentBits.PeakFlow //
| (uint)0 << LogContentBits.PeakFlowTime //
| (uint)0 << LogContentBits.AvgFlow //
| (uint)0 << LogContentBits.BrokenPipe //
| (uint)0 << LogContentBits.BrokenPipeTime //
| (uint)0 << LogContentBits.MinFlow //
| (uint)0 << LogContentBits.MinFlowTime //
| (uint)0 << LogContentBits.ForwardCounter //
| (uint)0 << LogContentBits._UTC32 // ALWAYS ON
//| (uint)0 << LogContentBits._MaskSelector_1_1 //
//| (uint)0 << LogContentBits._MaskSelector_1_2 //
| (uint)0 << LogContentBits.MinPress //
| (uint)0 << LogContentBits.MinPressTime //
| (uint)0 << LogContentBits.MaxPress //
| (uint)0 << LogContentBits.MaxPressTime //
| (uint)0 << LogContentBits.MinTemp //
| (uint)0 << LogContentBits.MinTempTime //
| (uint)0 << LogContentBits.MaxTemp //
| (uint)0 << LogContentBits.MaxTempTime //
| (uint)0 << LogContentBits.CurrentPress //
| (uint)0 << LogContentBits.CurrentTemp; //
//| (uint)1 << LogContentBits.ExtendedAlarm // ALWAYS ON
//| (uint)1 << LogContentBits._RecordCheckSum; // ALWAYS ON
var fdrBytes = BitConverter.GetBytes(fdr);
Array.Reverse(fdrBytes);
Console.WriteLine($"{"FDR:",11} {fdr,11} - {BitConverter.ToString(fdrBytes).Replace("-", "")}");
Console.WriteLine();
//uint min = 201344787;
//uint def = 206906379;
//uint max = 4294967295;
//for (byte i = 0; i < LogContentBits.BitMask.Length; i++)
//{
// Console.WriteLine($"Min: {(min >> i) % 2} - Def: {(def >> i) % 2} - Max: {(max >> i) % 2} - {LogContentBits.BitMask[i]}");
//}
} // CONTENT: 67110031 - 04-00-04-8F => 0400048F <-> 8F040004 04000C03
static void Main123()
{
// Console.WriteLine(BitConverter.ToInt32(new byte[] { 0xEC, 0xFF, 0xFF, 0xFF }, 0));
// SIRTServer.StartServer(Console.WriteLine, Console.WriteLine, 6, 8);
// SIRTServer.StartProgramming(433, 412013443, "0E9FACC6A0E1EF1C3B27A49BAC216535");
// SIRTServer.StartProgramming(433, 412013444, "0E9FACC6A0E1EF1C3B27A49BAC216535");
// SIRTServer.StartProgramming(433, 412013356, "80D46C00E1BED73FE0DA85D95CA4BEE3");
// SIRTServer.StartProgramming(433, 412013081, "7B5F2F606155C670BD9891231A598EF3");
// SIRTServer.StartProgramming(433, 412013082, "A10BB3C32B71894BD8BB17884973E616");
// SIRTServer.StartProgramming(433, 412013083, "15EEC94741740FB1EA736CF6468A4790");
// SIRTServer.StartProgramming(433, 412013084, "6E742330A56149E8CF94ABD70576573D");
// SIRTServer.StartProgramming(433, 412013087, "C4D1DC170D7E219C26FDE76F9B2DC89A");
// SIRTServer.StartProgramming(433, 412013078, "4E788CF5F57FF977C85F458049D00387");
// SIRTServer.StartProgramming(868, 402001154, "0E9FACC6A0E1EF1C3B27A49BAC216535");
// SIRTServer.StartProgramming(433, 412012695, "867DD2A34C382B7D1190DD563E6B52C4");
// SIRTServer.StartProgramming(433, 412013356, "80D46C00E1BED73FE0DA85D95CA4BEE3");
}
public static void MainRF(params string[] args)
{
//var pam03 = new PAM03();
//pam03.Run("COM6", "402010030", "E6C88800DEB868C0D6A84880CE982840");
//pam03.Run("COM6", "402010027", "D9C154DC274966AB71AD5D804A322178");
//return pam03.Run("COM7", "412004190", "0E9FACC6A0E1EF1C3B27A49BAC216535");
// 10402010030 E6C88800DEB868C0D6A84880CE982840
//try
//{
// return pam03.Run("COM10", "402009768", "3CB64CBCB71F8D0F9F69FF18DF5D24D3");
//}
//catch (System.Exception e)
//{
// return -1;
//}
}
class FDRMask
{
public const byte LOG_ALARM_STATE = 0; // 0x00000001, //!< AlarmState (16 bits)
public const byte LOG_BILLING_COUNTER = 1; // 0x00000002, //!< BillingCounter
public const byte LOG_REVERSE_COUNTER = 2; // 0x00000004, //!< Backward or ReverseCounter
public const byte LOG_MAX_FLOW_VAL = 3; // 0x00000008, //!< Value of MaxFlow
public const byte LOG_MAX_FLOW_TIME = 4; // 0x00000010, //!< Date/Time of MaxFlow
public const byte LOG_PEAK_FLOW_VAL = 5; // 0x00000020, //!< Value of PeakFlow
public const byte LOG_PEAK_FLOW_TIME = 6; // 0x00000040, //!< Date/Time of PeakFlow
public const byte LOG_AVG_FLOW_VAL = 7; // 0x00000080, //!< Current Flow Value (Average of Period)
public const byte LOG_BROKEN_PIPE_FLOW_VAL = 8; // 0x00000100, //!< Value of BrokenPipe
public const byte LOG_BROKEN_PIPE_FLOW_TIME = 9; // 0x00000200, //!< Date/Time of BrokenPipe
public const byte LOG_MIN_FLOW_VAL = 10; // 0x00000400, //!< Value of FlowMin
public const byte LOG_MIN_FLOW_TIME = 11; // 0x00000800, //!< Date/Time of FlowMin
public const byte LOG_FORWARD_COUNTER = 12; // 0x00001000, //!< ForwardCounter
// public const byte LOG_FORWARD_COUNTER = 12; // 0x00002000, //!< ForwardCounter
// public const byte LOG_FORWARD_COUNTER = 12; // 0x00004000, //!< ForwardCounter
// public const byte LOG_FORWARD_COUNTER = 12; // 0x00008000, //!< ForwardCounter
public const byte LOG_MIN_PRESS_VAL = 13; // 0x00010000, //!< Pressure Minimum
public const byte LOG_MIN_PRESS_TIME = 14; // 0x00020000, //!< Pressure Minimum Time
public const byte LOG_MAX_PRESS_VAL = 15; // 0x00040000, //!< Pressure Maximum
public const byte LOG_MAX_PRESS_TIME = 16; // 0x00080000, //!< Pressure Maximum Time
public const byte LOG_MIN_TEMP_VAL = 17; // 0x00100000, //!< Temperature Minimum
public const byte LOG_MIN_TEMP_TIME = 18; // 0x00200000, //!< Temperature Minimum
public const byte LOG_MAX_TEMP_VAL = 19; // 0x00400000, //!< Temperature Maximum
public const byte LOG_MAX_TEMP_TIME = 20; // 0x00800000, //!< Temperature Maximum
public const byte LOG_CUR_PRESS_VAL = 21; // 0x01000000, //!< Pressure Current Value
public const byte LOG_CUR_TEMP_VAL = 22; // 0x02000000, //!< Temperature Current Value
public const byte LOG_EXT_ALARM_STATE = 23; // 0x04000000,    //<! Extended Alarm Status
};
class LogContentBits
{
public const byte AlarmStatus = 0; // 0x00000001 ;The active alarm information at UTC32 
public const byte BillingCounter = 1; // 0x00000002 ;The billing counter at UTC32 
public const byte ReverseCounter = 2; // 0x00000004 ;The reverse counter at UTC32 
public const byte MaxFlow = 3; // 0x00000008 ;The maximum flow of the current FDR period UTC32n -… UTC32n-1 
public const byte MaxFlowTime = 4; // 0x00000010 ;The Date/Time information when Qmax happened in the FDR period 
public const byte PeakFlow = 5; // 0x00000020 ;The peak flow of the current FDR period 
public const byte PeakFlowTime = 6; // 0x00000040 ;The Date/Time information when Qpeak happened in the FDR period 
public const byte AvgFlow = 7; // 0x00000080 ;The average flow rate in the current FDR period 
public const byte BrokenPipe = 8; // 0x00000100 ;The weak flow in the current FDR period  
public const byte BrokenPipeTime = 9; // 0x00000200 ;The Date/Time information when Qweak happened in the FDR period 
public const byte MinFlow = 10; // 0x00000400 ;The minimum flow in the current FDR period 
public const byte MinFlowTime = 11; // 0x00000800 ;The Date/Time information when Qmin happened in the FDR period 
public const byte ForwardCounter = 12; // 0x00001000 ;The forward counter at UTC32 
public const byte _UTC32 = 13; // 0x00002000 ;Date/Time information when the record was stored. 
public const byte _MaskSelector_1_1 = 14; // 0x00004000 ;Two selector bits to switch the bitmask of the RF-communication between the internal pages 
public const byte _MaskSelector_1_2 = 15; // 0x00008000 ;Two selector bits to switch the bitmask of the RF-communication between the internal pages
public const byte MinPress = 16; // 0x00010000 ;The minimum pressure in the current LOG period 
public const byte MinPressTime = 17; // 0x00020000 ;The number of 1-second intervals when Pmin happened in the LOG period 
public const byte MaxPress = 18; // 0x00040000 ;The maximum pressure in the current LOG period 
public const byte MaxPressTime = 19; // 0x00080000 ;The number of 1-second intervals when Pmax happened in the LOG period 
public const byte MinTemp = 20; // 0x00100000 ;The minimum temperature in the current LOG period 
public const byte MinTempTime = 21; // 0x00200000 ;The number of 1-second intervals when Tmin happened in the LOG period 
public const byte MaxTemp = 22; // 0x00400000 ;The maximum temperature in the current LOG period 
public const byte MaxTempTime = 23; // 0x00800000 ;The number of 1-second intervals when Tmax happened in the LOG period 
public const byte CurrentPress = 24; // 0x01000000 ;The last measured instantaneous pressure at RTC32 
public const byte CurrentTemp = 25; // 0x02000000 ;The last measured instantaneous temperature at RTC32  
public const byte ExtendedAlarm = 26; // 0x04000000 ;Similar to the AlarmStatus; P and T related Alarms. 
public const byte _RecordCheckSum = 27; // 0x08000000 ;A Checksum across the entire record 
public const byte _Reserved_1 = 28; // 0x10000000 ;A reserved mask for a further item 
public const byte _Reserved_2 = 29; // 0x20000000 ;A reserved mask for a further item 
public const byte _MaskSelector_2_1 = 30; // 0x40000000 ;The mirror of the MaskSelector_1 
public const byte _MaskSelector_2_2 = 31; // 0x80000000 ;The mirror of the MaskSelector_2 
public static string[] BitMask = new string[]
{
"AlarmStatus",
"BillingCounter",
"ReverseCounter",
"MaxFlow",
"MaxFlowTime",
"PeakFlow",
"PeakFlowTime",
"AvgFlow",
"BrokenPipe",
"BrokenPipeTime",
"MinFlow",
"MinFlowTime",
"ForwardCounter",
"_UTC32",
"_MaskSelector_1_1",
"_MaskSelector_1_2",
"MinPress",
"MinPressTime",
"MaxPress",
"MaxPressTime",
"MinTemp",
"MinTempTime",
"MaxTemp",
"MaxTempTime",
"CurrentPress",
"CurrentTemp",
"ExtendedAlarm",
"_RecordCheckSum",
"_Reserved_1",
"_Reserved_2",
"_MaskSelector_2_1",
"_MaskSelector_2_2",
};
}
[Flags]
enum LogContentHex : uint
{
AlarmStatus = 0x00000001, // ;The active alarm information at UTC32 
BillingCounter = 0x00000002, // ;The billing counter at UTC32 
ReverseCounter = 0x00000004, // ;The reverse counter at UTC32 
MaxFlow = 0x00000008, // ;The maximum flow of the current FDR period UTC32n -… UTC32n-1 
MaxFlowTime = 0x00000010, // ;The Date/Time information when Qmax happened in the FDR period 
PeakFlow = 0x00000020, // ;The peak flow of the current FDR period 
PeakFlowTime = 0x00000040, // ;The Date/Time information when Qpeak happened in the FDR period 
AvgFlow = 0x00000080, // ;The average flow rate in the current FDR period 
BrokenPipe = 0x00000100, // ;The weak flow in the current FDR period  
BrokenPipeTime = 0x00000200, // ;The Date/Time information when Qweak happened in the FDR period 
MinFlow = 0x00000400, // ;The minimum flow in the current FDR period 
MinFlowTime = 0x00000800, // ;The Date/Time information when Qmin happened in the FDR period 
ForwardCounter = 0x00001000, // ;The forward counter at UTC32 
_UTC32 = 0x00002000, // ;Date/Time information when the record was stored. 
_MaskSelector_1_1 = 0x00004000, // ;Two selector bits to switch the bitmask of the RF-communication between the internal pages 
_MaskSelector_1_2 = 0x00008000, // ;
MinPress = 0x00010000, // ;The minimum pressure in the current LOG period 
MinPressTime = 0x00020000, // ;The number of 1-second intervals when Pmin happened in the LOG period 
MaxPress = 0x00040000, // ;The maximum pressure in the current LOG period 
MaxPressTime = 0x00080000, // ;The number of 1-second intervals when Pmax happened in the LOG period 
MinTemp = 0x00100000, // ;The minimum temperature in the current LOG period 
MinTempTime = 0x00200000, // ;The number of 1-second intervals when Tmin happened in the LOG period 
MaxTemp = 0x00400000, // ;The maximum temperature in the current LOG period 
MaxTempTime = 0x00800000, // ;The number of 1-second intervals when Tmax happened in the LOG period 
CurrentPress = 0x01000000, // ;The last measured instantaneous pressure at RTC32 
CurrentTemp = 0x02000000, // ;The last measured instantaneous temperature at RTC32  
ExtendedAlarm = 0x04000000, // ;"Similar to the AlarmStatus; P and T related Alarms. "
_RecordCheckSum = 0x08000000, // ;A Checksum across the entire FDR record 
_Reserved_1 = 0x10000000, // ;A reserved mask for a further item 
_Reserved_2 = 0x20000000, // ;A reserved mask for a further item 
_MaskSelector_2_1 = 0x40000000, // ;The mirror of the MaskSelector_1 
_MaskSelector_2_2 = 0x80000000, // ;The mirror of the MaskSelector_2 
}
class AlarmMask
{
public const byte ALARM_REBOOT = 0; // immer An
public const byte ALARM_LOW_BATTERY = 1;
public const byte ALARM_VERY_LOW_BATTERY = 2; /* For consistency with st_alarm_bit_t only */
public const byte ALARM_CONFIG_ERROR = 3;
public const byte ALARM_EMPTY_PIPE = 4;
public const byte ALARM_MAGNETIC_TAMPER = 5; /* For consistency with st_alarm_bit_t only */
public const byte ALARM_REVERSE_FLOW = 6;
public const byte ALARM_SUSPECT_LEAK = 7;
public const byte ALARM_BROKEN_PIPE = 8;
public const byte ALARM_LOW_PRESSURE = 9;
public const byte ALARM_HIGH_PRESSURE = 10;
public const byte ALARM_LOW_TEMPERATURE = 11;
public const byte ALARM_HIGH_TEMPERATURE = 12;
public const byte ALARM_RADIO_ERROR = 13;
public const byte ALARM_METROLOGY_PARAMS = 14;
public const byte ALARM_METROLOGY_MEASURE = 15;
public const byte ALARM_MAX = 16;
}; // ' CSD ', IIF(i.CSD_Wert IS NULL, i.CSD_Charcode, 'mit neue konfiguration')
public static void Main1()
{
Console.WriteLine(BitConverter.ToInt32(new byte[] { 0xE9, 0xFF, 0xFF, 0xFF }, 0));
Console.WriteLine(BitConverter.ToInt32(new byte[] { 0xAD, 0xFF, 0xFF, 0xFF }, 0));
Console.WriteLine(BitConverter.ToInt32(new byte[] { 0xE6, 0xFF, 0xFF, 0xFF }, 0));
Console.WriteLine(BitConverter.ToInt32(new byte[] { 0x03, 0x00, 0x00, 0x00 }, 0));
//var alarmMask = 1 << AlarmMask.ALARM_REBOOT
// | 1 << AlarmMask.ALARM_LOW_BATTERY
// | 0 << AlarmMask.ALARM_VERY_LOW_BATTERY
// | 0 << AlarmMask.ALARM_CONFIG_ERROR
// | 1 << AlarmMask.ALARM_EMPTY_PIPE
// | 0 << AlarmMask.ALARM_MAGNETIC_TAMPER
// | 1 << AlarmMask.ALARM_REVERSE_FLOW
// | 1 << AlarmMask.ALARM_SUSPECT_LEAK
// | 1 << AlarmMask.ALARM_BROKEN_PIPE
// | 0 << AlarmMask.ALARM_LOW_PRESSURE
// | 0 << AlarmMask.ALARM_HIGH_PRESSURE
// | 0 << AlarmMask.ALARM_LOW_TEMPERATURE
// | 0 << AlarmMask.ALARM_HIGH_TEMPERATURE
// | 0 << AlarmMask.ALARM_RADIO_ERROR
// | 0 << AlarmMask.ALARM_METROLOGY_PARAMS
// | 0 << AlarmMask.ALARM_METROLOGY_MEASURE
// | 0 << AlarmMask.ALARM_MAX;
//var alarmBytes = BitConverter.GetBytes(alarmMask);
//Array.Reverse(alarmBytes);
//Console.WriteLine($"ALARM_MASK: {alarmMask} - {BitConverter.ToString(alarmBytes).Replace("-", "")}");
//var dataLogger = 1 << FDRMask.LOG_ALARM_STATE
// | 1 << FDRMask.LOG_BILLING_COUNTER
// | 0 << FDRMask.LOG_REVERSE_COUNTER
// | 0 << FDRMask.LOG_MAX_FLOW_VAL
// | 0 << FDRMask.LOG_MAX_FLOW_TIME
// | 0 << FDRMask.LOG_PEAK_FLOW_VAL
// | 0 << FDRMask.LOG_PEAK_FLOW_TIME
// | 1 << FDRMask.LOG_CUR_FLOW_VAL
// | 0 << FDRMask.LOG_BROKEN_PIPE_FLOW_VAL
// | 0 << FDRMask.LOG_BROKEN_PIPE_FLOW_TIME
// | 1 << FDRMask.LOG_MIN_FLOW_VAL
// | 0 << FDRMask.LOG_MIN_FLOW_TIME
// | 0 << FDRMask.LOG_FORWARD_COUNTER
// | 0 << FDRMask.LOG_MIN_PRESS_VAL
// | 0 << FDRMask.LOG_MIN_PRESS_TIME
// | 0 << FDRMask.LOG_MAX_PRESS_VAL
// | 0 << FDRMask.LOG_MAX_PRESS_TIME
// | 0 << FDRMask.LOG_MIN_TEMP_VAL
// | 0 << FDRMask.LOG_MIN_TEMP_TIME
// | 0 << FDRMask.LOG_MAX_TEMP_VAL
// | 0 << FDRMask.LOG_MAX_TEMP_TIME
// | 0 << FDRMask.LOG_CUR_PRESS_VAL
// | 0 << FDRMask.LOG_CUR_TEMP_VAL
// | 1 << FDRMask.LOG_EXT_ALARM_STATE;
//var dataLoggerBytes = BitConverter.GetBytes(dataLogger);
//Array.Reverse(dataLoggerBytes);
//Console.WriteLine($"DATA_LOGGER: {dataLogger} - {BitConverter.ToString(dataLoggerBytes).Replace("-", "")}");
//var fixDateReading = 1 << FDRMask.LOG_ALARM_STATE
// | 1 << FDRMask.LOG_BILLING_COUNTER
// | 0 << FDRMask.LOG_REVERSE_COUNTER
// | 0 << FDRMask.LOG_MAX_FLOW_VAL
// | 0 << FDRMask.LOG_MAX_FLOW_TIME
// | 0 << FDRMask.LOG_PEAK_FLOW_VAL
// | 0 << FDRMask.LOG_PEAK_FLOW_TIME
// | 1 << FDRMask.LOG_CUR_FLOW_VAL
// | 0 << FDRMask.LOG_BROKEN_PIPE_FLOW_VAL
// | 0 << FDRMask.LOG_BROKEN_PIPE_FLOW_TIME
// | 1 << FDRMask.LOG_MIN_FLOW_VAL
// | 0 << FDRMask.LOG_MIN_FLOW_TIME
// | 0 << FDRMask.LOG_FORWARD_COUNTER
// | 0 << FDRMask.LOG_MIN_PRESS_VAL
// | 0 << FDRMask.LOG_MIN_PRESS_TIME
// | 0 << FDRMask.LOG_MAX_PRESS_VAL
// | 0 << FDRMask.LOG_MAX_PRESS_TIME
// | 0 << FDRMask.LOG_MIN_TEMP_VAL
// | 0 << FDRMask.LOG_MIN_TEMP_TIME
// | 0 << FDRMask.LOG_MAX_TEMP_VAL
// | 0 << FDRMask.LOG_MAX_TEMP_TIME
// | 0 << FDRMask.LOG_CUR_PRESS_VAL
// | 0 << FDRMask.LOG_CUR_TEMP_VAL
// | 1 << FDRMask.LOG_EXT_ALARM_STATE;
//var fixDateReadingBytes = BitConverter.GetBytes(fixDateReading);
//Array.Reverse(fixDateReadingBytes);
//Console.WriteLine($"FDR_LOGGER: {fixDateReading} - {BitConverter.ToString(fixDateReadingBytes).Replace("-", "")}");
//var x1 = 0xD29F;
//var x2 = 0xD39F;
//Console.WriteLine(new string('=', 50));
//Console.WriteLine($"ALARM_REBOOT: [{(int)AlarmMask.ALARM_REBOOT,2}] {(x1 >> AlarmMask.ALARM_REBOOT) % 2} {(x2 >> AlarmMask.ALARM_REBOOT) % 2} ");
//Console.WriteLine($"ALARM_LOW_BATTERY: [{(int)AlarmMask.ALARM_LOW_BATTERY,2}] {(x1 >> AlarmMask.ALARM_LOW_BATTERY) % 2} {(x2 >> AlarmMask.ALARM_LOW_BATTERY) % 2} ");
//Console.WriteLine($"ALARM_VERY_LOW_BATTERY: [{(int)AlarmMask.ALARM_VERY_LOW_BATTERY,2}] {(x1 >> AlarmMask.ALARM_VERY_LOW_BATTERY) % 2} {(x2 >> AlarmMask.ALARM_VERY_LOW_BATTERY) % 2} ");
//Console.WriteLine($"ALARM_CONFIG_ERROR: [{(int)AlarmMask.ALARM_CONFIG_ERROR,2}] {(x1 >> AlarmMask.ALARM_CONFIG_ERROR) % 2} {(x2 >> AlarmMask.ALARM_CONFIG_ERROR) % 2} ");
//Console.WriteLine($"ALARM_EMPTY_PIPE: [{(int)AlarmMask.ALARM_EMPTY_PIPE,2}] {(x1 >> AlarmMask.ALARM_EMPTY_PIPE) % 2} {(x2 >> AlarmMask.ALARM_EMPTY_PIPE) % 2} ");
//Console.WriteLine($"ALARM_MAGNETIC_TAMPER: [{(int)AlarmMask.ALARM_MAGNETIC_TAMPER,2}] {(x1 >> AlarmMask.ALARM_MAGNETIC_TAMPER) % 2} {(x2 >> AlarmMask.ALARM_MAGNETIC_TAMPER) % 2} ");
//Console.WriteLine($"ALARM_REVERSE_FLOW: [{(int)AlarmMask.ALARM_REVERSE_FLOW,2}] {(x1 >> AlarmMask.ALARM_REVERSE_FLOW) % 2} {(x2 >> AlarmMask.ALARM_REVERSE_FLOW) % 2} ");
//Console.WriteLine($"ALARM_SUSPECT_LEAK: [{(int)AlarmMask.ALARM_SUSPECT_LEAK,2}] {(x1 >> AlarmMask.ALARM_SUSPECT_LEAK) % 2} {(x2 >> AlarmMask.ALARM_SUSPECT_LEAK) % 2} ");
//Console.WriteLine($"ALARM_BROKEN_PIPE: [{(int)AlarmMask.ALARM_BROKEN_PIPE,2}] {(x1 >> AlarmMask.ALARM_BROKEN_PIPE) % 2} {(x2 >> AlarmMask.ALARM_BROKEN_PIPE) % 2} ");
//Console.WriteLine($"ALARM_LOW_PRESSURE: [{(int)AlarmMask.ALARM_LOW_PRESSURE,2}] {(x1 >> AlarmMask.ALARM_LOW_PRESSURE) % 2} {(x2 >> AlarmMask.ALARM_LOW_PRESSURE) % 2} ");
//Console.WriteLine($"ALARM_HIGH_PRESSURE: [{(int)AlarmMask.ALARM_HIGH_PRESSURE,2}] {(x1 >> AlarmMask.ALARM_HIGH_PRESSURE) % 2} {(x2 >> AlarmMask.ALARM_HIGH_PRESSURE) % 2} ");
//Console.WriteLine($"ALARM_LOW_TEMPERATURE: [{(int)AlarmMask.ALARM_LOW_TEMPERATURE,2}] {(x1 >> AlarmMask.ALARM_LOW_TEMPERATURE) % 2} {(x2 >> AlarmMask.ALARM_LOW_TEMPERATURE) % 2} ");
//Console.WriteLine($"ALARM_HIGH_TEMPERATURE: [{(int)AlarmMask.ALARM_HIGH_TEMPERATURE,2}] {(x1 >> AlarmMask.ALARM_HIGH_TEMPERATURE) % 2} {(x2 >> AlarmMask.ALARM_HIGH_TEMPERATURE) % 2} ");
//Console.WriteLine($"ALARM_RADIO_ERROR: [{(int)AlarmMask.ALARM_RADIO_ERROR,2}] {(x1 >> AlarmMask.ALARM_RADIO_ERROR) % 2} {(x2 >> AlarmMask.ALARM_RADIO_ERROR) % 2} ");
//Console.WriteLine($"ALARM_METROLOGY_PARAMS: [{(int)AlarmMask.ALARM_METROLOGY_PARAMS,2}] {(x1 >> AlarmMask.ALARM_METROLOGY_PARAMS) % 2} {(x2 >> AlarmMask.ALARM_METROLOGY_PARAMS) % 2} ");
//Console.WriteLine($"ALARM_METROLOGY_MEASURE: [{(int)AlarmMask.ALARM_METROLOGY_MEASURE,2}] {(x1 >> AlarmMask.ALARM_METROLOGY_MEASURE) % 2} {(x2 >> AlarmMask.ALARM_METROLOGY_MEASURE) % 2}");
//Console.WriteLine($"ALARM_MAX: [{(int)AlarmMask.ALARM_MAX,2}] {(x1 >> AlarmMask.ALARM_MAX) % 2} {(x2 >> AlarmMask.ALARM_MAX) % 2} ");
//Console.WriteLine(int.MaxValue);
//Console.WriteLine(uint.MaxValue);
//Console.WriteLine(long.MaxValue);
}
//public static void /*MainCSD()*/ Main()
//{
// SIRTLogger.State += Console.WriteLine;
// var alarmEnableMask = 0xD39F0000;
// var ix = 0;
// var sirtHub = new SIRTHub();
// if (sirtHub.TryOpen("COM6", out var sirtId, out var frequency))
// foreach (var item in Enum.GetValues(typeof(AlarmMask)).Cast<AlarmMask>().OrderBy(x => (uint)x).ToArray())
// {
// SIRTLogger.State -= Console.WriteLine;
// SIRTLogger.Message += Console.WriteLine;
// Console.WriteLine($"Listening on: COM6 - {frequency} - {sirtId}");
// var task = new LEDTask(frequency, 319017453)
// {
// //WakeUpCmd = true,
// //WakeUpModul = true,
// //DelPamSemi = true,
// Data = new byte[] { 0x1F, 0x01, 0x08, 0x43, 0x03, 0x63, 0x93, 0x73, 0x22 },
// EncryptionKey = "E6C88800DEB868C0D6A84880CE982840".GetBytes(),
// IsEncrypted = true,
// };
// sirtHub.Start(task);
// task.Wait();
// Console.ReadKey();
// sirtHub.Close("COM6");
// }
//}
//public class LEDTask : EregisterTask
//{
// public LEDTask(int frequency, uint address) : base(frequency)
// {
// this.RequestAddress = address;
// Console.WriteLine($"{item,23} = {item:X} = {(uint)item,5} = {(alarmEnableMask << ix++) & 1}");
// }
// public byte P811
// foreach (var item in Enum.GetValues(typeof(FDRMask)).Cast<FDRMask>().OrderBy(x => x).ToArray())
// {
// get => this.p811;
// set => this.p811 = value;
// Console.WriteLine($"{item} = {item:X} = {(uint)item}");
// }
//}
//internal enum AlarmMask
//{
// ALARM_REBOOT = 1 << 0, // immer An
// ALARM_LOW_BATTERY = 1 << 1,
// ALARM_VERY_LOW_BATTERY = 1 << 2, /* For consistency with st_alarm_bit_t only */
// ALARM_CONFIG_ERROR = 1 << 3,
// ALARM_EMPTY_PIPE = 1 << 4,
// ALARM_MAGNETIC_TAMPER = 1 << 5, /* For consistency with st_alarm_bit_t only */
// ALARM_REVERSE_FLOW = 1 << 6,
// ALARM_SUSPECT_LEAK = 1 << 7,
// ALARM_BROKEN_PIPE = 1 << 8,
// ALARM_LOW_PRESSURE = 1 << 9,
// ALARM_HIGH_PRESSURE = 1 << 10,
// ALARM_LOW_TEMPERATURE = 1 << 11,
// ALARM_HIGH_TEMPERATURE = 1 << 12,
// ALARM_RADIO_ERROR = 1 << 13,
// ALARM_METROLOGY_PARAMS = 1 << 14,
// ALARM_METROLOGY_MEASURE = 1 << 15,
// ALARM_MAX = 1 << 16
//};
// ushort value = 3;
//internal enum FDRMask
//{
// LOG_BILLING_COUNTER = 0x00000002, //!< BillingCounter
// LOG_FORWARD_COUNTER = 0x00001000, //!< ForwardCounter
// LOG_REVERSE_COUNTER = 0x00000004, //!< Backward or ReverseCounter
// LOG_MIN_FLOW_TIME = 0x00000800, //!< Date/Time of FlowMin
// LOG_MIN_FLOW_VAL = 0x00000400, //!< Value of FlowMin
// LOG_BROKEN_PIPE_FLOW_TIME = 0x00000200, //!< Date/Time of BrokenPipe
// LOG_BROKEN_PIPE_FLOW_VAL = 0x00000100, //!< Value of BrokenPipe
// LOG_CUR_FLOW_VAL = 0x00000080, //!< Current Flow Value (Average of Period)
// LOG_PEAK_FLOW_TIME = 0x00000040, //!< Date/Time of PeakFlow
// LOG_PEAK_FLOW_VAL = 0x00000020, //!< Value of PeakFlow
// LOG_MAX_FLOW_TIME = 0x00000010, //!< Date/Time of MaxFlow
// LOG_MAX_FLOW_VAL = 0x00000008, //!< Value of MaxFlow
// LOG_CUR_TEMP_VAL = 0x02000000, //!< Temperature Current Value
// LOG_MAX_TEMP_TIME = 0x00800000, //!< Temperature Maximum
// LOG_MAX_TEMP_VAL = 0x00400000, //!< Temperature Maximum
// LOG_MIN_TEMP_TIME = 0x00200000, //!< Temperature Minimum
// LOG_MIN_TEMP_VAL = 0x00100000, //!< Temperature Minimum
// LOG_CUR_PRESS_VAL = 0x01000000, //!< Pressure Current Value
// LOG_MAX_PRESS_TIME = 0x00080000, //!< Pressure Maximum Time
// LOG_MAX_PRESS_VAL = 0x00040000, //!< Pressure Maximum
// LOG_MIN_PRESS_TIME = 0x00020000, //!< Pressure Minimum Time
// LOG_MIN_PRESS_VAL = 0x00010000, //!< Pressure Minimum
// LOG_ALARM_STATE = 0x00000001, //!< AlarmState (16 bits)
// LOG_EXT_ALARM_STATE = 0x04000000,    //<! Extended Alarm Status
//};
// Console.WriteLine($"0: {value >> 0 & 1}");
// Console.WriteLine($"0: {value >> 1 & 1}");
// Console.WriteLine($"0: {value >> 2 & 1}");
//var alarm
// = FDRMask.LOG_BILLING_COUNTER
// | FDRMask.LOG_REVERSE_COUNTER
// | FDRMask.LOG_BROKEN_PIPE_FLOW_TIME
// | FDRMask.LOG_BROKEN_PIPE_FLOW_VAL
// | FDRMask.LOG_PEAK_FLOW_TIME
// | FDRMask.LOG_PEAK_FLOW_VAL
// | FDRMask.LOG_MAX_FLOW_TIME
// | FDRMask.LOG_MAX_FLOW_VAL
// | FDRMask.LOG_MAX_TEMP_TIME
// | FDRMask.LOG_MAX_TEMP_VAL
// | FDRMask.LOG_ALARM_STATE
// | FDRMask.LOG_EXT_ALARM_STATE;
// Console.WriteLine("CSD CSD 772161_MW");
// Console.WriteLine("=============================================================================");
//public static void Main()
//{
// var alarm = AlarmMask.ALARM_REBOOT
// | AlarmMask.ALARM_EMPTY_PIPE
// | AlarmMask.ALARM_SUSPECT_LEAK
// | AlarmMask.ALARM_BROKEN_PIPE
// | AlarmMask.ALARM_LOW_BATTERY
// | AlarmMask.ALARM_REVERSE_FLOW
// | AlarmMask.ALARM_HIGH_TEMPERATURE;
// | AlarmMask.ALARM_REVERSE_FLOW;
// Console.WriteLine($"Alarm: {alarm}");
// Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes((int)alarm)));
// Console.WriteLine();
// Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes((int)alarm))}");
// var fdr = FDRMask.LOG_BILLING_COUNTER
// | FDRMask.LOG_REVERSE_COUNTER
// | FDRMask.LOG_BROKEN_PIPE_FLOW_TIME
// | FDRMask.LOG_BROKEN_PIPE_FLOW_VAL
// | FDRMask.LOG_PEAK_FLOW_TIME
// | FDRMask.LOG_PEAK_FLOW_VAL
// | FDRMask.LOG_MAX_FLOW_TIME
// | FDRMask.LOG_MAX_FLOW_VAL
// | FDRMask.LOG_MAX_TEMP_TIME
// | FDRMask.LOG_MAX_TEMP_VAL
// var dlg = FDRMask.LOG_BILLING_COUNTER
// | FDRMask.LOG_MIN_FLOW_VAL
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
// | FDRMask.LOG_ALARM_STATE
// | FDRMask.LOG_EXT_ALARM_STATE;
// Console.WriteLine($"FDR: {fdr}");
// Console.WriteLine(BitConverter.ToString(BitConverter.GetBytes((int)fdr)));
// Console.WriteLine();
// Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes((int)dlg))}");
// Console.WriteLine($"HErrL: {BitConverter.ToString(BitConverter.GetBytes((short)90))}");
// Console.WriteLine();
// var fdr = FDRMask.LOG_BILLING_COUNTER
// | FDRMask.LOG_MIN_FLOW_VAL
// | FDRMask.LOG_CUR_FLOW_VAL // ... AverageFlow !?
// | FDRMask.LOG_ALARM_STATE
// | FDRMask.LOG_EXT_ALARM_STATE;
// Console.WriteLine("LeakageThreshold");
// Console.WriteLine($"DN 40 100 l/h = 100 * 256 = {BitConverter.ToString(BitConverter.GetBytes(100 * 256))}");
// Console.WriteLine($"DN 50 100 l/h = 100 * 256 = {BitConverter.ToString(BitConverter.GetBytes(100 * 256))}");
// Console.WriteLine($"DN 65 125 l/h = 125 * 256 = {BitConverter.ToString(BitConverter.GetBytes(125 * 256))}");
// Console.WriteLine($"DN 80 125 l/h = 125 * 256 = {BitConverter.ToString(BitConverter.GetBytes(125 * 256))}");
// Console.WriteLine($"DN 100 125 l/h = 125 * 256 = {BitConverter.ToString(BitConverter.GetBytes(125 * 256))}");
// Console.WriteLine($"DN 125 500 l/h = 500 * 256 = {BitConverter.ToString(BitConverter.GetBytes(500 * 256))}");
// Console.WriteLine($"DN 150 375 l/h = 375 * 256 = {BitConverter.ToString(BitConverter.GetBytes(375 * 256))}");
// Console.WriteLine();
// Console.WriteLine("BrokenPipeThreshold");
// Console.WriteLine($"DN 40 50 m³/h = 50 * 256 * 1000 = {BitConverter.ToString(BitConverter.GetBytes( 50 * 256 * 1000))}");
// Console.WriteLine($"DN 80 125 m³/h = 125 * 256 * 1000 = {BitConverter.ToString(BitConverter.GetBytes(125 * 256 * 1000))}");
// Console.WriteLine($"DN 150 250 m³/h = 250 * 256 * 1000 = {BitConverter.ToString(BitConverter.GetBytes(250 * 256 * 1000))}");
// Console.WriteLine();
// Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes((int)fdr))}");
//}
/// <summary>
/// CSD 769400 Arqiva Thames Water
/// </summary>
public static void Main1231231()
{
Console.WriteLine("CSD 769400 Arqiva Thames Water");
Console.WriteLine("=============================================================================");
Console.WriteLine("--- DN50 --------------------------------------------------------------------");
Console.WriteLine($"CUSTOMER_ExcessFlowVolumeThreshold: {BitConverter.ToString(BitConverter.GetBytes((int)(37.5 * 1000) / 256))}");
var alarm = 1 << AlarmMask.ALARM_EMPTY_PIPE
| 1 << AlarmMask.ALARM_SUSPECT_LEAK
| 1 << AlarmMask.ALARM_LOW_BATTERY
| 1 << AlarmMask.ALARM_HIGH_TEMPERATURE
| 1 << AlarmMask.ALARM_LOW_TEMPERATURE
| 1 << AlarmMask.ALARM_HIGH_PRESSURE
| 1 << AlarmMask.ALARM_LOW_PRESSURE;
Console.WriteLine($"CUSTOMER_AlarmVisualMask: {BitConverter.ToString(BitConverter.GetBytes(alarm))}");
var dlg = 1 <<FDRMask.LOG_BILLING_COUNTER
| 1 <<FDRMask.LOG_REVERSE_COUNTER
| 1 <<FDRMask.LOG_MIN_FLOW_TIME
| 1 <<FDRMask.LOG_MIN_FLOW_VAL
| 1 <<FDRMask.LOG_AVG_FLOW_VAL
| 1 <<FDRMask.LOG_PEAK_FLOW_TIME
| 1 <<FDRMask.LOG_PEAK_FLOW_VAL
| 1 <<FDRMask.LOG_MAX_FLOW_TIME
| 1 <<FDRMask.LOG_MAX_FLOW_VAL
| 1 <<FDRMask.LOG_ALARM_STATE;
Console.WriteLine($"PERIODICLOG_DataLogContents: {BitConverter.ToString(BitConverter.GetBytes(dlg))}");
var fdr = 1 << FDRMask.LOG_BILLING_COUNTER
| 1 << FDRMask.LOG_ALARM_STATE;
Console.WriteLine($"PERIODICLOG_FixedDateReadingContents: {BitConverter.ToString(BitConverter.GetBytes(fdr))}");
}
}
}

View File

@ -21,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>7.0</LangVersion>
@ -38,7 +38,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '_MANUAL_CONTROL|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\_MANUAL_CONTROL\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
@ -81,6 +81,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;URI_OLD_DNS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<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>
@ -97,13 +116,17 @@
<Compile Include="..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ServiceUrls.cs" />
<Compile Include="ServiceUrlsBackUp_New.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -9,211 +9,198 @@ namespace Xylem.Common.CommonCore.Configuration
/// </summary>
public static class ServiceUrls
{
//#if URI_OLD_DNS // this is defined in build configuration 'VPN_Debug' as the new DNS cannot be reached via VPN
// private const String ServerDns = "http://sla12iis01.emea.sensus.net";
//#else
private const String ServerDns = "http://delaz1web01.world.fluidtechnology.net";
//#endif
private const String DefaultInspectCordonelRequirementInfoUrl =
"http://sla12iis01.emea.sensus.net/LaaProductionWeb/";
private static readonly String DefaultInspectCordonelRequirementInfoUrl =
$"http://sla12iis01.emea.sensus.net/LaaProductionWeb/";
// return code: 404 not found, 400 Error with text, 200 okay
private const String DefaultEolDataForSentinelServiceUrl =
"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/eolprogress/";
private static readonly String DefaultEolDataForSentinelServiceUrl =
$"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/eolprogress/";
private const String DefaultGetPcbIdsFromSafeServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetPcbIdsFromSafe?ContainerDbId=";
private static readonly String DefaultGetPcbIdsFromSafeServiceUrl =
$"{ServerDns}/MeterProcessState/GetPcbIdsFromSafe?ContainerDbId=";
private const String DefaultAddPcbIdsToSafeServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/AddPcbIdsToSafe?ContainerDbId=";
private static readonly String DefaultGetExportDataServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/GetExportData?PcbId=";
private const String DefaultDownloadFilesPartsServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/GetFileParts?ParentFileId=";
private static readonly String DefaultGetCordonelMappingServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelMapping?PcbId=";
private const String DefaultListAllFwPackagesServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=1";
private static readonly String DefaultAddPcbIdsToSafeServiceUrl =
$"{ServerDns}/MeterProcessState/AddPcbIdsToSafe?ContainerDbId=";
private const String DefaultListAllSwPackagesServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=5";
private static readonly String DefaultGetOrderOverviewServiceUrl =
$"{ServerDns}/MeterProcessState/api/FinalCheck/GetOrderOverview?ProductionOrderNumber=";
private const String DefaultListAllConfigFilePackagesServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=6";
private static readonly String DefaultGetOrderDetailsServiceUrl =
$"{ServerDns}/MeterProcessState/api/FinalCheck/GetOrderDetails?ProductionOrderNumber=";
private const String DefaultListAllFwUpdateSafesServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=4";
private static readonly String DefaultDownloadFilesPartsServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFileParts?ParentFileId=";
private const String DefaultSetCordonelAppVersionServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/ProccesState/SetCordonelProgress?PcbId=";
private static readonly String DefaultGetLutUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetLutFiles";
private const String DefaultGetCordonelRequirementInfoUrl =
private static readonly String DefaultListAllFwPackagesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=1";
private static readonly String DefaultListAllSwPackagesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=5";
private static readonly String DefaultListAllConfigFilePackagesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=6";
private static readonly String DefaultListAllFwUpdateSafesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=4";
private static readonly String DefaultSetCordonelAppVersionServiceUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/SetCordonelProgress?PcbId=";
private static readonly String DefaultGetCordonelRequirementInfoUrl =
"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/requirements/pcbid/";
private const String DefaultGetCordonelAppVersionServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/ProccesState/GetCordonelAppVersion?PcbId=";
private static readonly String DefaultGetCordonelAppVersionServiceUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/GetCordonelAppVersion?PcbId=";
private const String DefaultListAllCordonelCustomersWithFilterServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Order/GetCordonelCustomers?FilterName=";
private static readonly String DefaultListAllCordonelCustomersWithFilterServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelCustomers?FilterName=";
private const String DefaultListAllCordonelCustomerOrdersServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Order/GetCustomersCordonelOrders?CustomerNumber=";
private static readonly String DefaultListAllCordonelCustomerOrdersServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCustomersCordonelOrders?CustomerNumber=";
private const String DefaultListCordonelOrderDetailsServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Order/GetCordonelOrderDetails?OrderNr=";
private static readonly String DefaultListCordonelOrderDetailsServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelOrderDetails?OrderNr=";
private const String DefaultListAllOrderCordonelsServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Order/GetCordonelOrderList?CustomerOrderNumber=";
private static readonly String DefaultListAllOrderCordonelsServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelOrderList?CustomerOrderNumber=";
private const String DefaultDownloadFwUpdateSafeServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetFWUpdateSafeContainerContent?SafeContainerId=";
private static readonly String DefaultDownloadFwUpdateSafeServiceUrl =
$"{ServerDns}/MeterProcessState/GetFWUpdateSafeContainerContent?SafeContainerId=";
private const String DefaultListAllFwUpdateSafesForUserServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetFWUpdateSafeContainers?UserId=";
private static readonly String DefaultListAllFwUpdateSafesForUserServiceUrl =
$"{ServerDns}/MeterProcessState/GetFWUpdateSafeContainers?UserId=";
private const String DefaultFileContentDownloadServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetFileContent?FileId=";
private static readonly String DefaultFileContentDownloadServiceUrl =
$"{ServerDns}/MeterProcessState/GetFileContent?FileId=";
private const String DefaultFwUpdateReportUploadServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/PostFWUpdateReportFile";
private static readonly String DefaultFwUpdateReportUploadServiceUrl =
$"{ServerDns}/MeterProcessState/PostFWUpdateReportFile";
private const String DefaultFwUpdateReportDownloadServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetFWUpdateReportFile?";
private static readonly String DefaultFwUpdateReportDownloadServiceUrl =
$"{ServerDns}/MeterProcessState/GetFWUpdateReportFile?";
private const String DefaultFwUpdateSafeContainerUploadServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/PostFWUpdateSafeOdd";
private static readonly String DefaultFwUpdateSafeContainerUploadServiceUrl =
$"{ServerDns}/MeterProcessState/PostFWUpdateSafeOdd";
private const String DefaultEditFwUpdateUserValidityServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/EditUserValidity?Id=";
private static readonly String DefaultEditFwUpdateUserValidityServiceUrl =
$"{ServerDns}/MeterProcessState/EditUserValidity?Id=";
private const String DefaultRefreshFwUpdateUsersHardwareIdServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/RefreshUsersHardwareId?Id=";
private static readonly String DefaultRefreshFwUpdateUsersHardwareIdServiceUrl =
$"{ServerDns}/MeterProcessState/RefreshUsersHardwareId?Id=";
private const String DefaultRefreshFwUpdateUsersPasswordHashServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/RefreshUsersPasswordHash?Id=";
private static readonly String DefaultRefreshFwUpdateUsersPasswordHashServiceUrl =
$"{ServerDns}/MeterProcessState/RefreshUsersPasswordHash?Id=";
private const String DefaultCreateNewFwUpdateUserServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/AddNewUser?";
private static readonly String DefaultCreateNewFwUpdateUserServiceUrl =
$"{ServerDns}/MeterProcessState/AddNewUser?";
private const String DefaultListAllFwUpdateUsersServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetUserList";
private static readonly String DefaultListAllFwUpdateUsersServiceUrl =
$"{ServerDns}/MeterProcessState/GetUserList";
private const String DefaultListAllFwUpdateBuilderOperatorsServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetAllBuilderOperator";
private static readonly String DefaultListAllFwUpdateBuilderOperatorsServiceUrl =
$"{ServerDns}/MeterProcessState/GetAllBuilderOperator";
private const String DefaultGetFwUpdateUserByIdServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetUserList?Id=";
private static readonly String DefaultGetFwUpdateUserByIdServiceUrl =
$"{ServerDns}/MeterProcessState/GetUserList?Id=";
private const String DefaultGetFwUpdateUserByLoginNameServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/GetUserList?LogInName=";
private static readonly String DefaultGetFwUpdateUserByLoginNameServiceUrl =
$"{ServerDns}/MeterProcessState/GetUserList?LogInName=";
private const String DefaultRegisterWatchServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/RegisterWatch/";
private static readonly String DefaultRegisterWatchServiceUrl =
$"{ServerDns}/MeterProcessState/api/RegisterWatch/";
private const String DefaultGenesisGetOrderNumberServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Password/ordernumber?PcbId=";
private static readonly String DefaultGenesisGetOrderNumberServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/ordernumber?PcbId=";
private const String DefaultGenesisGetRadioAddressServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Password/radioadress?PcbId=";
private static readonly String DefaultGenesisGetRadioAddressServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/radioadress?PcbId=";
private const String DefaultGenesisGetKeySetIdServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Password/getkeysetid?PcbId=";
private static readonly String DefaultGenesisGetKeySetIdServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/getkeysetid?PcbId=";
private const String DefaultGenesisGetPasswordServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Password/GetPassword?PcbId=";
private static readonly String DefaultGenesisSetPickingStateServiceUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/SetPickingState?PcbID=";
private const String DefaultGenesisSetPasswordServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Password/setpassword?PcbId=";
private static readonly String DefaultGenesisGetPasswordServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/GetPassword?PcbId=";
private const String DefaultGenesisPasswordContainerServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Password/GetPasswordHashFileContent?PcbId=";
private static readonly String DefaultGenesisSetPasswordServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/setpassword?PcbId=";
private const String DefaultMarriageServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/Marriage/";
private static readonly String DefaultGenesisPasswordContainerServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/GetPasswordHashFileContent?PcbId=";
private const String DefaultMeterProcessStateUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/ProccesState/";
private static readonly String DefaultMarriageServiceUrl =
$"{ServerDns}/MeterProcessState/api/Marriage/";
private const String DefaultGenesisFinalCheckServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FinalCheck/";
private static readonly String DefaultMeterProcessStateUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/";
private const String DefaultGenesisRadioCheckServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/RadioCheck/";
private static readonly String DefaultGenesisFinalCheckServiceUrl =
$"{ServerDns}/MeterProcessState/api/FinalCheck/";
private const String DefaultGetSoftwareStartUpAccessUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/SoftwareAccess/GetVersionIsValid";
private static readonly String DefaultGenesisRadioCheckServiceUrl =
$"{ServerDns}/MeterProcessState/api/RadioCheck/";
private const String DefaultSetSoftwareLicenseUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/SoftwareAccess/SetVersionIsValid?Program=";
private static readonly String DefaultGetSoftwareStartUpAccessUrl =
$"{ServerDns}/MeterProcessState/api/SoftwareAccess/GetVersionIsValid";
private const String DefaultGetSoftwareLicenseUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/SoftwareAccess/GetCurrentVersion?Program=";
private static readonly String DefaultSetSoftwareLicenseUrl =
$"{ServerDns}/MeterProcessState/api/SoftwareAccess/SetVersionIsValid?Program=";
private const String DefaultGenesisCalibrationResult =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/GenesisMeter/PostCalibrationResult";
private static readonly String DefaultGetSoftwareLicenseUrl =
$"{ServerDns}/MeterProcessState/api/SoftwareAccess/GetCurrentVersion?Program=";
private const String DefaultGetGenesisCalibrationResults =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FinalCheck/CalibrationResults/";
private static readonly String DefaultGenesisCalibrationResult =
$"{ServerDns}/MeterProcessState/api/GenesisMeter/PostCalibrationResult";
private const String DefaultGenesisMeter =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/GenesisMeter/";
private static readonly String DefaultGetGenesisCalibrationResults =
$"{ServerDns}/MeterProcessState/api/FinalCheck/CalibrationResults/";
private const String DefaultFileContentController =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/";
private static readonly String DefaultGenesisMeter =
$"{ServerDns}/MeterProcessState/api/GenesisMeter/";
private const String DefaultKeyServerCustom =
private static readonly String DefaultFileContentController =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/";
private static readonly String DefaultKeyServerCustom =
"https://nodes.sms-esaap.com/keygenproxy/api/v3/custom/";
private const String DefaultMeterInfoForTestBench =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/TestBench/GetMeterInfoForTestBench?PcbID=";
private static readonly String DefaultMeterInfoForTestBench =
$"{ServerDns}/MeterProcessState/api/TestBench/GetMeterInfoForTestBench?PcbID=";
private const String DefaultCordonelFwInfoUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/FileUpToDate/GetCordonelFw";
private static readonly String DefaultCordonelFwInfoUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetCordonelFw";
private const String DefaultDbDataAtEolServiceUrl =
"http://sla12iis01.emea.sensus.net/MeterProcessState/api/fwupdate/databaseateol/";
private static readonly String DefaultDbDataAtEolServiceUrl =
$"http://sla12iis01.emea.sensus.net/MeterProcessState/api/fwupdate/databaseateol/";
//private const String DefaultGenesisGetOrderNumberServiceUrl =
// "http://localhost:56011/api/Password/ordernumber?PcbId=";
public static readonly String PressureSensorTestURL_GetTestSpec
= $"{ServerDns}/MeterProcessState/api/CordonelPressureSensorTest/GetTestSpec";
//private const String DefaultGenesisGetRadioAdressServiceUrl =
// "http://localhost:56011/api/Password/radioadress?PcbId=";
//private const String DefaultGenesisGetKeySetIdServiceUrl =
// "http://localhost:56011/api/Password/getkeysetid?PcbId=";
//private const String DefaultGenesisGetPasswordServiceUrl =
// "http://localhost:56011/api/Password/GetPassword?PcbId=";
//private const String DefaultGenesisSetPasswordServiceUrl =
// "http://localhost:56011/api/Password/setpassword?PcbId=";
//private const String DefaultGenesisPasswordContainerServiceUrl =
// "http://localhost:56011/api/Password/GetPasswordHashFileContent?PcbId=";
//private const String DefaultMarriageServiceUrl =
// "http://localhost:56011/api/Marriage/";
//private const String DefaultMeterProcessStateUrl =
// "http://localhost:56011/api/ProccesState/";
//private const String DefaultGenesisFinalCheckServiceUrl =
// "http://localhost:56011/api/FinalCheck/";
//private const String DefaultGenesisRadioCheckServiceUrl =
// "http://localhost:56011/api/RadioCheck/";
//private const String DefaultGetSoftwareStartUpAccessUrl =
// "http://localhost:56011/api/SoftwareAccess/GetVersionIsValid";
private const String PressureSensorTestURL_GetTestSpec
= "http://sla12iis01.emea.sensus.net/MeterProcessState/api/CordonelPressureSensorTest/GetTestSpec";
private const String PressureSensorTestURL_PostTestResults
= "http://sla12iis01.emea.sensus.net/MeterProcessState/api/CordonelPressureSensorTest/PostTestResults";
public static readonly String PressureSensorTestURL_PostTestResults
= $"{ServerDns}/MeterProcessState/api/CordonelPressureSensorTest/PostTestResults";
/// <summary>
/// usage: string.Format(CordonelPressureSensorTestURL_GetTestResults, pcbId);
/// </summary>
private const String PressureSensorTestURL_GetTestResults
= "http://sla12iis01.emea.sensus.net/MeterProcessState/api/CordonelPressureSensorTest/GetTestResults/{0}";
public static readonly String PressureSensorTestURL_GetTestResults
= $"{ServerDns}/MeterProcessState/api/CordonelPressureSensorTest/GetTestResults/{0}";
public const String LaaProductionAPI
#if DEBUG == false // when false uses always the production url.
@ -226,7 +213,7 @@ namespace Xylem.Common.CommonCore.Configuration
/// <summary>
/// GET: test specification for water meter with pressure sensor.
/// </summary>
public static string GetPressureSensorSpecificationURL
public static String GetPressureSensorSpecificationURL
#if DEBUG
=> "http://localhost:56011/api/CordonelPressureSensorTest/GetTestSpec";
#else
@ -237,7 +224,7 @@ namespace Xylem.Common.CommonCore.Configuration
/// <summary>
/// POST: test result for water meter with pressure sensor.
/// </summary>
public static string PostPressureSensorResultURL
public static String PostPressureSensorResultURL
#if DEBUG
=> "http://localhost:56011/api/CordonelPressureSensorTest/PostTestResults";
@ -250,7 +237,7 @@ namespace Xylem.Common.CommonCore.Configuration
/// <summary>
/// GET: a list of test results for the water meter with specified pcbId.
/// </summary>
public static string PressureSensorResultsURL<T>(this T pcbId)
public static String PressureSensorResultsURL<T>(this T pcbId)
{
#if DEBUG
var url = "http://localhost:56011/api/CordonelPressureSensorTest/GetTestResults/{0}";
@ -261,6 +248,60 @@ namespace Xylem.Common.CommonCore.Configuration
return string.Format(url, pcbId);
}
/// <summary>
/// Get export data
/// </summary>
/// <returns></returns>
public static String GetExportDataServiceUrl()
{
return ConfigurationManager.AppSettings["GetExportDataServiceUrl"] ??
DefaultGetExportDataServiceUrl;
}
/// <summary>
/// Get Cordonel mapping
/// </summary>
/// <returns></returns>
public static String GetCordonelMappingServiceUrl()
{
return ConfigurationManager.AppSettings["GetCordonelMappingServiceUrl"] ??
DefaultGetCordonelMappingServiceUrl;
}
/// <summary>
/// Get Cordonel order overview to check the assignment state
/// </summary>
/// <returns></returns>
public static String GetOrderOverviewServiceUrl()
{
return ConfigurationManager.AppSettings["GetOrderOverviewServiceUrl"] ??
DefaultGetOrderOverviewServiceUrl;
}
/// <summary>
/// Get Cordonel order details to check for order dependent requirements like
/// - MeterSize,
/// - FrequencyIndicator,
/// - PressurePresent.
/// </summary>
/// <returns></returns>
public static String GetOrderDetailsServiceUrl()
{
return ConfigurationManager.AppSettings["GetOrderDetailsServiceUrl"] ??
DefaultGetOrderDetailsServiceUrl;
}
/// <summary>
/// List all Cordonel FW packages.
/// </summary>
/// <returns></returns>
public static String GetLutUrl()
{
return ConfigurationManager.AppSettings["GetLutUrl"] ??
DefaultGetLutUrl;
}
/// <summary>
/// List all Cordonel FW packages.
/// </summary>
@ -412,8 +453,8 @@ namespace Xylem.Common.CommonCore.Configuration
/// Get all production infos for skip process checks or limits for production like:
/// - Battery drained percentage upper limit,
/// - Production due date for a special register,
/// - Required life time for assembly line,
/// - Required life time for shipping line.
/// - Required lifetime for assembly line,
/// - Required lifetime for shipping line.
/// </summary>
/// <returns></returns>
public static String GetCordonelRequirementInfoServiceUrl()
@ -426,11 +467,11 @@ namespace Xylem.Common.CommonCore.Configuration
/// Get all production infos for skip process checks or limits for production like:
/// - Battery drained percentage upper limit,
/// - Production due date for a special register,
/// - Required life time for assembly line,
/// - Required life time for shipping line.
/// - Required lifetime for assembly line,
/// - Required lifetime for shipping line.
/// </summary>
/// <returns></returns>
public static String GetCordonelRequirementByFANrInfoServiceUrl(string ponr)
public static String GetCordonelRequirementByFANrInfoServiceUrl(String ponr)
{
return $"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/requirements/pono/{ponr}";
}
@ -439,11 +480,11 @@ namespace Xylem.Common.CommonCore.Configuration
/// Get all production infos for skip process checks or limits for production like:
/// - Battery drained percentage upper limit,
/// - Production due date for a special register,
/// - Required life time for assembly line,
/// - Required life time for shipping line.
/// - Required lifetime for assembly line,
/// - Required lifetime for shipping line.
/// </summary>
/// <returns></returns>
public static string GetCordonelRequirementByMeterSizeInfoServiceUrl(int size)
public static String GetCordonelRequirementByMeterSizeInfoServiceUrl(Int32 size)
{
return $"http://sla12iis01.emea.sensus.net/LaaProductionWeb/api/cordonel/requirements/isize/{size}";
}
@ -700,6 +741,16 @@ namespace Xylem.Common.CommonCore.Configuration
DefaultGenesisGetKeySetIdServiceUrl;
}
/// <summary>
/// Genesis get password url
/// </summary>
/// <returns></returns>
public static String GenesisSetPickingStateServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisSetPickingStateServiceUrl"] ??
DefaultGenesisSetPickingStateServiceUrl;
}
/// <summary>
/// Genesis get password url
/// </summary>
@ -815,4 +866,6 @@ namespace Xylem.Common.CommonCore.Configuration
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,873 @@
using System;
using System.Configuration;
namespace Xylem.Common.CommonCore.Configuration
{
/// <summary>
/// Urls for data base accesses
/// </summary>
public static class ServiceUrls
{
//#if URI_OLD_DNS // this is defined in build configuration 'VPN_Debug' as the new DNS cannot be reached via VPN
// private const String ServerDns = "http://sla12iis01.emea.sensus.net";
// private const String ProductionUiServerDns = "http://sla12iis01.emea.sensus.net";
//#else
private const String ServerDns = "http://delaz1web01.world.fluidtechnology.net";
private const String ProductionUiServerDns = "http://delaz1web01.world.fluidtechnology.net/LaaProductionWeb";
//#endif
private static readonly String DefaultInspectCordonelRequirementInfoUrl =
$"{ProductionUiServerDns}/";
// return code: 404 not found, 400 Error with text, 200 okay
private static readonly String DefaultEolDataForSentinelServiceUrl =
$"{ProductionUiServerDns}/api/cordonel/eolprogress/";
private static readonly String DefaultGetPcbIdsFromSafeServiceUrl =
$"{ServerDns}/MeterProcessState/GetPcbIdsFromSafe?ContainerDbId=";
private static readonly String DefaultGetExportDataServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/GetExportData?PcbId=";
private static readonly String DefaultGetCordonelMappingServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelMapping?PcbId=";
private static readonly String DefaultAddPcbIdsToSafeServiceUrl =
$"{ServerDns}/MeterProcessState/AddPcbIdsToSafe?ContainerDbId=";
private static readonly String DefaultGetOrderOverviewServiceUrl =
$"{ServerDns}/MeterProcessState/api/FinalCheck/GetOrderOverview?ProductionOrderNumber=";
private static readonly String DefaultGetOrderDetailsServiceUrl =
$"{ServerDns}/MeterProcessState/api/FinalCheck/GetOrderDetails?ProductionOrderNumber=";
private static readonly String DefaultDownloadFilesPartsServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFileParts?ParentFileId=";
private static readonly String DefaultGetLutUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetLutFiles";
private static readonly String DefaultListAllFwPackagesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=1";
private static readonly String DefaultListAllSwPackagesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=5";
private static readonly String DefaultListAllConfigFilePackagesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=6";
private static readonly String DefaultListAllFwUpdateSafesServiceUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly=false&FileCategoryID=4";
private static readonly String DefaultSetCordonelAppVersionServiceUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/SetCordonelProgress?PcbId=";
private static readonly String DefaultGetCordonelRequirementInfoUrl =
$"{ProductionUiServerDns}/api/cordonel/requirements/pcbid/";
private static readonly String DefaultGetCordonelAppVersionServiceUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/GetCordonelAppVersion?PcbId=";
private static readonly String DefaultListAllCordonelCustomersWithFilterServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelCustomers?FilterName=";
private static readonly String DefaultListAllCordonelCustomerOrdersServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCustomersCordonelOrders?CustomerNumber=";
private static readonly String DefaultListCordonelOrderDetailsServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelOrderDetails?OrderNr=";
private static readonly String DefaultListAllOrderCordonelsServiceUrl =
$"{ServerDns}/MeterProcessState/api/Order/GetCordonelOrderList?CustomerOrderNumber=";
private static readonly String DefaultDownloadFwUpdateSafeServiceUrl =
$"{ServerDns}/MeterProcessState/GetFWUpdateSafeContainerContent?SafeContainerId=";
private static readonly String DefaultListAllFwUpdateSafesForUserServiceUrl =
$"{ServerDns}/MeterProcessState/GetFWUpdateSafeContainers?UserId=";
private static readonly String DefaultFileContentDownloadServiceUrl =
$"{ServerDns}/MeterProcessState/GetFileContent?FileId=";
private static readonly String DefaultFwUpdateReportUploadServiceUrl =
$"{ServerDns}/MeterProcessState/PostFWUpdateReportFile";
private static readonly String DefaultFwUpdateReportDownloadServiceUrl =
$"{ServerDns}/MeterProcessState/GetFWUpdateReportFile?";
private static readonly String DefaultFwUpdateSafeContainerUploadServiceUrl =
$"{ServerDns}/MeterProcessState/PostFWUpdateSafeOdd";
private static readonly String DefaultEditFwUpdateUserValidityServiceUrl =
$"{ServerDns}/MeterProcessState/EditUserValidity?Id=";
private static readonly String DefaultRefreshFwUpdateUsersHardwareIdServiceUrl =
$"{ServerDns}/MeterProcessState/RefreshUsersHardwareId?Id=";
private static readonly String DefaultRefreshFwUpdateUsersPasswordHashServiceUrl =
$"{ServerDns}/MeterProcessState/RefreshUsersPasswordHash?Id=";
private static readonly String DefaultCreateNewFwUpdateUserServiceUrl =
$"{ServerDns}/MeterProcessState/AddNewUser?";
private static readonly String DefaultListAllFwUpdateUsersServiceUrl =
$"{ServerDns}/MeterProcessState/GetUserList";
private static readonly String DefaultListAllFwUpdateBuilderOperatorsServiceUrl =
$"{ServerDns}/MeterProcessState/GetAllBuilderOperator";
private static readonly String DefaultGetFwUpdateUserByIdServiceUrl =
$"{ServerDns}/MeterProcessState/GetUserList?Id=";
private static readonly String DefaultGetFwUpdateUserByLoginNameServiceUrl =
$"{ServerDns}/MeterProcessState/GetUserList?LogInName=";
private static readonly String DefaultRegisterWatchServiceUrl =
$"{ServerDns}/MeterProcessState/api/RegisterWatch/";
private static readonly String DefaultGenesisGetOrderNumberServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/ordernumber?PcbId=";
private static readonly String DefaultGenesisGetRadioAddressServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/radioadress?PcbId=";
private static readonly String DefaultGenesisGetKeySetIdServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/getkeysetid?PcbId=";
private static readonly String DefaultGenesisSetPickingStateServiceUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/SetPickingState?PcbID=";
private static readonly String DefaultGenesisGetPasswordServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/GetPassword?PcbId=";
private static readonly String DefaultGenesisSetPasswordServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/setpassword?PcbId=";
private static readonly String DefaultGenesisPasswordContainerServiceUrl =
$"{ServerDns}/MeterProcessState/api/Password/GetPasswordHashFileContent?PcbId=";
private static readonly String DefaultMarriageServiceUrl =
$"{ServerDns}/MeterProcessState/api/Marriage/";
private static readonly String DefaultMeterProcessStateUrl =
$"{ServerDns}/MeterProcessState/api/ProccesState/";
private static readonly String DefaultGenesisFinalCheckServiceUrl =
$"{ServerDns}/MeterProcessState/api/FinalCheck/";
private static readonly String DefaultGenesisRadioCheckServiceUrl =
$"{ServerDns}/MeterProcessState/api/RadioCheck/";
private static readonly String DefaultGetSoftwareStartUpAccessUrl =
$"{ServerDns}/MeterProcessState/api/SoftwareAccess/GetVersionIsValid";
private static readonly String DefaultSetSoftwareLicenseUrl =
$"{ServerDns}/MeterProcessState/api/SoftwareAccess/SetVersionIsValid?Program=";
private static readonly String DefaultGetSoftwareLicenseUrl =
$"{ServerDns}/MeterProcessState/api/SoftwareAccess/GetCurrentVersion?Program=";
private static readonly String DefaultGenesisCalibrationResult =
$"{ServerDns}/MeterProcessState/api/GenesisMeter/PostCalibrationResult";
private static readonly String DefaultGetGenesisCalibrationResults =
$"{ServerDns}/MeterProcessState/api/FinalCheck/CalibrationResults/";
private static readonly String DefaultGenesisMeter =
$"{ServerDns}/MeterProcessState/api/GenesisMeter/";
private static readonly String DefaultFileContentController =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/";
private static readonly String DefaultKeyServerCustom =
"https://nodes.sms-esaap.com/keygenproxy/api/v3/custom/";
private static readonly String DefaultMeterInfoForTestBench =
$"{ServerDns}/MeterProcessState/api/TestBench/GetMeterInfoForTestBench?PcbID=";
private static readonly String DefaultCordonelFwInfoUrl =
$"{ServerDns}/MeterProcessState/api/FileUpToDate/GetCordonelFw";
private static readonly String DefaultDbDataAtEolServiceUrl =
$"{ServerDns}/MeterProcessState/api/fwupdate/databaseateol/";
public static readonly String PressureSensorTestURL_GetTestSpec
= $"{ServerDns}/MeterProcessState/api/CordonelPressureSensorTest/GetTestSpec";
public static readonly String PressureSensorTestURL_PostTestResults
= $"{ServerDns}/MeterProcessState/api/CordonelPressureSensorTest/PostTestResults";
/// <summary>
/// usage: string.Format(CordonelPressureSensorTestURL_GetTestResults, pcbId);
/// </summary>
public static readonly String PressureSensorTestURL_GetTestResults
= $"{ServerDns}/MeterProcessState/api/CordonelPressureSensorTest/GetTestResults/{0}";
public const String LaaProductionAPI
#if DEBUG == false // when false uses always the production url.
= "http://localhost:52822";
#else
= "http://delaz1web01.world.fluidtechnology.net/";
#endif
/// <summary>
/// GET: test specification for water meter with pressure sensor.
/// </summary>
public static String GetPressureSensorSpecificationURL
#if DEBUG
=> "http://localhost:56011/api/CordonelPressureSensorTest/GetTestSpec";
#else
=> ConfigurationManager.AppSettings[nameof(GetPressureSensorSpecificationURL)]
?? PressureSensorTestURL_GetTestSpec;
#endif
/// <summary>
/// POST: test result for water meter with pressure sensor.
/// </summary>
public static String PostPressureSensorResultURL
#if DEBUG
=> "http://localhost:56011/api/CordonelPressureSensorTest/PostTestResults";
public static String Q3CalibrationResultURL { get; set; }
#else
=> ConfigurationManager.AppSettings[nameof(PostPressureSensorResultURL)]
?? PressureSensorTestURL_PostTestResults;
#endif
/// <summary>
/// GET: a list of test results for the water meter with specified pcbId.
/// </summary>
public static String PressureSensorResultsURL<T>(this T pcbId)
{
#if DEBUG
var url = "http://localhost:56011/api/CordonelPressureSensorTest/GetTestResults/{0}";
#else
var url = ConfigurationManager.AppSettings[nameof(PressureSensorResultsURL)] ?? PressureSensorTestURL_GetTestResults;
#endif
return string.Format(url, pcbId);
}
/// <summary>
/// Get export data
/// </summary>
/// <returns></returns>
public static String GetExportDataServiceUrl()
{
return ConfigurationManager.AppSettings["GetExportDataServiceUrl"] ??
DefaultGetExportDataServiceUrl;
}
/// <summary>
/// Get Cordonel mapping
/// </summary>
/// <returns></returns>
public static String GetCordonelMappingServiceUrl()
{
return ConfigurationManager.AppSettings["GetCordonelMappingServiceUrl"] ??
DefaultGetCordonelMappingServiceUrl;
}
/// <summary>
/// Get Cordonel order overview to check the assignment state
/// </summary>
/// <returns></returns>
public static String GetOrderOverviewServiceUrl()
{
return ConfigurationManager.AppSettings["GetOrderOverviewServiceUrl"] ??
DefaultGetOrderOverviewServiceUrl;
}
/// <summary>
/// Get Cordonel order details to check for order dependent requirements like
/// - MeterSize,
/// - FrequencyIndicator,
/// - PressurePresent.
/// </summary>
/// <returns></returns>
public static String GetOrderDetailsServiceUrl()
{
return ConfigurationManager.AppSettings["GetOrderDetailsServiceUrl"] ??
DefaultGetOrderDetailsServiceUrl;
}
/// <summary>
/// List all Cordonel FW packages.
/// </summary>
/// <returns></returns>
public static String GetLutUrl()
{
return ConfigurationManager.AppSettings["GetLutUrl"] ??
DefaultGetLutUrl;
}
/// <summary>
/// List all Cordonel FW packages.
/// </summary>
/// <returns></returns>
public static String ListAllCordonelFwPackagesUrl()
{
return ConfigurationManager.AppSettings["CordonelFwInfoUrl"] ??
DefaultCordonelFwInfoUrl;
}
/// <summary>
/// List all PCB IDs from a safe. As the safe may be deleted, this information is still accessible.
/// </summary>
/// <returns></returns>
public static String MeterInfoForTestBench()
{
return ConfigurationManager.AppSettings["MeterInfoForTestBenchServiceUrl"] ??
DefaultMeterInfoForTestBench;
}
/// <summary>
/// List all PCB IDs from a safe. As the safe may be deleted, this information is still accessible.
/// </summary>
/// <returns></returns>
public static String ListAllPcbIdsFromSafe()
{
return ConfigurationManager.AppSettings["GetPcbIdsFromSafeServiceUrl"] ??
DefaultGetPcbIdsFromSafeServiceUrl;
}
/// <summary>
/// Add PCB IDs to a safe. As the safe may be deleted, this information is still accessible.
/// </summary>
/// <returns></returns>
public static String AddPcbIdsToSafeServiceUrl()
{
return ConfigurationManager.AppSettings["AddPcbIdsToSafeServiceUrl"] ??
DefaultAddPcbIdsToSafeServiceUrl;
}
/// <summary>
/// Get all Cordonel FW package.
/// </summary>
/// <returns></returns>
public static String DownloadFileParts()
{
return ConfigurationManager.AppSettings["DownloadFilePartsServiceUrl"] ??
DefaultDownloadFilesPartsServiceUrl;
}
/// <summary>
/// FW-Update Safe container list for specific user
/// </summary>
/// <returns></returns>
public static String ListAllFwUpdateSafesForUserServiceUrl()
{
return ConfigurationManager.AppSettings["ListAllFwUpdateSafesForUserServiceUrl"] ??
DefaultListAllFwUpdateSafesForUserServiceUrl;
}
/// <summary>
/// FW-Update Safe container
/// </summary>
/// <returns></returns>
public static String DownloadFwUpdateSafeServiceUrl()
{
return ConfigurationManager.AppSettings["DownloadFwUpdateSafeServiceUrl"] ??
DefaultDownloadFwUpdateSafeServiceUrl;
}
/// <summary>
/// Download the EOL logging data for power correction of overestimated power consumption
/// </summary>
/// <returns></returns>
public static String DownloadDbDataAtEolServiceUrl()
{
return ConfigurationManager.AppSettings["DownloadDbDataAtEolServiceUrl"] ??
DefaultDbDataAtEolServiceUrl;
}
/// <summary>
/// Get EOL data for sentinel
/// </summary>
/// <returns></returns>
public static String EolDataForSentinelServiceUrl()
{
return ConfigurationManager.AppSettings["EolDataForSentinelServiceUrl"] ??
DefaultEolDataForSentinelServiceUrl;
}
/// <summary>
/// Get all Cordonel safes description files.
/// </summary>
/// <returns></returns>
public static String ListAllFwUpdateSafes()
{
return ConfigurationManager.AppSettings["ListAllFwUpdateSafesServiceUrl"] ??
DefaultListAllFwUpdateSafesServiceUrl;
}
/// <summary>
/// Get all Cordonel FW package description files.
/// </summary>
/// <returns></returns>
public static String ListAllFwPackages()
{
return ConfigurationManager.AppSettings["ListAllFwPackagesServiceUrl"] ??
DefaultListAllFwPackagesServiceUrl;
}
/// <summary>
/// Get all Cordonel FW update SW package description files.
/// </summary>
/// <returns></returns>
public static String ListAllSwPackages()
{
return ConfigurationManager.AppSettings["ListAllSwPackagesServiceUrl"] ??
DefaultListAllSwPackagesServiceUrl;
}
/// <summary>
/// Get all Cordonel FW update SW package description files.
/// </summary>
/// <returns></returns>
public static String ListAllConfigurationFilePackages()
{
return ConfigurationManager.AppSettings["ListAllConfigFilePackagesServiceUrl"] ??
DefaultListAllConfigFilePackagesServiceUrl;
}
/// <summary>
/// Set all applications versions installed to a specific Cordonel.
/// </summary>
/// <returns></returns>
public static String UploadCordonelAppVersionServiceUrl()
{
return ConfigurationManager.AppSettings["SetCordonelAppVersionServiceUrl"] ??
DefaultSetCordonelAppVersionServiceUrl;
}
/// <summary>
/// Inspect a specific requirement (read only).
/// </summary>
/// <returns></returns>
public static String InspectCordonelRequirementInfoServiceUrl()
{
return ConfigurationManager.AppSettings["InspectCordonelRequirementInfoServiceUrl"] ??
DefaultInspectCordonelRequirementInfoUrl;
}
/// <summary>
/// Get all production infos for skip process checks or limits for production like:
/// - Battery drained percentage upper limit,
/// - Production due date for a special register,
/// - Required lifetime for assembly line,
/// - Required lifetime for shipping line.
/// </summary>
/// <returns></returns>
public static String GetCordonelRequirementInfoServiceUrl()
{
return ConfigurationManager.AppSettings["GetCordonelRequirementInfoServiceUrl"] ??
DefaultGetCordonelRequirementInfoUrl;
}
/// <summary>
/// Get all production infos for skip process checks or limits for production like:
/// - Battery drained percentage upper limit,
/// - Production due date for a special register,
/// - Required lifetime for assembly line,
/// - Required lifetime for shipping line.
/// </summary>
/// <returns></returns>
public static String GetCordonelRequirementByFANrInfoServiceUrl(String ponr)
{
return $"{ProductionUiServerDns}/api/cordonel/requirements/pono/{ponr}";
}
/// <summary>
/// Get all production infos for skip process checks or limits for production like:
/// - Battery drained percentage upper limit,
/// - Production due date for a special register,
/// - Required lifetime for assembly line,
/// - Required lifetime for shipping line.
/// </summary>
/// <returns></returns>
public static String GetCordonelRequirementByMeterSizeInfoServiceUrl(Int32 size)
{
return $"{ProductionUiServerDns}/api/cordonel/requirements/isize/{size}";
}
/// <summary>
/// Get all applications versions installed to a specific Cordonel.
/// </summary>
/// <returns></returns>
public static String DownloadCordonelAppVersionServiceUrl()
{
return ConfigurationManager.AppSettings["GetCordonelAppVersionServiceUrl"] ??
DefaultGetCordonelAppVersionServiceUrl;
}
/// <summary>
/// List all Cordonel customers with search filter (e.g. %sus% where % is a filter for 0 to multiple
/// alphanumeric characters) to get the customer names and the order numbers.
/// </summary>
/// <returns></returns>
public static String ListAllCordonelCustomersWithFilterServiceUrl()
{
return ConfigurationManager.AppSettings["ListAllCordonelCustomersWithFilterServiceUrl"] ??
DefaultListAllCordonelCustomersWithFilterServiceUrl;
}
/// <summary>
/// Get Cordonel order details to capture the production order
/// </summary>
/// <returns></returns>
public static String ListCordonelOrderDetailsServiceUrl()
{
return ConfigurationManager.AppSettings["ListCordonelOrderDetailsServiceUrl"] ??
DefaultListCordonelOrderDetailsServiceUrl;
}
/// <summary>
/// List all Cordonel orders of a selected customer
/// </summary>
/// <returns></returns>
public static String ListAllCordonelCustomerOrdersServiceUrl()
{
return ConfigurationManager.AppSettings["ListAllCordonelCustomerOrdersServiceUrl"] ??
DefaultListAllCordonelCustomerOrdersServiceUrl;
}
/// <summary>
/// List all Cordonels of a specific order number to get the customer serial number and the Pcb ID.
/// </summary>
/// <returns></returns>
public static String ListAllOrderCordonelsServiceUrl()
{
return ConfigurationManager.AppSettings["ListAllOrderCordonelsServiceUrl"] ??
DefaultListAllOrderCordonelsServiceUrl;
}
/// <summary>
/// Register watch service
/// </summary>
/// <returns></returns>
public static String RegisterWatchServiceUrl()
{
return ConfigurationManager.AppSettings["RegisterWatchServiceUrl"] ??
DefaultRegisterWatchServiceUrl;
}
/// <summary>
/// File content download
/// </summary>
/// <returns></returns>
public static String DownloadFileContentServiceUrl()
{
return ConfigurationManager.AppSettings["FileContentDownloadServiceUrl"] ??
DefaultFileContentDownloadServiceUrl;
}
/// <summary>
/// FW-Update report download as string
/// </summary>
/// <returns></returns>
public static String DownloadFwUpdateReportServiceUrl()
{
return ConfigurationManager.AppSettings["FwUpdateReportDownloadServiceUrl"] ??
DefaultFwUpdateReportDownloadServiceUrl;
}
/// <summary>
/// FW-Update report upload as string
/// </summary>
/// <returns></returns>
public static String UploadFwUpdateReportServiceUrl()
{
return ConfigurationManager.AppSettings["FwUpdateReportUploadServiceUrl"] ??
DefaultFwUpdateReportUploadServiceUrl;
}
/// <summary>
/// FW-Update Safe container upload
/// </summary>
/// <returns></returns>
public static String UploadFwUpdateSafeContainerServiceUrl()
{
return ConfigurationManager.AppSettings["FwUpdateSafeContainerUploadServiceUrl"] ??
DefaultFwUpdateSafeContainerUploadServiceUrl;
}
/// <summary>
/// FW-Update user validation url
/// </summary>
/// <returns></returns>
public static String EditFwUpdateUserValidityServiceUrl()
{
return ConfigurationManager.AppSettings["EditFwUpdateUserValidityServiceUrl"] ??
DefaultEditFwUpdateUserValidityServiceUrl;
}
/// <summary>
/// FW-Update user HW-Id url
/// </summary>
/// <returns></returns>
public static String RefreshFwUpdateUsersHardwareIdServiceUrl()
{
return ConfigurationManager.AppSettings["RefreshFwUpdateUsersHardwareIdServiceUrl"] ??
DefaultRefreshFwUpdateUsersHardwareIdServiceUrl;
}
/// <summary>
/// FW-Update user password hash for encryption url
/// </summary>
/// <returns></returns>
public static String RefreshFwUpdateUsersPasswordHashServiceUrl()
{
return ConfigurationManager.AppSettings["RefreshFwUpdateUsersPasswordHashServiceUrl"] ??
DefaultRefreshFwUpdateUsersPasswordHashServiceUrl;
}
/// <summary>
/// FW-Update create new user url
/// </summary>
/// <returns></returns>
public static String CreateNewFwUpdateUserServiceUrl()
{
return ConfigurationManager.AppSettings["CreateNewFwUpdateUserServiceUrl"] ??
DefaultCreateNewFwUpdateUserServiceUrl;
}
/// <summary>
/// FW-Update list all users url
/// </summary>
/// <returns></returns>
public static String ListAllFwUpdateUsersServiceUrl()
{
return ConfigurationManager.AppSettings["ListAllFwUpdateUsersServiceUrl"] ??
DefaultListAllFwUpdateUsersServiceUrl;
}
/// <summary>
/// FW-Update list all users url
/// </summary>
/// <returns></returns>
public static String ListAllFwUpdateBuilderOperatorsServiceUrl()
{
return ConfigurationManager.AppSettings["ListAllFwUpdateBuilderOperatorsServiceUrl"] ??
DefaultListAllFwUpdateBuilderOperatorsServiceUrl;
}
/// <summary>
/// FW-Update get user information by user Id url
/// </summary>
/// <returns></returns>
public static String GetFwUpdateUserByIdServiceUrl()
{
return ConfigurationManager.AppSettings["GetFwUpdateUserByIdServiceUrl"] ??
DefaultGetFwUpdateUserByIdServiceUrl;
}
/// <summary>
/// FW-Update get user information by user login name url
/// </summary>
/// <returns></returns>
public static String GetFwUpdateUserByLoginNameServiceUrl()
{
return ConfigurationManager.AppSettings["GetFwUpdateUserByLoginNameServiceUrl"] ??
DefaultGetFwUpdateUserByLoginNameServiceUrl;
}
/// <summary>
/// Genesis check radio parameter url
/// </summary>
/// <returns></returns>
public static String GenesisRadioCheckServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisRadioCheckServiceUrl"] ??
DefaultGenesisRadioCheckServiceUrl;
}
/// <summary>
/// Genesis radio parameter get url
/// </summary>
/// <returns></returns>
public static String GenesisFinalCheckServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisFinalCheckServiceUrl"] ??
DefaultGenesisFinalCheckServiceUrl;
}
/// <summary>
/// Marriage service url
/// </summary>
/// <returns></returns>
public static String MarriageServiceUrl()
{
return ConfigurationManager.AppSettings["MarriageServiceUrl"] ??
DefaultMarriageServiceUrl;
}
/// <summary>
/// Genesis process status url
/// </summary>
/// <returns></returns>
public static String MeterProcessStateUrl()
{
return ConfigurationManager.AppSettings["MeterProcessStateUrl"] ??
DefaultMeterProcessStateUrl;
}
/// <summary>
/// Genesis get radio address url
/// </summary>
/// <returns></returns>
public static String GenesisGetRadioAddressServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisGetRadioAddressServiceUrl"] ??
DefaultGenesisGetRadioAddressServiceUrl;
}
/// <summary>
/// Genesis get key set id url
/// </summary>
/// <returns></returns>
public static String GenesisGetOrderNumberServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisGetOrderNumberServiceUrl"] ??
DefaultGenesisGetOrderNumberServiceUrl;
}
/// <summary>
/// Genesis get key set id url
/// </summary>
/// <returns></returns>
public static String GenesisGetKeySetIdServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisGetKeySetIdServiceUrl"] ??
DefaultGenesisGetKeySetIdServiceUrl;
}
/// <summary>
/// Genesis get password url
/// </summary>
/// <returns></returns>
public static String GenesisSetPickingStateServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisSetPickingStateServiceUrl"] ??
DefaultGenesisSetPickingStateServiceUrl;
}
/// <summary>
/// Genesis get password url
/// </summary>
/// <returns></returns>
public static String GenesisGetPasswordServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisGetPasswordServiceUrl"] ??
DefaultGenesisGetPasswordServiceUrl;
}
/// <summary>
/// Genesis get password url
/// </summary>
/// <returns></returns>
public static String GenesisGetPasswordContainerServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisPasswordContainerServiceUrl"] ??
DefaultGenesisPasswordContainerServiceUrl;
}
/// <summary>
/// Genesis set password url
/// </summary>
/// <returns></returns>
public static String GenesisSetPasswordServiceUrl()
{
return ConfigurationManager.AppSettings["GenesisSetPasswordServiceUrl"] ??
DefaultGenesisSetPasswordServiceUrl;
}
/// <summary>
/// Set the SW license
/// </summary>
/// <returns></returns>
public static String SetSoftwareLicenseUrl()
{
return ConfigurationManager.AppSettings["SetSoftwareLicenseUrl"] ??
DefaultSetSoftwareLicenseUrl;
}
/// <summary>
/// Set the SW license
/// </summary>
/// <returns></returns>
public static String GetSoftwareLicenseUrl()
{
return ConfigurationManager.AppSettings["GetSoftwareLicenseUrl"] ??
DefaultGetSoftwareLicenseUrl;
}
/// <summary>
/// Check the SW license with a given name and version
/// </summary>
/// <returns></returns>
public static String GetSoftwareStartUpAccessUrl()
{
return ConfigurationManager.AppSettings["GetSoftwareStartUpAccessUrl"] ??
DefaultGetSoftwareStartUpAccessUrl;
}
/// <summary>
/// Get Genesis calibration results for final check if those have been correctly set
/// </summary>
/// <returns></returns>
public static String GetGenesisCalibrationResultsUrl()
{
return ConfigurationManager.AppSettings["GetGenesisCalibrationResults"] ??
DefaultGetGenesisCalibrationResults;
}
/// <summary>
/// Post Genesis calibration results
/// </summary>
/// <returns></returns>
public static String PostGenesisCalibrationResultUrl()
{
return ConfigurationManager.AppSettings["GenesisCalibrationResult"] ??
DefaultGenesisCalibrationResult;
}
/// <summary>
/// Post Genesis calibration results
/// </summary>
/// <returns></returns>
public static String FileContentControllerUrl()
{
return ConfigurationManager.AppSettings["DefaultFileContentController"] ??
DefaultFileContentController;
}
/// <summary>
/// Root for all function regarding the BSI Key generation service
/// </summary>
/// <returns></returns>
public static String KeyServerCustom()
{
return ConfigurationManager.AppSettings["DefaultKeyServerCustom"] ??
DefaultKeyServerCustom;
}
/// <summary>
/// Root for all function regarding the meter itself
/// </summary>
/// <returns></returns>
public static String GenesisMeter()
{
return ConfigurationManager.AppSettings["GenesisMeter"] ??
DefaultGenesisMeter;
}
public static String GetQ3CalibrationsURI(String currentPcbId)
{
throw new NotImplementedException();
}
}
}

View File

@ -82,6 +82,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>

View File

@ -9,6 +9,11 @@ namespace Xylem.Common.CommonCore.Consts
/// </summary>
public const String RegisterDefinitionFileName = "configuration.json";
/// <summary>
/// Name of serial configuration file
/// </summary>
public const String FM2014ConfigFileName = "FM2014Config.json";
/// <summary>
/// Name of serial configuration file
/// </summary>
@ -22,7 +27,12 @@ namespace Xylem.Common.CommonCore.Consts
/// <summary>
/// Name for meter config
/// </summary>
public const String ConfigFileName = "MeterConfig.json";
public const String MeterConfigFileName = "MeterConfig.json";
/// <summary>
/// Name for SIRT config
/// </summary>
public const String SirtConfigFileName = "SirtConfig.json";
/// <summary>
/// Name for offline information e.g. Passwords

View File

@ -66,6 +66,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<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>

View File

@ -36,6 +36,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GLWpfControl, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\OpenTK.GLWpfControl.3.3.0\lib\net452\GLWpfControl.dll</HintPath>

View File

@ -1,13 +1,7 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace CordonelAssemblyLine
namespace CordonelAssemblyLine
{
using System.Windows;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>

View File

@ -14,10 +14,11 @@
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>true</IsWebBootstrapper>
<PublishUrl>\\SLA12IIS01\LaaProductionWeb\Apps\CordonelAssembly\</PublishUrl>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>Z:\Aktuelle Anwendungen\Publish\Cordonel Assembly Line\</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
<InstallFrom>Unc</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
@ -25,19 +26,17 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<InstallUrl>http://sla12iis01.emea.sensus.net/LaaProductionWeb/Apps/CordonelAssembly/</InstallUrl>
<InstallUrl>\\sla12file\auftrag\Aktuelle Anwendungen\Publish\Cordonel Assembly Line\</InstallUrl>
<ProductName>Cordonel Assembly Line</ProductName>
<PublisherName>Xylem Sensus Laatzen</PublisherName>
<SuiteName>Cordonel Assembly Line</SuiteName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<ApplicationRevision>8</ApplicationRevision>
<ApplicationRevision>14</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -81,7 +80,7 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>5586F8F849F79C1CEB990ED4E3ACB22CDF595CB5</ManifestCertificateThumbprint>
<ManifestCertificateThumbprint>254AA244F3F29F0692A7B2FAA31F24C884355262</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>CordonelAssemblyLine_TemporaryKey.pfx</ManifestKeyFile>
@ -90,11 +89,39 @@
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
<SignManifests>false</SignManifests>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\CordonelAssemblyLine.xml</DocumentationFile>
<NoWarn>IDE0003;IDE0021;IDE0049;CS1591;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>sensus.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@ -105,6 +132,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
@ -181,9 +209,10 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="CordonelAssemblyLine_TemporaryKey.pfx" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
@ -271,6 +300,12 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="Resources\sensus.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="sensus.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>del /Q /S *.xml *.pdb</PostBuildEvent>

View File

@ -64,8 +64,6 @@ namespace CordonelAssemblyLine
Dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
var update = false;
if (sender is null)
{
ViewModel.InputIsEnabled = false;
@ -87,7 +85,6 @@ namespace CordonelAssemblyLine
}
private void Button_Click(Object sender, RoutedEventArgs e)
{
String input = "";
var obj = ((FrameworkElement)sender).DataContext;
if (obj is Xylem.Common.Logic.ProductionOrderCore.TestResults.PressureTestPoints ptp)
{

View File

@ -5,13 +5,17 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ProductionControls1="clr-namespace:Ui.ProductionControls;assembly=ProductionControls"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Closing="Window_Closing">
Title="Cordonel Assembly Line"
Height="450"
Width="800"
Closing="Window_Closing">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="100"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="264*"/>
@ -114,5 +118,15 @@
<Button Name="btn2" Content="2" Grid.Column="3" HorizontalAlignment="Left" Height="28" Margin="52,36,0,0" Grid.Row="2" VerticalAlignment="Top" Width="17" Click="Btn2_Click"/>
<Button Name="btn3" Content="3" Grid.Column="3" HorizontalAlignment="Left" Height="28" Margin="89,36,0,0" Grid.Row="2" VerticalAlignment="Top" Width="17" Click="Btn3_Click"/>
<TextBlock Text="GoTo Current Directory ->"
Grid.Row="4"
FontFamily="Consolas"
FontStyle="Italic"
FontSize="10" Padding="0"
Margin="13 8"
Foreground="LightGray"
TextDecorations="Underline"
MouseDown="TextBlock_MouseDown"
Cursor="Hand"/>
</Grid>
</Window>

View File

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Windows;
@ -167,5 +168,11 @@ namespace CordonelAssemblyLine
{
}
private void TextBlock_MouseDown(Object sender, System.Windows.Input.MouseButtonEventArgs e)
{
Process.Start(Environment.CurrentDirectory);
e.Handled = true;
}
}
}

View File

@ -292,7 +292,7 @@ namespace CordonelAssemblyLine.Model
{
InputIsEnabled = false;
Result = new PressureResultDataNotifyable() { Remark = "loading", TestPoints = new ObservableCollection<PressureTestPoints>(), PcbId = "" };
Task<PressureResultDataNotifyable>.Run(() =>
Task<PressureResultDataNotifyable>.Run((Func<PressureResultDataNotifyable>)(() =>
{
try
{
@ -331,7 +331,7 @@ namespace CordonelAssemblyLine.Model
return new PressureResultDataNotifyable();
}
}).ContinueWith((a) =>
})).ContinueWith((a) =>
{
if (a == null)
{
@ -362,7 +362,7 @@ namespace CordonelAssemblyLine.Model
InputIsEnabled = false;
var isStored = "";
Result.TesterName = TesterName;
Task.Run(() =>
Task.Run((Func<Boolean>)(() =>
{
var url = ServiceUrls.MeterProcessStateUrl();
var status = DisplayCodes.PressureTestedFailed;
@ -422,7 +422,7 @@ namespace CordonelAssemblyLine.Model
OnStoreDone?.Invoke(null, new StringPressureArgs("Bitte erneut testen oder Linienleitung und QS informieren.", true));
return false;
});
}));
}
return false;

View File

@ -1,5 +1,4 @@
using LaaPackages.Features.Cordonel.Models;
using Logic.ProductionToProductMapper.Cordonel;
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@ -11,6 +10,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using LaaPackages.Features.Cordonel.Models;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
@ -18,6 +18,7 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Logic.ProductionOrderCore.OrderData;
using Xylem.Common.Logic.SoftwareAccessHelper;
using static Ui.ProductionControls.ctlPictureProgressBar;
@ -557,10 +558,8 @@ namespace CordonelAssemblyLine.Model
{
using (var batch = new MeterBatch())
{
using (var meter = new GenesisMeter())
{
meter.SetupFromConfigFile(_slotNr);
batch.AddMeter(meter);
SetState("Am Zähler anmelden");
@ -607,7 +606,7 @@ namespace CordonelAssemblyLine.Model
//restlaufzeit monate -RequiredLifeTimeYearsAssembly
var hasFehlern = false;
// var hasFehlern = false;
// restlaufzeit monate - RequiredLifeTimeYearsAssembly
if (genesisStatus.RemainingLifeTimeYears < requirements.RequiredLifeTimeYearsAssembly)
@ -627,11 +626,10 @@ namespace CordonelAssemblyLine.Model
if (genesisStatus.AlternativeRequiredBatteryLoadPercent != null &&
genesisStatus.AlternativeRequiredBatteryLoadPercent > requirements.MaxDrainedBatteryLoadPercentAssembly)
genesisStatus.AlternativeRequiredBatteryLoadPercent > requirements.MaxDrainedBatteryLoadPercentAssembly * 0.5)
{
sbMSG.AppendLine($"{nameof(genesisStatus.AlternativeRequiredBatteryLoadPercent)}: " +
$"{genesisStatus.AlternativeRequiredBatteryLoadPercent} > " +
$"{requirements.MaxDrainedBatteryLoadPercentAssembly}");
$"{genesisStatus.AlternativeRequiredBatteryLoadPercent} > " + $"{requirements.MaxDrainedBatteryLoadPercentAssembly}");
ret = false;
}
else sbMSG.AppendLine($"Alternative Batterieverbrauch Montage i.O.");
@ -652,9 +650,9 @@ namespace CordonelAssemblyLine.Model
// lagerzeit - MaxStorageMonths
if (genesisStatus.StorageMonths > requirements.MaxStorageMonths)
{
lblS08Text = $"{nameof(genesisStatus.DrainedBatteryLoadPercent)}: " +
$"{genesisStatus.DrainedBatteryLoadPercent} > " +
$"{requirements.MaxDrainedBatteryLoadPercentAssembly}";
lblS08Text = $"{nameof(genesisStatus.StorageMonths)}: " +
$"{genesisStatus.StorageMonths} > " +
$"{requirements.MaxStorageMonths}";
lblS08Color = _progressError;
ret = false;
sbMSG.AppendLine($"{nameof(genesisStatus.StorageMonths)}: " +
@ -745,7 +743,7 @@ namespace CordonelAssemblyLine.Model
StringBuilder sbUrl = new StringBuilder();
sbUrl.Append("http://10.49.40.25/MeterProcessState/api/FileUpToDate/GetLutFiles");
sbUrl.Append(ServiceUrls.GetLutUrl());
sbUrl.Append($"?Metersize={_orderDetails.MeterSize}");
sbUrl.Append("&ForProd=true");
//?Metersize=2&Region=EMEA&
@ -822,7 +820,7 @@ namespace CordonelAssemblyLine.Model
meter.ReLogin();
}
meter.SetProcessState(DisplayCodes.PickingTested);
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={_order}";
var url = $"{ServiceUrls.MeterProcessStateUrl()}SetPickingState?PcbID={meter.PcbId}&FertigungsauftragsNr={_order}&successful=1";
var retString = LocalWebRequest.PostRequestAsyncAndGetContent(url);
if (bool.TryParse(retString, out var result))
@ -922,7 +920,7 @@ namespace CordonelAssemblyLine.Model
lblS06Color = _progressError;
return false;
}
if (meter.InstalledFwVersion.Value != checkAppsIdVersion.FirstOrDefault().Value)
@ -934,7 +932,7 @@ namespace CordonelAssemblyLine.Model
return false;
}
}
else
{
@ -1113,7 +1111,7 @@ namespace CordonelAssemblyLine.Model
}
catch (Exception e)
{
Log($"Error occur.{ Environment.NewLine} {e.Message}");
Log($"Error occur.{Environment.NewLine} {e.Message}");
}
}
}
@ -1142,11 +1140,61 @@ namespace CordonelAssemblyLine.Model
{
SetState($"Pcb gefunden {_pcbId}");
Log($"New PcbID detected {_pcbId}");
_state = PickingStateMachine.GetOrderDetails;
lblS02Text = _pcbId;
lblS02Color = _progressDone;
lblS03Color = _progressWaiting;
try
{
for (var i = 0; i < 3; i++)
{
if (tryMeter.Login())
{
var frequencyBytes = tryMeter.ReadRegister("SENSUSRADIO_FrequencyIndicator");
var frequencyValue = RegisterConverter.ByteArrayToValue<UInt32>(frequencyBytes);
if (frequencyValue != 0)
{
var rebootBytes = tryMeter.ReadRegister("CUSTOMER_RebootCount");
var rebootsCount = RegisterConverter.ByteArrayToValue<UInt32>(rebootBytes);
if (rebootsCount > 0)
{
Log($"{_pcbId} hat {rebootsCount} mal neuegestarted!");
var messageBoxResult = MessageBox.Show(
$"{_pcbId} hat {rebootsCount}-mal neu gestartet!"
+ $"{Environment.NewLine}"
+ $"{Environment.NewLine}Möchten Sie fortfahren?"
, $"Rechenwerk: {_pcbId}"
, MessageBoxButton.YesNo
, MessageBoxImage.Warning
, MessageBoxResult.Yes
, MessageBoxOptions.ServiceNotification);
if (messageBoxResult == MessageBoxResult.No)
{
lblS02Color = _progressError;
lblS03Color = _progressError;
_state = PickingStateMachine.MeterError;
}
else
{
lblS02Color = _progressDone;
lblS03Color = _progressWaiting;
_state = PickingStateMachine.GetOrderDetails;
}
}
}
break;
}
}
lblS02Text = _pcbId;
}
catch (Exception e)
{
Log(e.Message);
_state = PickingStateMachine.MeterError;
}
}
else
{
@ -1157,7 +1205,7 @@ namespace CordonelAssemblyLine.Model
}
catch (Exception e)
{
Log($"Error occur.{ Environment.NewLine} {e.Message}");
Log($"Error occur.{Environment.NewLine} {e.Message}");
}
}
}
@ -1221,7 +1269,7 @@ namespace CordonelAssemblyLine.Model
_state = PickingStateMachine.Compare;
lblS03Text = $"Nr {_orderOverview.OrderOverViewCordonel.AssignedPicking + 1 } von {_orderOverview.OrderOverViewCordonel.Count}";
lblS03Text = $"Nr {_orderOverview.OrderOverViewCordonel.AssignedPicking + 1} von {_orderOverview.OrderOverViewCordonel.Count}";
lblS03Color = _progressDone;
lblS04Color = _progressCurrent;
@ -1297,7 +1345,7 @@ namespace CordonelAssemblyLine.Model
Scanner = $"Öffne {_scannerPort}";
_barScanner = new BarScanner(_scannerPort, token);
HistoryText = $"{HistoryText} {Environment.NewLine}{_order}({_orderOverview.OrderOverViewCordonel.AssignedPicking + 1 }/{ _orderOverview.OrderOverViewCordonel.Count})";
HistoryText = $"{HistoryText} {Environment.NewLine}{_order}({_orderOverview.OrderOverViewCordonel.AssignedPicking + 1}/{_orderOverview.OrderOverViewCordonel.Count})";
_barScanner.Start();
_state = PickingStateMachine.WaitForBuildingMeterReady;
Thread.Sleep(10000);
@ -1383,7 +1431,7 @@ namespace CordonelAssemblyLine.Model
{
Log(ex.Message);
}
}
}
@ -1392,7 +1440,7 @@ namespace CordonelAssemblyLine.Model
// ReSharper disable once UnusedParameter.Local
private void Log(String v)
{
}
}

View File

@ -31,7 +31,6 @@ namespace CordonelAssemblyLine
private void Window_Loaded(Object sender, RoutedEventArgs e)
{
_model.StartPicking(_globalCancellationToken, _scannerPort, _slotNr);

View File

@ -22,7 +22,7 @@ namespace CordonelAssemblyLine.Properties {
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
@ -36,7 +36,7 @@ namespace CordonelAssemblyLine.Properties {
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CordonelAssemblyLine.Properties.Resources", typeof(Resources).Assembly);
@ -51,7 +51,7 @@ namespace CordonelAssemblyLine.Properties {
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D0C8D887-ED52-40AB-A069-90BCE0E801E2}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xylem.Common.Ui.CordonelPreadjustmentUi</RootNamespace>
<AssemblyName>Xylem.Common.Ui.CordonelPreadjustmentUi</AssemblyName>
@ -128,8 +128,26 @@
<PropertyGroup />
<PropertyGroup />
<PropertyGroup />
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
<PropertyGroup />
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">

View File

@ -45,6 +45,12 @@ namespace Xylem.Common.Ui.CordonelPreadjustmentUi.Parameters
FlowrateQmH = 400;
DurationS = 60;
break;
case MeterSize.US8:
case MeterSize.DN200:
FlowrateQmH = 400;
DurationS = 60;
break;
default:
Message = $"Warning no parameter for meter size {meterSize.GetHashCode()} use default!{Environment.NewLine}";
FlowrateQmH = 40;

View File

@ -58,6 +58,25 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"Read out", meterctl.Slot, "CC");
Thread.Sleep(1000);
try
{
if (meterctl.Meter.GetRegistersDic().Any(a => a.Key.RegisterName == "GENESISFLOW_DelayedLedOff"))
{
meterctl.Meter.WriteRegister("GENESISFLOW_DelayedLedOff", 60 * 60 * 2, true);
meterctl.Meter.WriteLog($"GENESISFLOW_DelayedLedOff to {60 * 60 * 2}S");
}
else
{
meterctl.Meter.WriteLog($"GENESISFLOW_DelayedLedOff is not present");
}
}
catch (Exception ex)
{
meterctl.Meter.WriteLog($"GENESISFLOW_DelayedLedOff got error {ex.Message}");
}
}
else
{
@ -71,33 +90,33 @@ namespace CordonelPreadjustmentUi.Processes.Actions
var readsOk = new List<bool>();
byte[] retByte;
readsOk.Add(ReadRegister(meterctl.Meter, "MeterSize", Register.Genesisflow.MeterSize, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "MeterSize", Register.Genesisflow.MeterSize, out retByte));
meterctl.Meter.calibrationResult.MeterSize = RegisterConverter.ByteArrayToValue<ushort>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "CalFactor1", Register.Genesisflow.CalFactor1, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "CalFactor1", Register.Genesisflow.CalFactor1, out retByte));
meterctl.Meter.calibrationResult.CalFactor1 = RegisterConverter.ByteArrayToValue<uint>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "CalFactor2", Register.Genesisflow.CalFactor2, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "CalFactor2", Register.Genesisflow.CalFactor2, out retByte));
meterctl.Meter.calibrationResult.CalFactor2 = RegisterConverter.ByteArrayToValue<uint>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "CalFactor3", Register.Genesisflow.CalFactor3, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "CalFactor3", Register.Genesisflow.CalFactor3, out retByte));
meterctl.Meter.calibrationResult.CalFactor3 = RegisterConverter.ByteArrayToValue<uint>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "ZeroOffset1", Register.Genesisflow.ZeroOffset1, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "ZeroOffset1", Register.Genesisflow.ZeroOffset1, out retByte));
meterctl.Meter.calibrationResult.ZeroOffset1 = RegisterConverter.ByteArrayToValue<int>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "ZeroOffset2", Register.Genesisflow.ZeroOffset2, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "ZeroOffset2", Register.Genesisflow.ZeroOffset2, out retByte));
meterctl.Meter.calibrationResult.ZeroOffset2 = RegisterConverter.ByteArrayToValue<int>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "ZeroOffset3", Register.Genesisflow.ZeroOffset3, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "ZeroOffset3", Register.Genesisflow.ZeroOffset3, out retByte));
meterctl.Meter.calibrationResult.ZeroOffset3 = RegisterConverter.ByteArrayToValue<int>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "FirstHitUpdatePeriod", Register.Genesisflow.FirstHitUpdatePeriod, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "FirstHitUpdatePeriod", Register.Genesisflow.FirstHitUpdatePeriod, out retByte));
meterctl.Meter.calibrationResult.FirstHitUpdatePeriod = RegisterConverter.ByteArrayToValue<ushort>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "FirstHitShift", Register.Genesisflow.FirstHitShift, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "FirstHitShift", Register.Genesisflow.FirstHitShift, out retByte));
meterctl.Meter.calibrationResult.FirstHitShift = RegisterConverter.ByteArrayToValue<ushort>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "FirstHitPercent1", Register.Genesisflow.FirstHitPercent1, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "FirstHitPercent1", Register.Genesisflow.FirstHitPercent1, out retByte));
meterctl.Meter.calibrationResult.FirstHitPercent1 = RegisterConverter.ByteArrayToValue<ushort>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "FirstHitPercent2", Register.Genesisflow.FirstHitPercent2, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "FirstHitPercent2", Register.Genesisflow.FirstHitPercent2, out retByte));
meterctl.Meter.calibrationResult.FirstHitPercent2 = RegisterConverter.ByteArrayToValue<ushort>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "FirstHitPercent3", Register.Genesisflow.FirstHitPercent3, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "FirstHitPercent3", Register.Genesisflow.FirstHitPercent3, out retByte));
meterctl.Meter.calibrationResult.FirstHitPercent3 = RegisterConverter.ByteArrayToValue<ushort>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "ToFTempOffset1", Register.Genesisflow.ToFTempOffset1, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "ToFTempOffset1", Register.Genesisflow.ToFTempOffset1, out retByte));
meterctl.Meter.calibrationResult.ToFTempOffset1 = RegisterConverter.ByteArrayToValue<int>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "ToFTempOffset2", Register.Genesisflow.ToFTempOffset2, out retByte));
readsOk.Add(ReadRegisterRetry(meterctl.Meter, "ToFTempOffset2", Register.Genesisflow.ToFTempOffset2, out retByte));
meterctl.Meter.calibrationResult.ToFTempOffset2 = RegisterConverter.ByteArrayToValue<int>(retByte);
readsOk.Add(ReadRegister(meterctl.Meter, "ToFTempOffset3", Register.Genesisflow.ToFTempOffset3, out retByte));
meterctl.Meter.calibrationResult.ToFTempOffset3 = RegisterConverter.ByteArrayToValue<int>(retByte);

View File

@ -42,6 +42,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
}
Thread.Sleep(1000);
}
var doneTime = DateTime.UtcNow.AddMinutes(1);
while (DateTime.UtcNow > doneTime)
{ Thread.Sleep(1000); }
return true;
}));

View File

@ -58,7 +58,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
//(pp.Setting.OffsetTestNumberOfLines * number of path) / 1000
//((9000 * 3) / 1000 ) = 27 min
var pataDataActivitCheck = new MultiPathDataLogContainer<int>(pp.Setting.NumberOfPaths);
var MaxTimeoutWarnings = 300;
pataDataActivitCheck.Update(null, -1);
@ -105,7 +105,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
if (MaxTimeoutWarnings <= 0)
{
pp.DebugMessage($"Fatal timeout while collecting data. Please check LED singnal. Has {offsetRecords.Count} from {pp.Setting.OffsetTestNumberOfLines * 3}", meterctl.Slot, "DC", meterctl.Meter.PcbId);
// Ok = false;
// Ok = false;
}
if (CheckAbort(Ok, meterctl)) { return Ok; }
@ -168,7 +168,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
Ok = false;
}
}
if (CheckAbort(Ok, meterctl)) { return Ok; }
@ -197,9 +197,12 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"Average positive amplitude, PATH{(Path + 1)}: {Math.Round(amplitudeValuesMeanUp.Get(Path), 2).ToString("000.00")}mV", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
pp.DebugMessage($"Average negative amplitude, PATH{(Path + 1)}: {Math.Round(amplitudeValuesMeanDown.Get(Path), 2).ToString("000.00")}mV", meterctl.Meter.Slot, "DC", meterctl.Meter.PcbId);
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average positive amplitude PATH { (Path + 1)}", $"{ Math.Round(amplitudeValuesMeanUp.Get(Path), 2).ToString("000.00")}mV");
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average negative amplitude PATH { (Path + 1)}", $"{ Math.Round(amplitudeValuesMeanDown.Get(Path), 2).ToString("000.00")}mV");
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average positive amplitude PATH {(Path + 1)}", $"{Math.Round(amplitudeValuesMeanUp.Get(Path), 2).ToString("000.00")}mV");
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average negative amplitude PATH {(Path + 1)}", $"{Math.Round(amplitudeValuesMeanDown.Get(Path), 2).ToString("000.00")}mV");
if (pp.Setting.MeterSize == Xylem.Common.Logic.ProductionOrderCore.OrderData.MeterSize.DN200 || pp.Setting.MeterSize == Xylem.Common.Logic.ProductionOrderCore.OrderData.MeterSize.US8)
{
pp.Setting.OffsetTestLowerVoltageLimitMV = 180;
}
if ((amplitudeValuesMeanUp.Get(Path) > pp.Setting.OffsetTestUpperVoltageLimitMV) ||
(amplitudeValuesMeanUp.Get(Path) < pp.Setting.OffsetTestLowerVoltageLimitMV) ||
(amplitudeValuesMeanDown.Get(Path) < pp.Setting.OffsetTestLowerVoltageLimitMV) ||
@ -209,9 +212,9 @@ namespace CordonelPreadjustmentUi.Processes.Actions
pp.DebugMessage($"Amplitude check failed!", meterctl.Meter.Slot, "APP", meterctl.Meter.PcbId);
}
pp.DebugMessage($"Average delta time of flight valuePATH{(Path + 1)}: Raw{DeltaTimeOfFlightAverage.Get(Path)} -> in picoseconds= { Math.Round((DeltaTimeOfFlightAverage.Get(Path) / (Math.Pow(2, 38) * Math.Pow(10, 12))), 2).ToString("000.00")}", meterctl.Meter.Slot, "APP", meterctl.Meter.PcbId);
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average delta time of flight value PATH { (Path + 1)} RAW ", $"{DeltaTimeOfFlightAverage.Get(Path)}");
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average delta time of flight value PATH { (Path + 1)} picoseconds ", $"{Math.Round((DeltaTimeOfFlightAverage.Get(Path) / (Math.Pow(2, 38) * Math.Pow(10, 12))), 2).ToString("000.00")}");
pp.DebugMessage($"Average delta time of flight valuePATH{(Path + 1)}: Raw{DeltaTimeOfFlightAverage.Get(Path)} -> in picoseconds= {Math.Round((DeltaTimeOfFlightAverage.Get(Path) / (Math.Pow(2, 38) * Math.Pow(10, 12))), 2).ToString("000.00")}", meterctl.Meter.Slot, "APP", meterctl.Meter.PcbId);
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average delta time of flight value PATH {(Path + 1)} RAW ", $"{DeltaTimeOfFlightAverage.Get(Path)}");
meterctl.Meter.calibrationResult.AddAdditionalLog($"Offset Average delta time of flight value PATH {(Path + 1)} picoseconds ", $"{Math.Round((DeltaTimeOfFlightAverage.Get(Path) / (Math.Pow(2, 38) * Math.Pow(10, 12))), 2).ToString("000.00")}");
if ((DeltaTimeOfFlightAverage.Get(Path) > pp.Setting.OffsetTestOffsetLimitPS) ||
(DeltaTimeOfFlightAverage.Get(Path) < -pp.Setting.OffsetTestOffsetLimitPS))
@ -233,7 +236,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
{
if (CheckAbort(false, meterctl)) { return false; }
}
}
Ok = meterctl.Meter.ReLogin();
@ -270,7 +273,7 @@ namespace CordonelPreadjustmentUi.Processes.Actions
Ok = WriteRegisterSafe(meterctl.Meter, $"Zero flow offset Path {Path + 1}", RegValue, OffsetValue);
Ok = true;
}
}
return Ok;
}));

View File

@ -7,10 +7,10 @@ using CordonelPreadjustmentUi.Processes.Itinerary;
using System.Threading;
using static CordonelPreadjustmentUi.PreAdjustmentControl;
using System.Threading.Tasks;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.CommonCore.Configuration;
using Newtonsoft.Json;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace CordonelPreadjustmentUi.Processes.Actions
{
@ -122,9 +122,21 @@ namespace CordonelPreadjustmentUi.Processes.Actions
var r = LocalWebRequest.GetRequest($"{ ServiceUrls.GenesisFinalCheckServiceUrl()}GetMetersizeProgrammingData?MeterSize={pp.Setting.MeterSize.GetHashCode()}", 2000);
var dt = JsonConvert.DeserializeObject<Dictionary<string, UInt32>>(r);
try
{
if (meterctl.Meter.GetRegistersDic().Any(a => a.Key.RegisterName == "GENESISFLOW_DelayedLedOff"))
{
Ok = WriteRegisterSafe(meterctl.Meter, "ledDelay", "GENESISFLOW_DelayedLedOff", 60 * 60 * 2, false);
if (CheckAbort(Ok, meterctl)) { return Ok; }
}
}
catch (Exception)
{
//Ok = WriteRegisterSafe(meterctl.Meter, "ledDelay", "GENESISFLOW_DelayedLedOff", 60 * 60* 2, false);
//if (CheckAbort(Ok, meterctl)) { return Ok; }
}
foreach (var item in dt)

View File

@ -7,10 +7,11 @@ using CordonelPreadjustmentUi.Processes.Itinerary;
using System.Threading;
using static CordonelPreadjustmentUi.PreAdjustmentControl;
using System.Threading.Tasks;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Logic.SoftwareAccessHelper;
using Xylem.Common.CommonCore.Configuration;
using Newtonsoft.Json;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
namespace CordonelPreadjustmentUi.Processes.Actions
{

View File

@ -321,7 +321,17 @@ namespace CordonelPreadjustmentUi.Processes
return false;
}
public bool ReadRegisterRetry(ZeroFlowGenesisMeter m, string displayName, string registerName, out byte[] ret)
{
var retRet = ReadRegister(m, displayName, registerName, out byte[] rr);
if (!retRet)
{
retRet = ReadRegister(m, displayName, registerName, out rr);
}
ret = rr;
return retRet;
}
public bool ReadRegister(ZeroFlowGenesisMeter m, string displayName, string registerName, out byte[] ret)
{
Thread.Sleep(100);

View File

@ -59,6 +59,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
<HintPath>..\..\packages\BouncyCastle.Crypto.dll.1.8.1\lib\BouncyCastle.Crypto.dll</HintPath>

View File

@ -31,6 +31,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<NoWarn>IDE0003;IDE0011;IDE0049;IDE1005;</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -55,7 +65,6 @@
<Compile Include="Parameters\SirtOperating.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SIRTBroadcaster.cs" />
<Compile Include="SIRTChannel.cs" />
<Compile Include="SIRTConstants.cs" />
<Compile Include="SIRTExtensions.cs" />
<Compile Include="SIRTHub.cs" />

View File

@ -53,9 +53,9 @@
}
public static implicit operator byte(BluetoothOperating param)
=> param.bits.GetByteLE();
=> param.bits.GetByte();
public static implicit operator BluetoothOperating(byte _byte)
=> new BluetoothOperating(_byte.GetBitsLE());
=> new BluetoothOperating(_byte.GetBits());
}
}

View File

@ -13,7 +13,7 @@
public P11() => this.bits = new byte[8];
public P11(byte p11) => this.bits = p11.GetBitsLE();
public P11(byte p11) => this.bits = p11.GetBits();
public P11(byte[] bits) => this.bits = bits;
@ -189,12 +189,12 @@
}
public static implicit operator byte(P11 p11)
=> p11.bits.GetByteLE();
=> p11.bits.GetByte();
public static implicit operator string(P11 p11)
=> p11.ToString();
public static implicit operator P11(byte _byte)
=> new P11(_byte.GetBitsLE());
=> new P11(_byte.GetBits());
}
}

View File

@ -16,7 +16,7 @@
public P12() => this.bits = new byte[8];
public P12(byte p12) => this.bits = p12.GetBitsLE();
public P12(byte p12) => this.bits = p12.GetBits();
public P12(byte[] bits) => this.bits = bits;
@ -203,12 +203,12 @@
}
public static implicit operator byte(P12 p11)
=> p11.bits.GetByteLE();
=> p11.bits.GetByte();
public static implicit operator string(P12 p11)
=> p11.ToString();
public static implicit operator P12(byte _byte)
=> new P12(_byte.GetBitsLE());
=> new P12(_byte.GetBits());
}
}

View File

@ -231,9 +231,9 @@
}
public static implicit operator byte(P811 param)
=> param.bits.GetByteLE();
=> param.bits.GetByte();
public static implicit operator P811(byte _byte)
=> new P811(_byte.GetBitsLE());
=> new P811(_byte.GetBits());
}
}

View File

@ -6,7 +6,7 @@
public P821() => this.bits = new byte[8];
public P821(byte p12) => this.bits = p12.GetBitsLE();
public P821(byte p12) => this.bits = p12.GetBits();
public P821(byte[] bits) => this.bits = bits;
@ -17,12 +17,12 @@
}
public static implicit operator byte(P821 p11)
=> p11.bits.GetByteLE();
=> p11.bits.GetByte();
public static implicit operator string(P821 p11)
=> p11.ToString();
public static implicit operator P821(byte _byte)
=> new P821(_byte.GetBitsLE());
=> new P821(_byte.GetBits());
}
}

View File

@ -1,11 +1,16 @@
namespace Common.Hardware.SIRT.Parameters
using System.Text;
namespace Common.Hardware.SIRT.Parameters
{
public class PAMStatus
{
private readonly byte[] bits;
public PAMStatus(byte _byte)
=> this.bits = _byte.GetBitsLE();
{
this.IsValid = _byte <= 31;
this.bits = _byte.GetBits();
}
public bool CMD_UNKNOWN => this.bits[0] == 1;
@ -17,13 +22,15 @@
public bool OUT_OF_RANGE => this.bits[4] == 1;
public bool IsValid { get; }
public override string ToString()
{
if (this.bits.GetByteLE() == 0)
if (this.bits.GetByte() == 0)
{
return nameof(OK);
}
if (this.OUT_OF_RANGE)
else if (this.OUT_OF_RANGE)
{
return nameof(this.OUT_OF_RANGE);
}
@ -49,12 +56,44 @@
}
}
public string ToString(bool extended)
{
var stringBuilder = new StringBuilder();
if (this.bits.GetByte() == 0)
{
stringBuilder.AppendLine(nameof(OK));
}
if (this.OUT_OF_RANGE)
{
stringBuilder.AppendLine(nameof(this.OUT_OF_RANGE));
}
if (this.MIXED_TYPES)
{
stringBuilder.AppendLine(nameof(this.MIXED_TYPES));
}
if (this.CMD_UNKNOWN)
{
stringBuilder.AppendLine(nameof(this.CMD_UNKNOWN));
}
if (this.EXPIRED_AUTH)
{
stringBuilder.AppendLine(nameof(this.EXPIRED_AUTH));
}
if (this.WRONG_AUTH)
{
stringBuilder.AppendLine(nameof(this.WRONG_AUTH));
}
return stringBuilder.ToString().Trim();
}
public static byte OK = 0;
public static byte EXPIREDAUTH = 4;
public static implicit operator byte(PAMStatus status)
=> status?.bits?.GetByteLE() ?? 0xFF;
=> status?.bits?.GetByte() ?? 0xFF;
public static implicit operator string(PAMStatus status)
=> status?.ToString();

View File

@ -21,11 +21,11 @@
Array.Copy(this.bits, 0, bits, 0, 4);
return (OperatingModes)bits.GetByteLE();
return (OperatingModes)bits.GetByte();
}
set
{
var bits = ((byte)value).GetBitsLE();
var bits = ((byte)value).GetBits();
Array.Copy(bits, 0, this.bits, 0, 4);
}
@ -68,9 +68,9 @@
}
public static implicit operator byte(RFModuleOperating param)
=> param.bits.GetByteLE();
=> param.bits.GetByte();
public static implicit operator RFModuleOperating(byte _byte)
=> new RFModuleOperating(_byte.GetBitsLE());
=> new RFModuleOperating(_byte.GetBits());
}
}

View File

@ -4,6 +4,8 @@
{
public RSSI(byte value, int mhz)
{
this.Value = value;
if (mhz == 433)
{
this.Dbm = value * 0.5 - 140;
@ -25,6 +27,8 @@
}
}
public byte Value { get; }
public double Dbm { get; }
public double Percent { get; }

View File

@ -126,9 +126,9 @@
}
public static implicit operator byte(SirtOperating param)
=> param.bits.GetByteLE();
=> param.bits.GetByte();
public static implicit operator SirtOperating(byte _byte)
=> new SirtOperating(_byte.GetBitsLE());
=> new SirtOperating(_byte.GetBits());
}
}

View File

@ -4,36 +4,24 @@
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
public class SIRTBroadcaster
{
private readonly ConcurrentDictionary<uint, SIRTTask> tasks;
private readonly ConcurrentDictionary<byte, uint> pampool;
private readonly SIRTStream sirtStream;
public string AdddressesInPamPool()
{
return string.Join("\t", this.pampool.Values);
}
private readonly bool log_RX_TX;
private CancellationTokenSource cancellationTokenSource;
private CancellationToken cancellationToken;
private Task receiveStream;
private Task pampoolStream;
public SIRTBroadcaster(string portName)
public SIRTBroadcaster(string portName, bool log_RX_TX = true)
{
this.sirtStream = new SIRTStream(portName);
this.pampool = new ConcurrentDictionary<byte, uint>();
_ = this.pampool.GetOrAdd(0, 0);
_ = this.pampool.GetOrAdd(0, 0);
_ = this.pampool.GetOrAdd(0, 0);
_ = this.pampool.GetOrAdd(0, 0);
_ = this.pampool.GetOrAdd(0, 0);
this.tasks = new ConcurrentDictionary<uint, SIRTTask>();
this.sirtStream = new SIRTStream(portName, false);
this.log_RX_TX = log_RX_TX;
this.Id = "00-00-00-00-00-00-00-00";
}
public event Action<SIRTBroadcaster> Connected;
@ -52,28 +40,25 @@
{
this.sirtStream.Close();
void Try(Action action)
try
{
try
{
action();
}
catch (Exception e)
{
SIRTLogger.LogMessage(e);
}
this.tasks.Clear();
}
catch (Exception e)
{
this.LogMessage(e);
}
Try(this.tasks.Clear);
Try(this.pampool.Clear);
Try(this.cancellationTokenSource.Cancel);
var disconnectedEvent = this.Disconnected;
if (disconnectedEvent != null)
try
{
disconnectedEvent?.Invoke(this);
this.cancellationTokenSource.Cancel();
}
catch (Exception e)
{
this.LogMessage(e);
}
this.Disconnected?.Invoke(this);
}
public void Open()
@ -84,33 +69,24 @@
{
this.cancellationTokenSource = new CancellationTokenSource();
this.cancellationToken = this.cancellationTokenSource.Token;
this.receiveStream = Task.Factory
_ = Task.Factory
.StartNew(this.ReceiveAsync, this.cancellationToken)
.ContinueWith(this.LogContinuationError);
SIRTLogger.LogState("Activating SIRT");
this.LogMessage("Activating SIRT ...");
if (this.TryActivate(out var id, out var frequency))
{
this.Id = id;
this.Frequency = frequency;
this.pampoolStream = Task.Factory
.StartNew(this.PampoolAsync, this.cancellationToken)
.ContinueWith(this.LogContinuationError);
var connectedEvent = this.Connected;
if (connectedEvent != null)
{
connectedEvent?.Invoke(this);
}
SIRTLogger.LogState($"Activated: {frequency} - {id}");
this.Connected?.Invoke(this);
this.LogMessage("Activated");
}
else
{
this.Close();
SIRTLogger.LogState("Activation failed");
this.LogMessage("Activation failed!");
}
}
}
@ -122,27 +98,19 @@
{
if (task.Frequency == this.Frequency)
{
var address = task.RequestAddress;
var addresses = this.pampool.Values.ToList();
task.SirtId = this.Id;
task = this.tasks.AddOrUpdate(task.RequestAddress, addr => task, (addr, oldTask) => task);
task = this.tasks.AddOrUpdate(task.ResponseAddress, addr => task, (addr, oldTask) => task);
var bytes = task.Start();
if (addresses.Any(x => x == 0 || x == address))
{
var bytes = this.tasks
.AddOrUpdate(address, addr => task, (addr, oldTask) => task)
.Start();
this.sirtStream.Write(bytes);
SIRTLogger.LogMessage($"{this.PortName}|TX: {BitConverter.ToString(bytes)}");
this.sirtStream.Write(bytes);
return true;
}
else
if (this.log_RX_TX)
{
SIRTLogger.LogMessage($"{this.PortName}|PP: {string.Join(", ", addresses)}");
this.LogMessage(task);
}
}
else
{
SIRTLogger.LogMessage($"{this.PortName}|RF: {task.RequestAddress} -> {task.Frequency} != {this.Frequency}");
return true;
}
return false;
@ -152,68 +120,50 @@
{
if (task?.Exception != null)
{
SIRTLogger.LogState(task.Exception);
}
}
private async Task PampoolAsync()
{
var task = new ReadPampoolTask(this.Frequency);
var addresses = task.Addresses;
var addressesCount = addresses.Length;
this.pampool.Clear();
for (byte i = 0; i < addressesCount; i++)
{
this.pampool.AddOrUpdate(i, addresses[i], (ix, addr) => addresses[i]);
}
while (this.IsOpen)
{
this.Start(task);
task.Wait();
addresses = task.Addresses;
for (byte i = 0; i < addressesCount; i++)
{
this.pampool.AddOrUpdate(i, addresses[i], (ix, addr) => addresses[i]);
}
await Task.Delay(3000);
this.LogMessage(task.Exception);
}
}
private void ReceiveAsync()
{
SIRTLogger.LogState("Message receiving started");
this.LogMessage($"Message receiving started!");
var cancellationToken = this.cancellationToken;
var messageReceivedEvent = this.MessageReceived;
foreach (SIRTMessage message in this.sirtStream.Read())
foreach (SIRTMessage message in this.sirtStream.ReadMessages())
{
message.Timestamp = DateTimeOffset.UtcNow;
message.Frequency = this.Frequency;
message.SirtId = this.Id;
this.MessageReceived?.Invoke(message);
if (this.tasks.TryGetValue(message.Address, out var task))
{
task?.Push(message);
task.Receive(message);
if (task.State == SIRTTaskState.Completed || task.State == SIRTTaskState.Cancelled)
{
this.tasks.TryRemove(task.RequestAddress, out _);
this.tasks.TryRemove(task.ResponseAddress, out _);
}
}
if (messageReceivedEvent != null)
if (this.log_RX_TX)
{
messageReceivedEvent(message);
this.LogMessage(message);
}
SIRTLogger.LogMessage($"{this.PortName}|RX: {BitConverter.ToString(message)}");
cancellationToken.ThrowIfCancellationRequested();
if (cancellationToken.IsCancellationRequested)
{
break;
}
}
SIRTLogger.LogState("Message receiving stopped");
this.LogMessage($"Message receiving stopped!");
}
private void LogMessage(object message)
=> SIRTLogger.LogMessage($"{this.PortName}|{nameof(SIRTBroadcaster)}|{message}");
}
}

View File

@ -1,20 +0,0 @@
namespace Common.Hardware.SIRT
{
using Common.Hardware.SIRT.Tasks;
using System;
public class SIRTChannel
{
public event Action<SIRTMessage> MessageReceived;
public uint RequestAddress { get; set; }
public uint ResponseAddress { get; set; }
public Action<SIRTTask> WriteHandler { get; set; }
internal void Enqueue(SIRTMessage message)
=> this.MessageReceived?.Invoke(message);
}
}

View File

@ -20,12 +20,14 @@
public const byte LEN_IX = 8;
public const byte DATA_IX = 9;
public static byte AKN_ANS = 0x12;
public static byte FROM_AIR = 0x11;
public const byte ACKN_ANSW = 0x12;
public const byte FROM_AIR = 0x11;
public static byte LAT = 0x01;
public static byte BUP = 0x00;
public static byte DEBUG = 0x0B;
public static byte SEMI = 0x08;
public const byte LAT = 0x01;
public const byte BUP = 0x00;
public const byte DEBUG = 0x0B;
public const byte SEMI = 0x08;
public const byte ENC_KEY_LEN = 16;
}
}

View File

@ -1,6 +1,5 @@
namespace Common.Hardware.SIRT
{
using Common.Hardware.SIRT.Parameters;
using Common.Hardware.SIRT.Tasks;
using System;
@ -19,19 +18,7 @@
private const int Int64Size = 64;
private const int UInt64Size = 64;
public static byte[] GetBitsBE(this byte value)
{
var bits = new byte[ByteSize];
for (int i = 7, x = 0; i >= 0; i--, x++)
{
bits[x] = (byte)((value >> i) & 1);
}
return bits;
}
public static byte[] GetBitsLE(this byte value)
public static byte[] GetBits(this byte value)
{
var bits = new byte[ByteSize];
@ -43,7 +30,7 @@
return bits;
}
public static byte[] GetBitsLE(this ushort value)
public static byte[] GetBits(this ushort value)
{
var bits = new byte[UInt16Size];
@ -55,7 +42,7 @@
return bits;
}
public static byte GetByteLE(this byte[] bits)
public static byte GetByte(this byte[] bits)
{
if (bits is null)
{
@ -66,13 +53,13 @@
for (var i = 0; i < ByteSize; i++)
{
value ^= (byte)(bits[i] << i);
value |= (byte)(bits[i] << i);
}
return value;
}
public static byte GetByteLE(this byte[] bits, int start = 0, int count = 0)
public static byte GetByte(this byte[] bits, int start = 0, int count = 0)
{
if (bits is null)
{
@ -89,13 +76,13 @@
for (int i = start, x = 0; i < length; i++, x++)
{
_byte ^= (byte)(bits[i] << x);
_byte |= (byte)(bits[i] << x);
}
return _byte;
}
public static void SetBitsLE(this byte value, byte[] bits, int start = 0, int count = 0)
public static void SetBits(this byte value, byte[] bits, int start = 0, int count = 0)
{
if (bits is null)
{
@ -113,29 +100,7 @@
}
}
public static byte[] GetBytesBE(this sbyte value)
{
var bytes = new byte[2];
var index = 0;
bytes[index++] = (byte)(value >> 8);
bytes[index] = (byte)value;
return bytes;
}
public static byte[] GetBytesBE(this short value)
{
var bytes = new byte[2];
var index = 0;
bytes[index++] = (byte)(value >> 8);
bytes[index] = (byte)value;
return bytes;
}
public static byte[] GetBytesBE(this int value)
public static byte[] GetBytes(this int value)
{
var bytes = new byte[4];
var index = 0;
@ -148,24 +113,7 @@
return bytes;
}
public static byte[] GetBytesBE(this long value)
{
var bytes = new byte[8];
var index = 0;
bytes[index++] = (byte)(value >> 56);
bytes[index++] = (byte)(value >> 48);
bytes[index++] = (byte)(value >> 40);
bytes[index++] = (byte)(value >> 32);
bytes[index++] = (byte)(value >> 24);
bytes[index++] = (byte)(value >> 16);
bytes[index++] = (byte)(value >> 8);
bytes[index] = (byte)value;
return bytes;
}
public static byte[] GetBytesBE(this ushort value)
public static byte[] GetBytes(this ushort value)
{
var bytes = new byte[2];
var index = 0;
@ -189,99 +137,6 @@
return bytes;
}
public static byte[] GetBytesBE(this ulong value)
{
var bytes = new byte[8];
var index = 0;
bytes[index++] = (byte)(value >> 56);
bytes[index++] = (byte)(value >> 48);
bytes[index++] = (byte)(value >> 40);
bytes[index++] = (byte)(value >> 32);
bytes[index++] = (byte)(value >> 24);
bytes[index++] = (byte)(value >> 16);
bytes[index++] = (byte)(value >> 8);
bytes[index] = (byte)value;
return bytes;
}
public static byte[] GetBytesLE(this sbyte value)
{
var bytes = new byte[2];
var index = 0;
bytes[index++] = (byte)value;
bytes[index] = (byte)(value >> 8);
return bytes;
}
public static byte[] GetBytesLE(this short value)
{
var bytes = new byte[2];
var index = 0;
bytes[index++] = (byte)value;
bytes[index] = (byte)(value >> 8);
return bytes;
}
public static byte[] GetBytesLE(this int value)
{
var bytes = new byte[4];
var index = 0;
bytes[index++] = (byte)value;
bytes[index++] = (byte)(value >> 8);
bytes[index++] = (byte)(value >> 16);
bytes[index] = (byte)(value >> 24);
return bytes;
}
public static byte[] GetBytesLE(this long value)
{
var bytes = new byte[8];
var index = 0;
bytes[index++] = (byte)value;
bytes[index++] = (byte)(value >> 8);
bytes[index++] = (byte)(value >> 16);
bytes[index++] = (byte)(value >> 24);
bytes[index++] = (byte)(value >> 32);
bytes[index++] = (byte)(value >> 40);
bytes[index++] = (byte)(value >> 48);
bytes[index] = (byte)(value >> 56);
return bytes;
}
public static byte[] GetBytesLE(this ushort value)
{
var bytes = new byte[2];
var index = 0;
bytes[index++] = (byte)value;
bytes[index] = (byte)(value >> 8);
return bytes;
}
public static byte[] GetBytesLE(this uint value)
{
var bytes = new byte[4];
var index = 0;
bytes[index++] = (byte)value;
bytes[index++] = (byte)(value >> 8);
bytes[index++] = (byte)(value >> 16);
bytes[index] = (byte)(value >> 24);
return bytes;
}
public static byte[] GetBytesLE(this ulong value)
{
var bytes = new byte[8];
@ -303,18 +158,8 @@
{
var value = default(sbyte);
value ^= (sbyte)(bytes[start++] << 8);
value ^= (sbyte)bytes[start];
return value;
}
public static short ToInt16BE(this byte[] bytes, int start = 0)
{
var value = default(short);
value ^= (short)(bytes[start++] << 8);
value ^= bytes[start];
value |= (sbyte)(bytes[start++] << 8);
value |= (sbyte)bytes[start];
return value;
}
@ -323,26 +168,10 @@
{
var value = default(int);
value ^= bytes[start++] << 24;
value ^= bytes[start++] << 16;
value ^= bytes[start++] << 8;
value ^= bytes[start];
return value;
}
public static long ToInt64BE(this byte[] bytes, int start = 0)
{
var value = default(long);
value ^= bytes[start++] << 56;
value ^= bytes[start++] << 48;
value ^= bytes[start++] << 40;
value ^= bytes[start++] << 32;
value ^= bytes[start++] << 24;
value ^= bytes[start++] << 16;
value ^= bytes[start++] << 8;
value ^= bytes[start];
value |= bytes[start++] << 24;
value |= bytes[start++] << 16;
value |= bytes[start++] << 8;
value |= bytes[start];
return value;
}
@ -351,8 +180,8 @@
{
var value = default(ushort);
value ^= (ushort)(bytes[start++] << 8);
value ^= bytes[start];
value |= (ushort)(bytes[start++] << 8);
value |= bytes[start];
return value;
}
@ -361,74 +190,10 @@
{
var value = default(uint);
value ^= (uint)(bytes[start++] << 24);
value ^= (uint)(bytes[start++] << 16);
value ^= (uint)(bytes[start++] << 8);
value ^= bytes[start];
return value;
}
public static ulong ToUInt64BE(this byte[] bytes, int start = 0)
{
var value = default(ulong);
value ^= (ulong)(bytes[start++] << 56);
value ^= (ulong)(bytes[start++] << 48);
value ^= (ulong)(bytes[start++] << 40);
value ^= (ulong)(bytes[start++] << 32);
value ^= (ulong)(bytes[start++] << 24);
value ^= (ulong)(bytes[start++] << 16);
value ^= (ulong)(bytes[start++] << 8);
value ^= bytes[start];
return value;
}
public static sbyte ToSByteLE(this byte[] bytes, int start = 0)
{
var value = default(sbyte);
value ^= (sbyte)bytes[start++];
value ^= (sbyte)(bytes[start] << 8);
return value;
}
public static short ToInt16LE(this byte[] bytes, int start = 0)
{
var value = default(short);
value ^= bytes[start++];
value ^= (short)(bytes[start] << 8);
return value;
}
public static int ToInt32LE(this byte[] bytes, int start = 0)
{
var value = default(int);
value ^= bytes[start++];
value ^= bytes[start++] << 8;
value ^= bytes[start++] << 16;
value ^= bytes[start] << 24;
return value;
}
public static long ToInt64LE(this byte[] bytes, int start = 0)
{
var value = default(long);
value ^= bytes[start++];
value ^= bytes[start++] << 8;
value ^= bytes[start++] << 16;
value ^= bytes[start++] << 24;
value ^= bytes[start++] << 32;
value ^= bytes[start++] << 40;
value ^= bytes[start++] << 48;
value ^= bytes[start] << 56;
value |= (uint)(bytes[start++] << 24);
value |= (uint)(bytes[start++] << 16);
value |= (uint)(bytes[start++] << 8);
value |= bytes[start];
return value;
}
@ -437,8 +202,8 @@
{
var value = default(ushort);
value ^= bytes[start++];
value ^= (ushort)(bytes[start] << 8);
value |= bytes[start++];
value |= (ushort)(bytes[start] << 8);
return value;
}
@ -456,42 +221,19 @@
for (var i = 0; i < UInt16Size; i++)
{
value ^= (ushort)(bits[i] << i);
value |= (ushort)(bits[i] << i);
}
return value;
}
public static uint ToUInt32LE(this byte[] bytes, int start = 0)
{
var value = default(uint);
value ^= bytes[start++];
value ^= (uint)(bytes[start++] << 8);
value ^= (uint)(bytes[start++] << 16);
value ^= (uint)(bytes[start] << 24);
return value;
}
public static ulong ToUInt64LE(this byte[] bytes, int start = 0)
{
var value = default(ulong);
value ^= bytes[start++];
value ^= (ulong)(bytes[start++] << 8);
value ^= (ulong)(bytes[start++] << 16);
value ^= (ulong)(bytes[start++] << 24);
value ^= (ulong)(bytes[start++] << 32);
value ^= (ulong)(bytes[start++] << 40);
value ^= (ulong)(bytes[start++] << 48);
value ^= (ulong)(bytes[start] << 56);
return value;
}
public static ushort CRCCCITT(this byte[] bytes, int start = 0, int length = 0)
{
if (bytes.Length <= 0)
{
return default(ushort);
}
if (length == 0)
{
length = bytes.Length;
@ -523,6 +265,7 @@
return crc;
}
public static byte[] GetBytes(this string hexString)
{
var bytes = new List<byte>();
@ -588,21 +331,35 @@
var value = default(uint);
var _index = index;
value ^= (uint)(bytes[_index++] << 24);
value ^= (uint)(bytes[_index++] << 16);
value ^= (uint)(bytes[_index++] << 8);
value ^= bytes[_index];
value |= (uint)(bytes[_index++] << 24);
value |= (uint)(bytes[_index++] << 16);
value |= (uint)(bytes[_index++] << 8);
value |= bytes[_index];
return value;
}
public static ushort GetCrc(this byte[] bytes, int index)
public static ushort GetCrc(this byte[] bytes, int index = -1)
{
var value = default(ushort);
var _index = index;
value ^= (ushort)(bytes[_index++] << 8);
value ^= bytes[_index];
if (bytes != null)
{
var length = bytes.Length;
if (index < 0)
{
index = length - 2;
}
var _index = index;
if (_index >= 0)
{
value ^= (ushort)(bytes[_index++] << 8);
value ^= bytes[_index];
}
}
return value;
}
@ -635,7 +392,7 @@
task = new ActivateSIRTTask();
for (var i = 0; i < 3 && task.State != SIRTTaskState.Completed; i++)
for (var i = 0; i < 3 && !done; i++)
{
broadcaster.Start(task);
task.Wait();
@ -651,7 +408,7 @@
done = false;
task = new IdentifySIRTTask();
for (var i = 0; i < 3 && task.State != SIRTTaskState.Completed; i++)
for (var i = 0; i < 3 && !done; i++)
{
broadcaster.Start(task);
task.Wait();
@ -667,5 +424,89 @@
return done;
}
public static byte[] DecryptResponse(this byte[] encryptedData, byte[] encryptionKey)
{
if (encryptionKey?.Length != 16)
{
return encryptedData;
}
var length = encryptedData?.Length ?? 0;
if (length == 0)
{
return encryptedData;
}
var decryptedData = new byte[length];
Array.Copy(encryptedData, 0, decryptedData, 0, length);
var token = decryptedData[1];
for (var x = 6; x < length; x++)
{
token += (byte)(decryptedData[x - (token & 0x3) - 1] >> ((token >> 6) & 0x1));
decryptedData[x] ^= encryptionKey[(token >> 2) & 0x0F];
if (token >= 0x80)
{
decryptedData[x] = (byte)~decryptedData[x];
}
}
return decryptedData;
}
public static byte[] EncryptRequest(this byte[] plainData, byte[] encryptionKey, uint address)
{
if (plainData?.Length <= 0 || encryptionKey?.Length != 16 || address <= 0)
{
return plainData;
}
var dataLength = plainData.Length;
var telegramLength = dataLength + 2;
var encryptedData = new byte[telegramLength];
Array.Copy(plainData, 0, encryptedData, 0, dataLength);
var telegramForCRCLength = telegramLength + 4;
var telegramForCRC = new byte[telegramForCRCLength];
telegramForCRC[0] = (byte)(address >> 24);
telegramForCRC[1] = (byte)(address >> 16);
telegramForCRC[2] = (byte)(address >> 8);
telegramForCRC[3] = (byte)(address >> 0);
Array.Copy(encryptedData, 0, telegramForCRC, 4, telegramLength);
var telegramCRC = telegramForCRC.CRCCCITT(1, telegramForCRCLength - 2);
encryptedData[telegramLength - 2] = (byte)(telegramCRC >> 8);
encryptedData[telegramLength - 1] = (byte)(telegramCRC >> 0);
var reference = address;
var token = (byte)0xFF;
for (var i = 0; i < telegramLength; i++)
{
token += (byte)(((reference >> ((token & 0x3) << 3)) & 0xFF) >> ((token >> 6) & 1));
reference <<= 8;
reference += encryptedData[i];
encryptedData[i] ^= encryptionKey[(token >> 2) & 0x0F];
if (token >= 0x80)
{
encryptedData[i] = (byte)~encryptedData[i];
}
}
return encryptedData;
}
}
}

View File

@ -4,41 +4,71 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
public class SIRTHub
{
private static readonly ConcurrentDictionary<string, SIRTBroadcaster> broadcasters
= new ConcurrentDictionary<string, SIRTBroadcaster>();
private static readonly ConcurrentDictionary<string, SIRTBroadcaster> broadcasters = new ConcurrentDictionary<string, SIRTBroadcaster>();
private static List<Action<SIRTMessage>> messageReceiveDelegates = new List<Action<SIRTMessage>>();
private readonly bool log_RX_TX;
public SIRTHub(bool log_RX_TX = true)
=> this.log_RX_TX = log_RX_TX;
public event Action<SIRTBroadcaster> Connected;
public event Action<SIRTBroadcaster> Disconnected;
public event Action<object> StateLogging;
public event Action<SIRTMessage> MessageProcessed;
public void CloseAll()
{
foreach (var broadcaster in broadcasters.Values.ToArray())
{
try
{
this.Close(broadcaster.PortName);
}
catch (Exception e)
{
this.LogMessage(e);
}
}
try
{
broadcasters.Clear();
}
catch (Exception e)
{
this.LogMessage(e);
}
}
public void Close(string portName)
{
if (broadcasters.TryRemove(portName, out var sirtBroadcaster))
if (broadcasters.TryRemove(portName, out var broadcaster))
{
var disconnectedEvent = new ManualResetEventSlim();
void SIRTBroadcaster_Disconnected(SIRTBroadcaster _sirtBroadcaster)
void SIRTBroadcaster_Disconnected(SIRTBroadcaster _broadcaster)
{
disconnectedEvent.Set();
foreach (var @delegate in messageReceiveDelegates)
{
broadcaster.MessageReceived -= @delegate;
}
this.Disconnected?.Invoke(_sirtBroadcaster);
this.Disconnected?.Invoke(_broadcaster);
disconnectedEvent.Set();
}
sirtBroadcaster.Disconnected += SIRTBroadcaster_Disconnected;
broadcaster.Disconnected += SIRTBroadcaster_Disconnected;
sirtBroadcaster.Close();
broadcaster.Close();
disconnectedEvent.Wait(3000);
sirtBroadcaster.Disconnected -= SIRTBroadcaster_Disconnected;
sirtBroadcaster.MessageReceived -= this.Invoke_MessageProcessed;
broadcaster.Disconnected -= SIRTBroadcaster_Disconnected;
}
}
@ -65,62 +95,50 @@
frequency = default(int);
var connectedEvent = new ManualResetEventSlim();
var sirtBroadcaster = new SIRTBroadcaster(portName);
var broadcaster = new SIRTBroadcaster(portName, this.log_RX_TX);
void SIRTBroadcasterConnected(SIRTBroadcaster _)
void SIRTBroadcasterConnected(SIRTBroadcaster _broadcaster)
{
broadcasters.GetOrAdd(portName, sirtBroadcaster);
connectedEvent.Set();
broadcasters.GetOrAdd(portName, _broadcaster);
this.Connected?.Invoke(sirtBroadcaster);
}
void SIRTBroadcasterDisconnected(SIRTBroadcaster _)
{
connectedEvent.Set();
this.Disconnected?.Invoke(sirtBroadcaster);
}
sirtBroadcaster.Connected += SIRTBroadcasterConnected;
sirtBroadcaster.Disconnected += SIRTBroadcasterDisconnected;
sirtBroadcaster.Open();
connectedEvent.Wait(3000);
hexId = sirtBroadcaster.Id;
frequency = sirtBroadcaster.Frequency;
sirtBroadcaster.Connected -= SIRTBroadcasterConnected;
sirtBroadcaster.Disconnected -= SIRTBroadcasterDisconnected;
sirtBroadcaster.MessageReceived += this.Invoke_MessageProcessed;
return sirtBroadcaster.IsOpen;
}
public void Stop()
{
try
{
foreach (var broadcaster in broadcasters.Values.ToList())
foreach (var @delegate in messageReceiveDelegates)
{
broadcaster.Close();
_broadcaster.MessageReceived += @delegate;
}
broadcasters.Clear();
this.Connected?.Invoke(_broadcaster);
connectedEvent.Set();
}
catch (Exception e)
void SIRTBroadcasterDisconnected(SIRTBroadcaster _broadcaster)
{
this.Invoke_StateLogging(e);
foreach (var @delegate in messageReceiveDelegates)
{
_broadcaster.MessageReceived -= @delegate;
}
this.Disconnected?.Invoke(_broadcaster);
connectedEvent.Set();
}
broadcaster.Connected += SIRTBroadcasterConnected;
broadcaster.Disconnected += SIRTBroadcasterDisconnected;
broadcaster.Open();
connectedEvent.Wait(3000);
hexId = broadcaster.Id;
frequency = broadcaster.Frequency;
broadcaster.Connected -= SIRTBroadcasterConnected;
broadcaster.Disconnected -= SIRTBroadcasterDisconnected;
return broadcaster.IsOpen;
}
private void Invoke_StateLogging(object state)
=> this.StateLogging?.Invoke($"{nameof(SIRTHub)}|{state}");
private void Invoke_StateLogging(object state, [CallerMemberName] string member = "")
=> this.StateLogging?.Invoke($"{nameof(SIRTHub)}|{member}|{state}");
private void Invoke_MessageProcessed(SIRTMessage message)
=> this.MessageProcessed?.Invoke(message);
private void LogMessage(object message)
=> SIRTLogger.LogMessage($"{nameof(SIRTHub)}|{message}");
}
}

View File

@ -4,38 +4,11 @@
public static class SIRTLogger
{
private static string timestamp => $"{DateTime.Now:yyyy-MM-dd|HH:mm:ss|fffffff}";
public static event Action<string> Message;
public static event Action<string> RawData;
public static event Action<string> State;
internal static void LogMessage(object message)
{
var messageEvent = Message;
if (messageEvent != null)
{
messageEvent($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fffffff}|{message}");
}
}
internal static void LogRawData(object data)
{
var rawDataEvent = RawData;
if (rawDataEvent != null)
{
rawDataEvent($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fffffff}|{data}");
}
}
internal static void LogState(object state)
{
var stateEvent = State;
if (stateEvent != null)
{
stateEvent($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fffffff}|{state}");
}
}
=> Message?.Invoke($"{timestamp}|{message}");
}
}

View File

@ -7,15 +7,31 @@
public class SIRTMessage
{
private byte[] bytes;
private bool buildCRC;
public SIRTMessage()
{
this.bytes = new byte[MIN_LEN];
this.bytes[0] = PC_SIRT;
this.buildCRC = true;
}
public SIRTMessage(byte[] bytes)
=> this.bytes = bytes;
public SIRTMessage(byte[] bytes)
{
if (bytes is null)
{
bytes = Array.Empty<byte>();
}
var length = Math.Max(MIN_LEN, bytes.Length);
this.bytes = new byte[length];
if (bytes.Length > 0)
{
Array.Copy(bytes, 0, this.bytes, 0, bytes.Length);
}
}
public byte Direction
{
@ -92,19 +108,17 @@
public DateTimeOffset Timestamp { get; set; } = DateTimeOffset.UtcNow;
public override string ToString()
=> $"{this.Timestamp}|{this.SirtId}|{this.Frequency}|{BitConverter.ToString(this.GetBytes())}";
public override string ToString() => $"{this.SirtId}|{this.Frequency:000}|{BitConverter.ToString(this.GetBytes())}";
public byte[] GetBytes()
{
var crc = this.bytes.CRCCCITT(1, this.bytes.Length - 3);
if (this.Direction == PC_SIRT)
if (this.buildCRC)
{
this.Crc = crc;
this.End = MSG_END;
this.Crc = this.bytes.CRCCCITT(1, this.bytes.Length - 3);
}
this.End = MSG_END;
return this.bytes;
}

View File

@ -2,15 +2,20 @@
{
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Ports;
using System.Threading;
public class SIRTPort
{
private readonly SerialPort serialPort;
private readonly bool log_RX_TX;
public SIRTPort(string portName)
=> this.serialPort = new SerialPort(portName, 112500, Parity.None, 8, StopBits.One);
public SIRTPort(string portName, bool log_RX_TX = true)
{
this.serialPort = new SerialPort(portName, 112500, Parity.None, 8, StopBits.One);
this.log_RX_TX = log_RX_TX;
}
public bool IsOpen => this.serialPort.IsOpen;
@ -18,12 +23,13 @@
public void Close()
{
SIRTLogger.LogState($"Closing: {this}");
this.LogMessage($"Closing: {this}");
var waitEvent = new ManualResetEventSlim();
void SerialPortDisposed(object sender, EventArgs args)
{
this.LogMessage($"Disposed: {this}");
waitEvent.Set();
}
@ -36,20 +42,20 @@
}
catch (Exception e)
{
SIRTLogger.LogMessage(e);
this.LogMessage(e);
}
this.serialPort.Disposed -= SerialPortDisposed;
if (!this.IsOpen)
{
SIRTLogger.LogState($"Closed: {this}");
this.LogMessage($"Closed: {this}");
}
}
public void Open()
{
SIRTLogger.LogState($"Opening: {this}");
this.LogMessage($"Opening: {this}");
try
{
@ -57,30 +63,40 @@
}
catch (Exception e)
{
SIRTLogger.LogMessage(e);
this.LogMessage(e);
}
if (this.IsOpen)
{
SIRTLogger.LogState($"Opened: {this}");
this.LogMessage($"Opened: {this}");
}
else
{
this.Close();
}
}
public IEnumerable<byte[]> Read()
public IEnumerable<byte[]> ReadBytes()
{
var buffer = Array.Empty<byte>();
var bufferSize = this.serialPort.ReadBufferSize;
var buffer = default(byte[]);
var length = default(int);
while (this.serialPort.IsOpen)
{
buffer = new byte[bufferSize];
try
{
buffer = new byte[this.serialPort.ReadBufferSize];
length = this.serialPort.Read(buffer, 0, buffer.Length);
length = this.serialPort.Read(buffer, 0, bufferSize);
}
catch (IOException _)
{
break;
}
catch (Exception e)
{
SIRTLogger.LogMessage(e);
this.LogMessage(e);
continue;
}
@ -88,8 +104,11 @@
Array.Resize(ref buffer, length);
yield return buffer;
SIRTLogger.LogRawData($"{this.PortName}|RX: {BitConverter.ToString(buffer)}");
if (this.log_RX_TX)
{
this.LogMessage($"RX|{BitConverter.ToString(buffer)}");
}
}
}
@ -105,12 +124,19 @@
try
{
this.serialPort.Write(bytes, 0, bytes.Length);
SIRTLogger.LogRawData($"{this.PortName}|TX: {BitConverter.ToString(bytes)}");
if (this.log_RX_TX)
{
this.LogMessage($"TX|{BitConverter.ToString(bytes)}");
}
}
catch (Exception e)
{
SIRTLogger.LogMessage(e);
this.LogMessage(e);
}
}
private void LogMessage(object message)
=> SIRTLogger.LogMessage($"{nameof(SIRTPort)}|{this.PortName}|{message}");
}
}

View File

@ -1,12 +1,18 @@
namespace Common.Hardware.SIRT
{
using System;
using System.Collections.Generic;
public sealed class SIRTStream
{
private readonly SIRTPort sirtPort;
private readonly bool log_RX_TX;
public SIRTStream(string portName) => this.sirtPort = new SIRTPort(portName);
public SIRTStream(string portName, bool log_RX_TX = true)
{
this.sirtPort = new SIRTPort(portName, false);
this.log_RX_TX = log_RX_TX;
}
public bool IsOpen => this.sirtPort.IsOpen;
@ -16,10 +22,10 @@
public void Open() => this.sirtPort.Open();
public IEnumerable<byte[]> Read()
public IEnumerable<byte[]> ReadMessages()
{
var buffer = new List<byte>();
var bufferLength = default(int);
var bytesCount = default(int);
var startIndex = default(int);
var lengthIndex = default(int);
var length = default(int);
@ -27,27 +33,19 @@
var messageLength = default(int);
var message = default(byte[]);
foreach (var bytes in this.sirtPort.Read())
foreach (var bytes in this.sirtPort.ReadBytes())
{
buffer.AddRange(bytes);
bufferLength = buffer.Count;
bytesCount = buffer.Count;
// until can parse messages from the buffer
while (bufferLength >= 12)
while (bytesCount > 0)
{
// reset the start index if needed
if (startIndex < 0)
{
startIndex = 0;
}
startIndex = buffer.IndexOf(SIRTConstants.SIRT_PC, startIndex);
startIndex = buffer.IndexOf(SIRTConstants.SIRT_PC, 0);
// when no start byte found clear and break
if (startIndex < 0)
{
SIRTLogger.LogState($"Message start not found startIndex: {startIndex} < 0");
buffer.Clear();
break;
@ -56,10 +54,8 @@
lengthIndex = startIndex + SIRTConstants.LEN_IX;
// when not enough bytes to the length index just break
if (lengthIndex >= bufferLength)
if (lengthIndex >= bytesCount)
{
SIRTLogger.LogState($"Message not complete lengthIndex: {lengthIndex} >= {bufferLength} :bufferLength");
break;
}
@ -67,38 +63,49 @@
endIndex = lengthIndex + length + 3;
// when not enough bytes to the end of the message just break
if (endIndex >= bufferLength)
if (endIndex >= bytesCount)
{
SIRTLogger.LogState($"Message not complete endIndex: {endIndex} >= {bufferLength} :bufferLength");
break;
}
// when message dose not ends with 0x16 try again with next start index
if (buffer[endIndex] != SIRTConstants.MSG_END)
{
SIRTLogger.LogState($"Message end {buffer[endIndex]} is not valid");
startIndex++;
continue;
}
messageLength = endIndex - startIndex + 1;
message = new byte[messageLength];
buffer.CopyTo(startIndex, message, 0, messageLength);
buffer.RemoveRange(0, endIndex);
buffer.RemoveRange(0, endIndex + 1);
yield return message;
// when message dose not ends with 0x16 clear bytes and break
if (message[messageLength - 1] != SIRTConstants.MSG_END)
{
this.LogMessage($"XX|{BitConverter.ToString(message)}");
break;
}
if (this.log_RX_TX)
{
this.LogMessage($"RX|{BitConverter.ToString(message)}");
}
// in case there are more messages in the buffer
bufferLength = buffer.Count;
startIndex = 0;
bytesCount = buffer.Count;
yield return message;
}
}
}
public void Write(params byte[] bytes) => this.sirtPort.Write(bytes);
public void Write(params byte[] bytes)
{
this.sirtPort.Write(bytes);
if (this.log_RX_TX)
{
this.LogMessage($"TX|{BitConverter.ToString(bytes)}");
}
}
private void LogMessage(object message)
=> SIRTLogger.LogMessage($"{nameof(SIRTStream)}|{this.PortName}|{message}");
}
}

View File

@ -10,10 +10,10 @@
this.ResponseAddress = 0x20000000;
this.Payload = new byte[]
{
new SirtOperating { /* default */ },
new SirtOperating { /* default */ },
new BluetoothOperating { BtOff = true },
new RFModuleOperating { RfOff = true },
new RFModuleOperating { OpMode = OperatingModes.ReceiveF1TransmitSensusRFF3 },
new RFModuleOperating { OpMode = OperatingModes.ReceiveF1TransmitSensusRFF3 }, // ReceiveF1TransmitSensusRFF3
new PamTimeout { Minutes = 1 }
};
}

View File

@ -10,7 +10,7 @@
this.request.P1 = new P811 { DelPamAdr = true };
}
public override void Push(SIRTMessage _)
public override void Receive(SIRTMessage _)
=> this.SetCompleted();
}
}

View File

@ -11,9 +11,9 @@
this.Length = 0x08;
}
public override void Push(SIRTMessage response)
public override void Receive(SIRTMessage response)
{
if (response.Command == SIRTConstants.AKN_ANS)
if (response.Command == SIRTConstants.ACKN_ANSW)
{
this.Payload = response.Payload;

View File

@ -10,9 +10,9 @@
public byte[] Payload { get; private set; }
public override void Push(SIRTMessage response)
public override void Receive(SIRTMessage response)
{
if (response.Command == SIRTConstants.AKN_ANS && response.P1 == 0)
if (response.Command == SIRTConstants.ACKN_ANSW && response.P1 == 0)
{
this.Payload = response.Payload;

View File

@ -14,9 +14,9 @@
public uint[] Addresses { get; }
public override void Push(SIRTMessage response)
public override void Receive(SIRTMessage response)
{
base.Push(response);
base.Receive(response);
if (this.Payload?.Length == 20)
{

View File

@ -13,9 +13,9 @@
public byte[] Payload { get; protected set; }
public override void Push(SIRTMessage response)
public override void Receive(SIRTMessage response)
{
if (response.Command == SIRTConstants.AKN_ANS)
if (response.Command == SIRTConstants.ACKN_ANSW)
{
this.Payload = response.Payload;

View File

@ -5,9 +5,7 @@
public abstract class SIRTTask
{
protected readonly ManualResetEventSlim awaiter = new ManualResetEventSlim();
protected readonly SIRTMessage request = new SIRTMessage();
protected readonly Guid taskId = Guid.NewGuid();
public event Action<SIRTTask> StateChanged;
@ -53,62 +51,50 @@
set => this.request.Frequency = value;
}
public DateTimeOffset Timestamp
{
get => this.request.Timestamp;
set => this.request.Timestamp = value;
}
public int Timeout { get; set; } = 10_000;
public abstract void Push(SIRTMessage response);
public abstract void Receive(SIRTMessage response);
public void SetCancelled()
{
this.State = SIRTTaskState.Cancelled;
public void SetCancelled() => this.State = SIRTTaskState.Cancelled;
this.awaiter.Set();
}
public void SetCompleted() => this.State = SIRTTaskState.Completed;
public void SetCompleted()
{
this.State = SIRTTaskState.Completed;
public void SetPending() => this.State = SIRTTaskState.Pending;
this.awaiter.Set();
}
public void SetPending()
{
this.State = SIRTTaskState.Pending;
this.awaiter.Set();
}
public void SetRunning()
{
this.State = SIRTTaskState.Running;
this.awaiter.Reset();
}
public void SetRunning() => this.State = SIRTTaskState.Running;
public virtual byte[] Start()
{
this.awaiter.Reset();
this.State = SIRTTaskState.Running;
this.Timestamp = DateTimeOffset.UtcNow;
this.SetRunning();
return this.request.GetBytes();
}
public void Wait()
{
this.awaiter.Wait(this.Timeout);
this.awaiter.Reset();
var awaiter = new ManualResetEventSlim();
void OnStateChanged(SIRTTask task)
{
if (task.State != SIRTTaskState.Running)
{
awaiter.Set();
}
}
this.StateChanged += OnStateChanged;
awaiter.Wait(this.Timeout);
this.StateChanged -= OnStateChanged;
}
public override bool Equals(object other)
=> other is SIRTTask _task && _task.taskId == this.taskId;
=> other?.ToString() == this.ToString();
public override int GetHashCode() => this.ToString().GetHashCode();
public override String ToString() => this.request.ToString();
public static implicit operator SIRTMessage(SIRTTask task) => task.request;
}

View File

@ -5,6 +5,7 @@
Pending = 0,
Running = 1,
Completed = 2,
Cancelled = 4
Cancelled = 4,
Done = 6,
}
}

View File

@ -3,15 +3,58 @@
using Common.Hardware.SIRT.Parameters;
using System;
using System.Collections.Generic;
public class WritePamTask : SIRTTask
{
private event Action<SIRTMessage> AKNReceived;
private event Action<SIRTMessage> BUPReceived;
private event Action<SIRTMessage> LATReceived;
private event Action<SIRTMessage> DEBUGReceived;
private event Action<SIRTMessage> SEMIReceived;
private event Action<SIRTMessage> UnknownReceived;
protected P811 p811;
protected bool latReceived;
protected bool debugReceived;
public WritePamTask()
{
this.request.Command = SIRTConstants.W_PAM;
this.p811 = this.request.P1;
this.request.Command = SIRTConstants.W_PAM;
this.MessageSent += this.OnMessageSent;
this.AKNReceived += this.OnAKNReceived;
this.BUPReceived += this.OnBUPReceived;
this.LATReceived += this.OnLATReceived;
this.DEBUGReceived += this.OnDEBUGReceived;
this.SEMIReceived += this.OnSEMIReceived;
this.UnknownReceived += this.OnUnknownReceived;
this.RequireLAT = true;
this.PamStatusIX = 11;
this.DebugLength = 52;
this.SemiLength = 91;
}
public event Action<SIRTMessage> MessageSent;
public event Action<SIRTMessage> MessageReceived;
public bool RequireLAT { get; set; }
public bool RequireDEBUG { get; set; }
public bool IsEncrypted { get; set; }
public byte[] EncryptionKeyI { get; set; }
private byte[] encryptionKeyII;
public byte[] EncryptionKeyII
{
get => this.encryptionKeyII;
set
{
this.encryptionKeyII = value;
this.IsEncrypted = true;
}
}
public bool WakeUpModul
@ -62,19 +105,249 @@
set => this.request.Payload = value;
}
public byte DebugLength { get; set; }
public byte SemiLength { get; set; }
public byte PamStatusIX { get; set; }
public bool AnyTelegramReceived { get; set; }
public Queue<SIRTMessage> MessageQueue { get; set; } = new Queue<SIRTMessage>();
public override void Receive(SIRTMessage response)
{
if (this.UseEncryption(response))
{
this.DecriptResponse(response);
}
this.MessageQueue.Enqueue(response);
if (response.Command == SIRTConstants.ACKN_ANSW)
{
this.AKNReceived?.Invoke(response);
}
else if (response.Command == SIRTConstants.FROM_AIR)
{
var payload = response?.Payload;
if (payload != null && payload.Length > 0)
{
var type = payload[0];
if (type == SIRTConstants.BUP)
{
this.AnyTelegramReceived = true;
this.BUPReceived?.Invoke(response);
}
else if (type == SIRTConstants.LAT)
{
this.latReceived = true;
this.AnyTelegramReceived = true;
this.LATReceived?.Invoke(response);
}
else if (type == SIRTConstants.DEBUG)
{
this.debugReceived = true;
this.AnyTelegramReceived = true;
this.DEBUGReceived?.Invoke(response);
}
else if (type == SIRTConstants.SEMI)
{
this.AnyTelegramReceived = true;
this.SEMIReceived?.Invoke(response);
}
else
{
this.UnknownReceived?.Invoke(response);
}
}
else
{
this.UnknownReceived?.Invoke(response);
}
}
else
{
this.UnknownReceived?.Invoke(response);
}
this.MessageReceived?.Invoke(response);
}
public override byte[] Start()
{
this.latReceived = false;
this.debugReceived = false;
var payload = this.EncryptRequest();
var message = new SIRTMessage
{
Direction = this.request.Direction,
Command = this.request.Command,
P1 = this.request.P1,
P2 = this.request.P2,
Address = this.request.Address,
Payload = payload,
Frequency = this.Frequency,
SirtId = this.SirtId,
};
this.MessageSent?.Invoke(this.request);
this.SetRunning();
return message.GetBytes();
}
protected virtual void OnMessageSent(SIRTMessage request)
{
}
protected virtual void OnAKNReceived(SIRTMessage akn)
{
}
protected virtual void OnBUPReceived(SIRTMessage bup)
{
}
protected virtual void OnLATReceived(SIRTMessage lat)
{
this.latReceived = true;
}
protected virtual void OnDEBUGReceived(SIRTMessage debug)
{
this.debugReceived = true;
if (this.RequireLAT && !this.latReceived)
{
this.SetPending();
}
}
protected virtual void OnSEMIReceived(SIRTMessage semi)
{
if ((this.RequireLAT && !this.latReceived) || (this.RequireDEBUG && !this.debugReceived) || semi.Payload[this.PamStatusIX] != 0)
{
this.SetPending();
}
else
{
this.SetCompleted();
}
}
protected virtual void OnUnknownReceived(SIRTMessage unknown)
{
}
protected virtual bool UseEncryption(SIRTMessage response)
{
if (response is null || this.EncryptionKeyI is null)
{
return false;
}
var payload = response.Payload;
if (payload is null)
{
return false;
}
var length = payload.Length;
if (length <= 0)
{
this.IsEncrypted = false;
}
else if (length >= this.SemiLength)
{
this.IsEncrypted = length > this.SemiLength;
}
else if (length >= this.DebugLength)
{
this.IsEncrypted = length > this.DebugLength;
}
else
{
this.IsEncrypted = payload.GetCrc() != 0;
}
return this.IsEncrypted;
}
private byte[] EncryptRequest()
{
var requestPayload = this.request.Payload;
var payloadLength = requestPayload.Length;
var payload = new byte[payloadLength];
if (payloadLength > 0)
{
Array.Copy(requestPayload, 0, payload, 0, payloadLength);
if (this.IsEncrypted)
{
payload = payload.EncryptRequest(this.EncryptionKeyI, this.RequestAddress);
}
}
return payload;
}
private void DecriptResponse(SIRTMessage response)
{
var payloadLength = response.Length;
if (payloadLength <= 0)
{
return;
}
var payload = new byte[payloadLength];
Array.Copy(response.Payload, 0, payload, 0, payloadLength);
if (this.IsEncrypted)
{
response.Payload = payload.DecryptResponse(this.EncryptionKeyI);
// Check if SEMI received
if (payloadLength > this.SemiLength)
{
var pamStatus = new PAMStatus(response.Payload[this.PamStatusIX]);
// when pam status > 31 - try decrypt with the other key
if (!pamStatus.IsValid && this.EncryptionKeyII != null)
{
var _payload = payload.DecryptResponse(this.EncryptionKeyII);
pamStatus = new PAMStatus(_payload[this.PamStatusIX]);
// when pam status OK then switch the keys
if (pamStatus == PAMStatus.OK)
{
response.Payload = _payload;
var _encryptionKey = this.EncryptionKeyI;
this.EncryptionKeyI = this.encryptionKeyII;
this.encryptionKeyII = _encryptionKey;
}
}
}
}
}
private void SetP811(Action<P811> p811Setter)
{
p811Setter.Invoke(this.p811);
this.request.P1 = this.p811;
}
public override void Push(SIRTMessage response)
{
if (response.Length > 0 && response.Payload[0] == SIRTConstants.SEMI)
{
this.SetCompleted();
}
}
}
}

View File

@ -15,9 +15,9 @@
}
}
public override void Push(SIRTMessage response)
public override void Receive(SIRTMessage response)
{
if (response.Command == SIRTConstants.AKN_ANS)
if (response.Command == SIRTConstants.ACKN_ANSW)
{
this.SetCompleted();
}

View File

@ -91,6 +91,29 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.Interfaces.Ports.PortCore.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<RunCodeAnalysis>true</RunCodeAnalysis>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>CODE_ANALYSIS;CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.Interfaces.Ports.PortCore.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<RunCodeAnalysis>true</RunCodeAnalysis>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>

View File

@ -212,6 +212,38 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>CODE_ANALYSIS;TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<RunCodeAnalysis>true</RunCodeAnalysis>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.Interfaces.Ports.SerialPorts.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>CODE_ANALYSIS;CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<RunCodeAnalysis>true</RunCodeAnalysis>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>

View File

@ -182,6 +182,36 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.Interfaces.Protocols.ProtocolCore.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<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>

View File

@ -102,6 +102,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<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>

View File

@ -92,6 +92,25 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\packages\NLog.5.2.2\lib\net45\NLog.dll</HintPath>

View File

@ -131,6 +131,26 @@
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRules>-Microsoft.Design#CA1021;-Microsoft.Design#CA1031;-Microsoft.Design#CA1002;-Microsoft.Design#CA1014;-Microsoft.Design#CA1024;-Microsoft.Usage#CA1801</CodeAnalysisRules>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRules>-Microsoft.Design#CA1021;-Microsoft.Design#CA1031;-Microsoft.Design#CA1002;-Microsoft.Design#CA1014;-Microsoft.Design#CA1024;-Microsoft.Usage#CA1801</CodeAnalysisRules>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\packages\NLog.5.2.2\lib\net45\NLog.dll</HintPath>

View File

@ -135,6 +135,27 @@
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\packages\NLog.5.2.2\lib\net45\NLog.dll</HintPath>

View File

@ -18,7 +18,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications
/// <summary>
/// address of application
/// </summary>
public Byte AppId;
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppId from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
public UInt16 AppId;
/// <summary>
/// version of the application
/// </summary>
public Int32? AppVersion;
/// <summary>
/// Get application name

View File

@ -65,6 +65,21 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<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>

View File

@ -17,7 +17,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications
/// <summary>
/// Identification number of application
/// </summary>
public Byte AppId;
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppId from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
public UInt16 AppId;
/// <summary>
/// Version of application
@ -25,10 +31,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications
public UInt32 Version;
/// <summary>
/// Version string of application because of FLEXNETVERSION
/// does return a different layout, instead of decimals it
/// used hexadecimals. Therefore the version has to be saved as
/// string at time of receiving for the FW-Update comparison
/// Version string of application because of FLEXNETVERSION does return a different layout, instead of decimals
/// it uses hexadecimals. Therefore, the version has to be saved as string at time of receiving for the FW-Update
/// comparison.
/// </summary>
public String StrVersion;

View File

@ -220,6 +220,38 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>

View File

@ -49,7 +49,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// <summary>
/// Send delay between records in milliseconds before
/// new record is going to be send or between retries,
/// new record is going to be sent or between retries,
/// this time is independent of the timeout, it is
/// used to delay the next send record after successful
/// response from meter.

View File

@ -82,6 +82,25 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<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>
@ -100,10 +119,15 @@
</Compile>
<Compile Include="CommunicationConfig.cs" />
<Compile Include="Const\MeterConfig.cs" />
<Compile Include="SirtConfig.cs" />
<Compile Include="ProcessConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\CommonCore\CommonCore.csproj">
<Project>{1B02C79E-0B19-43E2-8F6B-71EF0C786C97}</Project>
<Name>CommonCore</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Interfaces\Ports\PortCore\PortCore.csproj">
<Project>{2E139F63-B6FE-4EA9-A098-85364FE9B26C}</Project>
<Name>PortCore</Name>

View File

@ -2,6 +2,7 @@
using System.ComponentModel;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
{
@ -10,35 +11,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// </summary>
public class ProcessConfig
{
/// <summary>
/// ctor
/// </summary>
public ProcessConfig()
{
UseRegisterWatchService = false;
UseErrorLogger = false;
AutoUpdateFiles = false;
ProductionMode = true;
}
/// <summary>
/// Load configuration file from AppRoaming or working directory
/// </summary>
/// <param name="file"></param>
public ProcessConfig(String file)
public Boolean ReadProcessConfig()
{
// check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Genesis), file);
// Check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.MeterConfigFileName);
if (!File.Exists(configFile))
{
// take actual working directory
configFile = Path.Combine(file);
// Take actual working directory
configFile = Path.Combine(ProgramConfig.MeterConfigFileName);
if (!File.Exists(configFile))
{
UseRegisterWatchService = false;
UseErrorLogger = false;
return;
AutoUpdateFiles = false;
ProductionMode = true;
return false;
}
}
@ -54,21 +46,21 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
CalibrationLoggerServiceUrl = meterConfig.CalibrationLoggerServiceUrl;
AutoUpdateFiles = meterConfig.AutoUpdateFiles;
ProductionMode = meterConfig.ProductionMode;
}
return true;
}
/// <summary>
/// Write file to AppRoaming and backup it to actual working directory
/// </summary>
/// <param name="file"></param>
public void Update(String file)
public void Update()
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Genesis), file);
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.MeterConfigFileName);
File.WriteAllText(configFile, JsonConvert.SerializeObject(this));
File.WriteAllText(file, JsonConvert.SerializeObject(this));
File.WriteAllText(ProgramConfig.MeterConfigFileName, JsonConvert.SerializeObject(this));
}
/// <summary>
@ -114,6 +106,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
[DefaultValue(true)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public Boolean ProductionMode { get; set; } = true;
public Boolean ProductionMode { get; set; }
}
}

View File

@ -0,0 +1,96 @@
using System;
using System.IO;
using Newtonsoft.Json;
using Xylem.Common.CommonCore.Consts;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
{
/// <summary>
/// Configuration of SIRT
/// </summary>
public class SirtConfig
{
/// <summary>
/// Load SIRT configuration file from AppRoaming or working directory
/// </summary>
public Boolean ReadSirtConfig()
{
// Check for AppRoaming
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.SirtConfigFileName);
if (!File.Exists(configFile))
{
// Take actual working directory
configFile = Path.Combine(ProgramConfig.SirtConfigFileName);
if (!File.Exists(configFile))
{
SirtComport433MHz = null;
SirtComport868MHz = null;
ServiceSirtComport868MHz = null;
ServiceSirtComport433MHz = null;
SirtBoxNo = null;
StationId = null;
return false;
}
}
using (var tr = new StreamReader(configFile))
{
var sirtConfig = JsonConvert.DeserializeObject<SirtConfig>(tr.ReadToEnd());
SirtComport433MHz = sirtConfig.SirtComport433MHz;
SirtComport868MHz = sirtConfig.SirtComport868MHz;
ServiceSirtComport433MHz = sirtConfig.ServiceSirtComport433MHz; ;
ServiceSirtComport868MHz = sirtConfig.ServiceSirtComport868MHz; ;
SirtBoxNo = sirtConfig.SirtBoxNo;
StationId = sirtConfig.StationId;
}
return true;
}
/// <summary>
/// Write file to AppRoaming and backup it to actual working directory
/// </summary>
public void Update()
{
var configFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
nameof(Genesis), ProgramConfig.SirtConfigFileName);
File.WriteAllText(configFile, JsonConvert.SerializeObject(this));
File.WriteAllText(ProgramConfig.SirtConfigFileName, JsonConvert.SerializeObject(this));
}
/// <summary>
/// Comport for SIRT interface with 433MHz radio frequency
/// </summary>
public String SirtComport433MHz { get; set; }
/// <summary>
/// Comport for SIRT interface with 868MHz radio frequency
/// </summary>
public String SirtComport868MHz { get; set; }
/// <summary>
/// Box number for calibration settings
/// </summary>
public Int32? SirtBoxNo { get; set; }
/// <summary>
/// Station ID where the SIRT is used
/// </summary>
public Int32? StationId { get; set; }
/// <summary>
/// Service Comport for SIRT interface with 433MHz radio frequency
/// </summary>
public String ServiceSirtComport433MHz { get; set; }
/// <summary>
/// Service Comport for SIRT interface with 868MHz radio frequency
/// </summary>
public String ServiceSirtComport868MHz { get; set; }
}
}

View File

@ -10,21 +10,27 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts
{
// ReSharper disable InconsistentNaming
#pragma warning disable CS1591
REBOOT = 1 << 0,
LOW_BATTERY = 1 << 1,
EMPTY_PIPE = 1 << 4,
REVERSE_FLOW = 1 << 6,
SUSPECT_LEAK = 1 << 7,
BROKEN_PIPE = 1 << 8,
LOW_PRESSURE = 1 << 9,
HIGH_PRESSURE = 1 << 10,
LOW_TEMPERATURE = 1 << 11,
HIGH_TEMPERATURE = 1 << 12,
RADIO_ERROR = 1 << 13,
METROLOGY_PARAMS = 1 << 14,
METROLOGY_MEASURE = 1 << 15,
REBOOT = 1 << 0, //Bit 0
LOW_BATTERY = 1 << 1, //Bit 1
//Bit 2
//Bit 3
ALL = 0xFFFFFF,
EMPTY_PIPE = 1 << 4, //Bit 4
//Bit 5
REVERSE_FLOW = 1 << 6, //Bit 6
SUSPECT_LEAK = 1 << 7, //Bit 7
BROKEN_PIPE = 1 << 8, //Bit 8
LOW_PRESSURE = 1 << 9, //Bit 9
HIGH_PRESSURE = 1 << 10, //Bit 10
LOW_TEMPERATURE = 1 << 11, //Bit 11
HIGH_TEMPERATURE = 1 << 12, //Bit 12
RADIO_ERROR = 1 << 13, //Bit 13
METROLOGY_PARAMS = 1 << 14, //Bit 14
METROLOGY_MEASURE = 1 << 15, //Bit 15
ALL = 0x7FFFFFFF //enum is defined as Int32
#pragma warning restore CS1591
// ReSharper restore InconsistentNaming
}

View File

@ -1,4 +1,6 @@
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
using System.Text.RegularExpressions;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@ -31,10 +33,16 @@
public List<ApplicationDefinition> ConfigApplicationDefinitions { get; }
= new List<ApplicationDefinition>();
/// <summary>
/// Information collected during 'configuration.json' read
/// </summary>
public readonly InterfaceInfo InterfaceInfo = new InterfaceInfo();
/// <summary>
/// Ctor
/// </summary>
public GenesisConfigurationReader() {}
public GenesisConfigurationReader() { }
/// <summary>
/// Ctor
@ -60,6 +68,25 @@
/// <param name="configurationJson"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
/// <remarks date="??" author="Stoyan Slatev">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppId from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
/// <remarks date="2025-Aug-07" author="Thomas Wiedebusch">
/// - Extract the max supported versions for EMEA and NA to check the supported FW.
/// </remarks>
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - Supported application list introduced.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t'
/// data types.
/// </remarks>
public void BuildRegisterList(String configurationJson)
{
IDictionary<String, AppSection> sections;
@ -70,7 +97,7 @@
.DeserializeObject<IDictionary<String, AppSection>>(configurationJson, SerializerSettings)
?? new Dictionary<String, AppSection>();
}
catch (Exception )
catch (Exception)
{
sections = new Dictionary<String, AppSection>();
}
@ -79,11 +106,30 @@
{
var appId = sectionKVP.Value.Id;
var appName = sectionKVP.Key;
var appVersion = sectionKVP.Value.Version.Last;
if (appName.Equals("OPTICALINTERFACE"))
{
var builds = sectionKVP.Value.Builds;
var emeaBuilds = builds["emea"];
var naBuilds = builds["na"];
InterfaceInfo.SupportedFwVersions = new List<String>();
foreach (var build in emeaBuilds)
{
InterfaceInfo.SupportedFwVersions.Add(build.FW);
}
foreach (var build in naBuilds)
{
InterfaceInfo.SupportedFwVersions.Add(build.FW);
}
InterfaceInfo.InterfaceVersion = GenesisMeter.BuildFwVersionStringFromDec(appVersion);
continue;
}
ConfigApplicationDefinitions.Add(new ApplicationDefinition
{
AppId = appId,
AppName = appName
AppName = appName,
AppVersion = appVersion,
});
var section = sectionKVP.Value;
@ -122,8 +168,9 @@
AppAddress = appId,
AppName = appName,
DataType = GetType(detail.Type),
DataSize = GetSize(detail.Type),
Default = values?.Default is Int64 d ? d : default(Int64?),
IsAvailable = default(Boolean),
IsAvailable = false,
Maximum = values?.Maximum is Int64 max ? max : default(Int64?),
Minimum = values?.Minimum is Int64 min ? min : default(Int64?),
RegAddressInApp = regId,
@ -151,30 +198,107 @@
},
};
/// <summary>
/// Convert data types from interface 'configuration.json' to CLR type or array
/// </summary>
/// <param name="value"></param>
/// <returns>type</returns>
/// <exception cref="Exception"></exception>
/// <remarks date="??" author="Stoyan Slatev">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Parsed all 'uintxx_t' which are not based on CLR types to byte-array
/// </remarks>
private static Type GetType(String value)
{
switch (value.ToLower())
// Catch all uintxx_t to split to standard CLR or to array
var lowStrValue = value.ToLower();
if (lowStrValue.Contains("uint") && lowStrValue.Contains("_t"))
{
switch (lowStrValue)
{
case "uint8_t": return typeof(Byte);
case "uint16_t": return typeof(UInt16);
case "uint32_t": return typeof(UInt32);
case "uint64_t": return typeof(UInt64);
default:
return typeof(ByteArray);
}
}
// Catch the signed standard CLR and some special types
switch (lowStrValue)
{
// CLR types
case "bool_t": return typeof(Boolean);
case "rpc": return typeof(Rpc);
case "string": return typeof(String);
case "uint32_t": return typeof(UInt32);
case "time_t": return typeof(TimeT);
case "status_t": return typeof(StatusT);
case "uint16_t": return typeof(UInt16);
case "uint8_t": return typeof(Byte);
case "enum8": return typeof(Enum8);
case "uint64_t": return typeof(UInt64);
case "uint96_t": return typeof(UInt96);
case "uint128_t": return typeof(UInt128);
case "int8_t": return typeof(SByte);
case "int16_t": return typeof(Int16);
case "int32_t": return typeof(Int32);
case "int64_t": return typeof(Int64);
case "int16_t": return typeof(Int16);
case "uint72_t": return typeof(UInt72);
case "uint48_t": return typeof(UInt48);
case "uint88_t": return typeof(UInt88);
default: throw new Exception($"Type {value} not recognized!");
case "string": return typeof(String);
// Special types defined in FW interface file 'configuration.json'
case "rpc": return typeof(Rpc);
case "time_t": return typeof(TimeT);
case "status_t": return typeof(StatusT);
case "enum8": return typeof(Enum8);
default:
throw new Exception($"Data type {value} in unknown!");
}
}
/// <summary>
/// Build the data size
/// </summary>
/// <param name="value"></param>
/// <returns>size</returns>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Initial: - parsed all 'uintxx_t' which are not based on CLR types to byte-array
/// </remarks>
private static Int32 GetSize(String value)
{
// Catch all uintxx_t to split to standard CLR or to array
var lowStrValue = value.ToLower();
if (lowStrValue.Contains("uint") && lowStrValue.Contains("_t"))
{
switch (lowStrValue)
{
case "uint8_t": return sizeof(Byte);
case "uint16_t": return sizeof(UInt16);
case "uint32_t": return sizeof(UInt32);
case "uint64_t": return sizeof(UInt64);
default:
// Extract the size from the string
var dataSizeStr = Regex.Replace(lowStrValue, "[^0-9]", string.Empty);
if (Int32.TryParse(dataSizeStr, out var dataSize))
return dataSize / 8;
throw new Exception($"Data size {lowStrValue} cannot be converted!");
}
}
// Catch the signed standard CLR and some special types
switch (lowStrValue)
{
// CLR types
case "bool_t": return sizeof(Boolean);
case "int8_t": return sizeof(SByte);
case "int16_t": return sizeof(Int16);
case "int32_t": return sizeof(Int32);
case "int64_t": return sizeof(Int64);
// Take just some value as the string length is unknown
case "string": return 6 * 4;
// Special types defined in FW interface file 'configuration.json'
// Remote procedure call is always a 4 byte value
case "rpc": return sizeof(UInt32);
// Time will be in seconds since 01. Jan 2000 00:00:00 UTC as signed Int32
case "time_t": return sizeof(Int32);
case "status_t": return sizeof(UInt32);
case "enum8": return sizeof(Byte);
default:
throw new Exception($"Data type {value} in unknown!");
}
}
}

View File

@ -224,6 +224,41 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug-local IIS-CUST|x64'">
<OutputPath>bin\x64\Debug-local IIS-CUST\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<LangVersion>7.0</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\x86\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.xml</DocumentationFile>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>6</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'VPN_Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\VPN_Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.Core.xml</DocumentationFile>
<RegisterForComInterop>true</RegisterForComInterop>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<GenerateSerializationAssemblies>On</GenerateSerializationAssemblies>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\..\..\.shared\SharedAssemblyInfo.cs">
<Link>Properties\SharedAssemblyInfo.cs</Link>
@ -232,6 +267,7 @@
<Compile Include="Consts\PowCorrConst.cs" />
<Compile Include="Consts\MetrologyDefinition.cs" />
<Compile Include="IGenesisMeter.cs" />
<Compile Include="InterfaceInfo.cs" />
<Compile Include="PowerCorrectionCalc.cs" />
<Compile Include="PowerCorrection.cs" />
<Compile Include="Consts\ErrorState.cs" />
@ -378,6 +414,7 @@
<EmbeddedResource Include="Properties\Resources.de.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.de.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>

View File

@ -1,5 +1,6 @@
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@ -14,7 +15,6 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Timers;
using NLog;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.CommonCore.ThreadWatcher;
@ -49,6 +49,7 @@ using Xylem.Common.Metrology.Measurements;
using Xylem.Common.Metrology.Measurements.Consts;
using Xylem.Common.Utils.Logging;
using Access = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Access;
using Register = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Register;
using Timer = System.Timers.Timer;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
@ -139,10 +140,20 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private ILogger _loggerRawData;
/// <summary>
/// Optional request to use the offline passwords
/// </summary>
public Boolean UseOfflinePasswords { set; get; }
/// <summary>
/// Remind the offline password for comparison if this is actively used
/// </summary>
public String OfflinePassword { protected set; get; } = "";
/// <summary>
/// Process configuration
/// </summary>
public ProcessConfig Configuration { internal set; get; } = new ProcessConfig();
public ProcessConfig Configuration { internal set; get; } //= new ProcessConfig();
/// <summary>
/// Transmit protocol access for underlie objects to change response timeout
@ -154,11 +165,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private String _serialNumber = "";
/// <inheritdoc />
/// <summary>
/// Property is redundant because is also stored in
/// <see cref="T:Xylem.Sensus.WaterMeter.Genesis.Logic.Domain.Genesis.DataPackages.MeterRegister" /> but
/// nevertheless it is the identification of the meter it has a separate Property
/// </summary>
public String SerialNumber
{
get => _serialNumber;
@ -190,7 +196,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public List<MeterApplications> MeterAppListVersion { protected set; get; } = new List<MeterApplications>();
public List<MeterApplications> MeterAppListVersion
{
protected set; get;
} = new List<MeterApplications>();
/// <inheritdoc />
public Int32? CoreRevision
@ -198,6 +208,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
protected set; get;
}
/// <inheritdoc />
public InterfaceInfo InterfaceInfo
{
get; internal set;
}
/// <inheritdoc />
public String StrCoreRevision
{
@ -217,25 +233,33 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public String LutCrc
public String LutCrc {
protected set;
get;
} = "?";
/// <inheritdoc />
public String MeterSize {
protected set;
get;
} = "?";
/// <inheritdoc />
public Boolean InterfaceSupportsFwVersion
{
protected set; get;
protected set;
get;
}
/// <inheritdoc />
public String MeterSize
{
protected set; get;
}
public String Region {
protected set;
get;
} = "?";
/// <inheritdoc />
public String Region
public String MeterLength
{
protected set; get;
}
/// <inheritdoc />
public String MeterLength {
set;
get;
} = "?";
@ -470,6 +494,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
/// <summary>
/// Unlocked the property change ability for special sequences.
/// </summary>
public Boolean UnlockEssentialProperties
{
get;
protected set;
}
#endregion
#region Setup
@ -500,6 +533,61 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
/// <summary>
/// Unlocked the property change ability for special sequences.
/// </summary>
/// <param name="unlockPropertyChange">true if unlock required</param>
/// <returns>true if possible</returns>
public Boolean EnablePropertyChangeAbility(Boolean unlockPropertyChange)
{
UnlockEssentialProperties = unlockPropertyChange;
return true;
}
/// <summary>
/// Set the meter size if previously unlocked
/// </summary>
/// <param name="meterSize">true if setting is allowed</param>
/// <returns>true if possible</returns>
public virtual Boolean SetMeterSize<T>(T meterSize)
{
if (!UnlockEssentialProperties)
return false;
if (meterSize is String)
{
var ms = meterSize.ToString();
if (Logic.ProductionOrderCore.OrderData.MeterSize.NA == MeterSizeConverter.ConvertMeterSizeNameToEnum(ms))
return false;
MeterSize = ms;
}
else if (meterSize.GetType() == typeof(MeterSize))
{
var ms = Convert.ToInt32(meterSize);
MeterSize = MeterSizeConverter.ConvertMeterSizeEnumToSizeName((MeterSize)ms);
}
else // Type is unknown
{
return false;
}
return true;
}
/// <summary>
/// Set the pressure sensor if previously unlocked
/// </summary>
/// <param name="pressureSensorAssembled">true if setting is allow</param>
/// <returns>true if possible</returns>
public Boolean SetPressureSensorAssembled(Boolean pressureSensorAssembled)
{
if (!UnlockEssentialProperties)
return false;
PressureSensorAssembled = pressureSensorAssembled;
return true;
}
/// <summary>
/// Returns meter registers
/// </summary>
@ -510,7 +598,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
//void IWaterMeterWithRegisters.LoadConfiguration(String location)
public void LoadConfiguration(String location)
{
var configFile = ProgramConfig.RegisterDefinitionFileName;
@ -532,14 +619,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
try
{
Logger.Trace($"Slot:{Slot} - Registers definitions loaded from {location}");
if (Configuration.AutoUpdateFiles)
if (Configuration != null && Configuration.AutoUpdateFiles)
{
Logger.Trace($"Slot:{Slot} - Check for updates of {configFilePath}");
var fi = new FileInfo(configFilePath);
try
{
var str = LocalWebRequest.GetRequest($"{ServiceUrls.FileContentControllerUrl()}GetUpdateFileContent?FileName={fi.Name}&ClientFileDate={fi.CreationTime.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")}&isDeveloper=0", 30000);
var str = LocalWebRequest.GetRequest($"{ServiceUrls.FileContentControllerUrl()}GetUpdateFileContent?FileName={fi.Name}" +
$"&ClientFileDate={fi.CreationTime:yyyy-MM-ddTHH:mm:ss.fffZ}" +
"&isDeveloper=0", 30000);
if (!string.IsNullOrEmpty(str.Trim('\"')))
{
var baseFile = JsonConvert.DeserializeObject<BaseFile>(str);
@ -570,12 +659,29 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Logger.Warn(ex, $"Slot:{Slot} - Register definition file update went wrong.");
}
//builds a configuration file reader from configuration.json and reads all registers definitions
//and application definitions
var registerReader = new GenesisConfigurationReader(configFilePath);
try
{
SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions);
SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions);
//builds a configuration file reader from configuration.json and reads all registers definitions
//and application definitions
var registerReader = new GenesisConfigurationReader(configFilePath);
InterfaceInfo = new InterfaceInfo
{
SupportedFwVersions = new List<String>()
};
InterfaceInfo.SupportedFwVersions.AddRange(registerReader.InterfaceInfo.SupportedFwVersions);
InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion;
SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions);
SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions);
}
catch (Exception ex)
{
var msg = $"\'configuration.json\' file is incompatible!\nConfig Reader reports: {ex.Message}";
Logger.Error(ex, $"Slot:{Slot} - {msg}.");
throw new Exception(msg);
}
}
event EventHandler IMeter.OnDisposeCompleted
@ -660,14 +766,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
if (string.IsNullOrEmpty(CurrentActionText))
{
Logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}", $"", "Meter", "MeterBase", "MeterBase");
Logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}", "", "Meter", "MeterBase", "MeterBase");
}
else
{
var id = !string.IsNullOrEmpty(SerialNumber) ? $"SN{SerialNumber}" : $"PCB{PcbId}";
Logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}_{id}_{CurrentActionText}", $"Slot", "Meter", "MeterBase", "MeterBase");
Logger = NLogHelper.CreateOrGetMultiLogger($"Slot:{Slot}_{id}_{CurrentActionText}", "Slot", "Meter", "MeterBase", "MeterBase");
if (StreamingPort != null && StreamingPort is LedSerialPort)
{
var streamingIdent = $"LedRawData_Slot_{Slot}_{id}_{CurrentActionText}";
@ -694,7 +800,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var tmpUrl = $"http://10.49.40.25/MeterProcessState/api/TestBench/SetMeterLogPathInfo?SerialNumber={SerialNumber}&TestRunId={testRunString}&BasePath={basePath}&MainLogName={pathMain}&LEDName={pathRaw}";
Logger.Debug($"Request Url: {tmpUrl}");
//ToDO: Update to service URl
//TODO: Update to service URl
LocalWebRequest.GetRequest(tmpUrl, 30000);
}
@ -774,7 +880,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
ledTransmit.GetTransmitPortSettings());
StreamingProtocol = new StreamingProtocol(streamingIdent, ignoreCorruptedData);
}
Configuration = new ProcessConfig(ProgramConfig.ConfigFileName);
Configuration = new ProcessConfig();
Configuration.ReadProcessConfig();
Logger.Debug($"Slot:{Slot} - Setup done");
}
@ -1109,6 +1216,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2023-Feb-28" author="T.Wiedebusch">
/// - Used <see cref="MeterPwdHandlerDb.GetPasswordFromDb"/>
/// </remarks>
/// <remarks date="2025-Oct-10" author="T.Wiedebusch">
/// - Optional the offline passwords will be used.
/// </remarks>
/// <remarks date="2025-Oct-21" author="T.Wiedebusch">
/// - BUGFIX: Avoid request of password from DB if offline password usage fored.
/// </remarks>
private String GetPassword()
{
// without PCB ID it is not possible to login,
@ -1126,15 +1239,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
// on unknown password try to get it from DB
if (MeterPwdHandlerDb.GetPasswordFromDb(PcbId, out var password))
var password = "";
// if NOT offline password usage required try to get it from DB
if (!UseOfflinePasswords && MeterPwdHandlerDb.GetPasswordFromDb(PcbId, out password) )
{
Logger.Info($"Slot:{Slot} - Got password from GenesisPasswordService, " +
$"URL({ServiceUrls.GenesisGetPasswordServiceUrl() + PcbId})");
OfflinePassword = "";
}
else
{
Logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " +
if (!UseOfflinePasswords)
Logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " +
$"URL({ServiceUrls.GenesisGetPasswordServiceUrl() + PcbId}))");
// try to read the password from an offline password file
var offlinePwdPathName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
@ -1144,12 +1260,17 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(
File.ReadAllText(offlinePwdPathName));
if (listOfOfflinePasswords != null)
if (listOfOfflinePasswords != null && listOfOfflinePasswords.Any(x => x.PcbId == PcbId ))
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
if (!string.IsNullOrEmpty(password))
{
Logger.Info($"Slot:{Slot} - Got password for PcbId:{PcbId} from password file!");
Logger.Info($"Slot:{Slot} - Got password for PcbId:{PcbId} from 'offline password' file!");
OfflinePassword = password;
}
else
{
Logger.Info($"Slot:{Slot} - 'offline password' file does not contain a password for PcbId:{PcbId} !");
}
}
@ -1278,8 +1399,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <summary>
/// Building the FW Version string and the hexadecimal version out of 2 bytes of data or from an
/// input string like "11.07" or "R1.1.07" or "B1.1.07" or "1.3.0B" or "9.0.2D".
/// Building the FW Version:
/// - string like "R1.1.07" or "B1.1.07" or optional reduced form for configuration capability check "1107",
/// - hexadecimal version like 0x1107 or 0x9107 for the 'B' version.
///
/// Input:
/// - optional string like "1107", "11.07", "R1.1.07", "B1.1.07", "1.3.0B" or "9.0.2D".
/// - optional 2 bytes representing the msb and lsb like 0x11 and 0x07.
///
/// REASON: FLEXNETVERSION is one application which does not follow the same rule of decimal numbers.
/// Instead, it uses hexadecimal digits.
@ -1288,6 +1414,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <param name="strVersion">any string to evaluate like "11.07" or "R1.1.07" or "1.3.0B"</param>
/// <param name="msb">most significant byte representing the major and minor version</param>
/// <param name="lsb">last significant byte representing the built version</param>
/// <param name="buildShortVersion">will force to reduce the string output of FW version to e.g. "1107"</param>
/// <returns>FLEXNET version string e.g. "R1.2.47" or "B1.2.0C" </returns>
/// <remarks date="2023-Mar-02" author="Thomas Wiedebusch">
/// - Initial.
@ -1295,8 +1422,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2023-Mar-08" author="Thomas Wiedebusch">
/// - Removed the optional leading "B" or "R" on strVersion input to create the fwVersion.
/// </remarks>
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - .
/// </remarks>
public static String BuildFlexnetFwVersion(out UInt32 fwVersion, String strVersion, Byte? msb = null,
Byte? lsb = null)
Byte? lsb = null, Boolean buildShortVersion = false)
{
var major = 0;
var minor = 0;
@ -1314,7 +1444,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
minor = (Int32)(msb & 0x0F);
builtMajor = (Int32)((lsb & 0xF0) >> 4);
builtMinor = (Int32)(lsb & 0x0F);
fwVersion = (UInt32)((msb << 8) + lsb);
fwVersion = (UInt32)(((msb & 0xFF) << 8) + lsb);
}
else if (!string.IsNullOrEmpty(strVersion))
{
@ -1357,13 +1487,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
major += majorAdd;
}
// release version marked with "R"
if (major < majorIndicatorForB)
return $"R{major:X0}.{minor:X0}.{builtMajor:X0}{builtMinor:X0}";
// Build the release type id: 'R' for released version or 'B' for test version
var releaseTypeId = "R";
if (major >= majorIndicatorForB)
{
releaseTypeId = "B";
// Debug version marked with 'B'
major -= majorIndicatorForB;
}
// debug version marked with "B"
major -= majorIndicatorForB;
return $"B{major:X0}.{minor:X0}.{builtMajor:X0}{builtMinor:X0}";
return buildShortVersion ?
$"{major:X0}{minor:X0}{builtMajor:X0}{builtMinor:X0}" :
$"{releaseTypeId}{major:X0}.{minor:X0}.{builtMajor:X0}{builtMinor:X0}";
}
/// <summary>
@ -1381,8 +1516,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </remarks>
public static String BuildFwVersion(out UInt32 fwVersion, Byte msb, Byte lsb)
{
fwVersion = (UInt32)(((msb & 0xF0) >> 4) * 10 + (msb & 0x0F)) * 100;
fwVersion += (UInt32)(((lsb & 0xF0) >> 4) * 10 + (lsb & 0x0F));
fwVersion = (UInt32)((((msb & 0xF0) >> 4) * 10) + (msb & 0x0F)) * 100;
fwVersion += (UInt32)((((lsb & 0xF0) >> 4) * 10) + (lsb & 0x0F));
//skip leading 0
var msbPartString = (msb & 0xF0) > 0 ? $"{(msb & 0xF0) >> 4:X0}." : "";
msbPartString += $"{msb & 0x0F:X0}" + "." + $"{(lsb & 0xF0) >> 4:X1}" + $"{lsb & 0x0F:X1}";
@ -1510,6 +1645,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2024-Apr-04" author="Roland Drabesch/Thomas Wiedebusch">
/// - Initial, extracted from <see cref="ReadMeterFirmwareAndAssignRegisters"/>
/// </remarks>
/// <remarks date="2025-Dec-09" author="Thomas Wiedebusch">
/// - Excluded register versions explicit specified in the 'configuration.json' as version.exclude list.
/// </remarks>
/// <remarks date="2025-Dec-16" author="Thomas Wiedebusch">
/// - Excluded all registers from apps which are NOT installed (isInstalled == false).
/// </remarks>
public void BuildValidMeterRegisters(List<KeyValuePair<RegisterDefinition, Byte[]>> tempConfigRegisters)
{
if (tempConfigRegisters == null || tempConfigRegisters.Count == 0)
@ -1530,7 +1671,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
foreach (var registerToCheck in tempConfigRegisters)
{
if (registerToCheck.Key?.RegisterDetail?.Version == null ||
MeterAppListVersion.All(f => f.AppId != registerToCheck.Key.AppAddress))
MeterAppListVersion.All(f => f.AppId != registerToCheck.Key.AppAddress || !f.IsInstalled))
continue;
var currentGroup = MeterAppListVersion.First(f => f.AppId == registerToCheck.Key.AppAddress);
@ -1542,7 +1683,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
(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))
registerToCheck.Key.RegisterDetail.Version.Last.Value >= currentGroup.Version &&
( registerToCheck.Key.RegisterDetail.Version.Exclude == null ||
// Exclude named versions
registerToCheck.Key.RegisterDetail.Version.Exclude.All(exVer => exVer != currentGroup.Version))))
{
configRegisterListForDebug.Add(registerToCheck.Key.GetIdent());
// Avoid multiple assignment of identical register in dictionary if one has passed the test
@ -1620,6 +1764,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// - BuildFlexnetFwVersion,
/// - Calculate core revision.
/// </remarks>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - Extract interface version (configuration.json) from "OPTICALINTERFACE".
/// - AppId from Byte to UInt16 including typecast for Byte on WriteRegister. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - Handle the interface compatibility FW version with short string like "1421" and discrete FW versions.
/// </remarks>
protected virtual void ReadMeterFirmwareAndAssignRegisters()
{
// Avoid overwriting of list if this already exits
@ -1634,15 +1788,19 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
InstalledFwVersion = 0;
MeterAppListVersion.Clear();
//Get all existing applications from meter register dictionary
CheckRegionSizeLutCrc();
var strShortFwVersion = "";
// Get all existing applications from meter register dictionary
foreach (var meterApp in ConfigApplications.OrderBy(o => o.AppId))
{
UInt32 readFwVersion = 0;
UInt16 readFwCrc = 0;
var isInstalled = false;
var installationStatus = MeterAppState.MeterAppNotInstalled;
var versionString = "";
if (WriteRegister(Register.System.CheckFwPresence, meterApp.AppId))
if (WriteRegister(Register.System.CheckFwPresence, (Byte)meterApp.AppId))
{
//read version, skip retries on SYSTEM 0x04-> FW nor present is a valid feedback
var readFwVersionBytes = ReadRegister(Register.System.CheckFwPresence, 4);
@ -1652,12 +1810,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
//build the version string, because e.g. FLEXNETVERSION is one application which does not
//follow the same rule. After the upper conversion, the hexadecimal outline will be lost
if (meterApp.AppName == "FLEXNETVERSION")
if (meterApp.AppName.Equals("FLEXNETVERSION"))
{
// msb and lsb are swapped during communication
FwVersion = BuildFlexnetFwVersion(out readFwVersion, null, readFwVersionBytes[1], readFwVersionBytes[0]);
FwVersion = BuildFlexnetFwVersion(out readFwVersion, null, readFwVersionBytes[1],
readFwVersionBytes[0]);
versionString = FwVersion;
InstalledFwVersion = readFwVersion;
// create a short FW version info being able to compare the interface compatibility
strShortFwVersion = BuildFlexnetFwVersion(out _, FwVersion, buildShortVersion: true);
}
else
{
@ -1701,15 +1862,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
});
}
CheckRegionSizeLutCrc();
//read metrology upgrade permission
MetrologyUpgradePermission = RegisterConverter.ByteArrayToValue<Byte>(
ReadRegister(Register.System.MetrologyUpgradePermission));
try
{
//check IRDA adapter ID to check if it was installed in the last few minutes to indicate this
PulseAdapterAutoDetected = !string.IsNullOrEmpty(RegisterConverter.ByteArrayToValue<String>(
ReadRegister(Register.Irda.AdapterId)));
@ -1766,6 +1924,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Logger.Info($"Slot:{Slot} - Meter size: {MeterSize}");
Logger.Info($"Slot:{Slot} - Upgrade permission: {MetrologyUpgradePermission:X2}");
Logger.Info($"Slot:{Slot} - Interface (configuration.json) version: {InterfaceInfo.InterfaceVersion}");
if (InterfaceInfo.SupportedFwVersions.Any(strFwVersion => strFwVersion.Contains(strShortFwVersion)))
{
InterfaceSupportsFwVersion = true;
Logger.Info($"Slot:{Slot} - Interface supports this FW version: {FwVersion}");
}
else
{
InterfaceSupportsFwVersion = false;
Logger.Warn($"Slot:{Slot} - Interface does not support this FW version: {FwVersion}");
}
// initial list of ALL registers defined in configuration.json
var tempConfigRegisters = ConfigRegister.MeterRegisterDic.ToList();
@ -1778,7 +1948,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
if (ConfigRegister.MeterRegisterDic.All(a => a.Key.GetIdent() != checkMinRegister))
{
// These registers ar required for essential operation, they have to be added even if the
// version in the configuration.json is outdated or they are not defined!
// version in the configuration.json is outdated, or they are not defined!
try
{
var allVersion = tempConfigRegisters.Where(a => a.Key.GetIdent() == checkMinRegister)?.OrderByDescending(
@ -2017,6 +2187,48 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
return fullAlarm;
}
/// <inheritdoc/>
public void ClearAlarm()
{
var beforeCancelAlarmEnableMask = RegisterConverter.ByteArrayToValue<UInt32>(ReadRegister("CUSTOMER_AlarmEnableMask"));
var beforeCancelAlarmBroadcastMask = RegisterConverter.ByteArrayToValue<UInt32>(ReadRegister("CUSTOMER_AlarmBroadcastMask"));
WriteRegister("CUSTOMER_AlarmEnableMask", Alarm.ALL);
WriteRegister("CUSTOMER_AlarmBroadcastMask", Alarm.ALL);
WriteRegister(Register.Customer.TriggerAlarmCancel, Alarm.ALL);
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup1"))
{
// ReSharper disable once UnusedVariable used for debug
var x = ReadRegister("SENSUSRADIO_PersistenceGroup1");
WriteRegister("SENSUSRADIO_PersistenceGroup1", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup2"))
{
WriteRegister("SENSUSRADIO_PersistenceGroup2", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup3"))
{
WriteRegister("SENSUSRADIO_PersistenceGroup3", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup4"))
{
WriteRegister("SENSUSRADIO_PersistenceGroup4", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup5"))
{
WriteRegister("SENSUSRADIO_PersistenceGroup5", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup6"))
{
WriteRegister("SENSUSRADIO_PersistenceGroup6", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
WriteRegister("CUSTOMER_AlarmEnableMask", beforeCancelAlarmEnableMask);
WriteRegister("CUSTOMER_AlarmBroadcastMask", beforeCancelAlarmBroadcastMask);
}
/// <summary>
/// Reset the empty pipe alarm
/// </summary>
@ -2202,6 +2414,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2024-May-17" author="Thomas Wiedebusch">
/// - Changed sensitive information from "*****" to SHA256.
/// </remarks>
/// <remarks date="2025-Oct-13" author="Thomas Wiedebusch">
/// - Date size directly from register object.
/// </remarks>
public virtual Byte[] ReadRegister(String regName, Int32? expectedLength = null,
UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode)
{
@ -2210,14 +2425,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
var regDef = ConfigRegister.GetRegisterDefinitionByName(regName);
ConfigRegister.Set(regDef, null);
//_logger.Info($"Slot:{Slot} - Read register({regDef.GetIdent()})");
var hideDataInLog = regDef.RegisterName.Contains("EncryptionKey");
// setup length based on data type
if (!expectedLength.HasValue)
{
expectedLength = RegisterConverter.SizeOf(regDef);
expectedLength = regDef.DataSize;
}
var dataLengthPreset = expectedLength.Value;
@ -2403,7 +2617,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <inheritdoc />
public void WriteLog(String text)
{
Logger.Info($"Slot:{Slot} - {text}");
try
{
Logger.Info($"Slot:{Slot} - {text}");
}
catch (Exception)
{
// ignored
}
}
/// <inheritdoc />
@ -2457,9 +2678,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
try
{
Int32 i;
if (int.TryParse(LocalWebRequest.GetRequest(url, 30000), out i))
if (int.TryParse(LocalWebRequest.GetRequest(url, 30000), out var i))
{
return ((DisplayCodes)i);
}
@ -2534,7 +2753,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// - After write store configuration extended sleep.
/// </remarks>
/// <remarks date="2022-Jun-23" author="Thomas Wiedebusch">
/// - Removed comparison of allConfigRegisters less than 8 because the NA version has less registers and new
/// - Removed comparison of allConfigRegisters less than 8 because the NA version has fewer registers and new
/// apps will have a new register.
/// </remarks>
/// <remarks date="2022-Jul-22" author="Thomas Wiedebusch">
@ -2625,7 +2844,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// Upload app list to data base
/// Upload app list to database
/// </summary>
/// <param name="progressName"></param>
/// <param name="version"></param>
@ -2669,7 +2888,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <summary>
/// Backup current register dictionary to data base
/// Backup current register dictionary to database
/// </summary>
/// <exception cref="Exception"></exception>
public void StoreCurrentRegisterDic()
@ -2724,7 +2943,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private void PostRegisterRead(RegisterDefinition reg, Byte[] value)
{
var avoidLoggingRegisterNameList = Register.GetAvoidLogRegisters();
if (Configuration.UseRegisterWatchService && avoidLoggingRegisterNameList.All(regName => regName != reg.GetIdent()))
{
try
@ -2813,6 +3032,17 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
/// <summary>
/// Dummy
/// </summary>
/// <remarks date="???" author="Roland Drabesch">
/// - Initial.
/// </remarks>
public void BuildAndCheckCalibFactorsAllChannels(Double refVolumeCm, Double? refTimeS = null, Double reqDeviationPercent = 0, Double maxCalibFactorTolerancePercent = 0)
{
throw new NotImplementedException();
}
#endregion
}
}

View File

@ -25,10 +25,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
get;
}
/// <summary>
/// Interface information
/// </summary>
InterfaceInfo InterfaceInfo
{
get;
}
/// <summary>
/// This FW version is supported by the interface "configuration.json".
/// </summary>
Boolean InterfaceSupportsFwVersion
{
get;
}
/// <summary>
/// Transmit protocol access for underlie objects to change response timeout
/// </summary>
ITransmitProtocol TransmitProtocol{ get; }
ITransmitProtocol TransmitProtocol { get; }
/// <summary>
/// List of all present meter applications installed in meter
@ -89,10 +105,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// This is the meter size.
/// </summary>
String MeterSize
{
get;
}
String MeterSize { get; }
/// <summary>
/// Length of the meter.
@ -102,10 +115,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <summary>
/// Pressure sensor assembled to meter.
/// </summary>
Boolean PressureSensorAssembled
{
get;
}
Boolean PressureSensorAssembled { get; }
/// <summary>
/// Region (EMEA, NA or China).
@ -163,6 +173,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
get; set;
}
/// <summary>
/// Unlocked the property change ability for special sequences.
/// </summary>
Boolean UnlockEssentialProperties
{
get;
}
#endregion
#region methods
@ -173,6 +191,22 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary>
void CheckRegionSizeLutCrc();
/// <summary>
/// Unlocked the property change ability for special sequences.
/// </summary>
Boolean EnablePropertyChangeAbility(Boolean unlockPropertyChange);
/// <summary>
/// Set the meter size if previously unlocked.
/// The data types are: - String like "DN50" or
/// </summary>
Boolean SetMeterSize<T>(T meterSize);
/// <summary>
/// Set the pressure sensor if previously unlocked
/// </summary>
Boolean SetPressureSensorAssembled(Boolean pressureSensorAssembled);
/// <summary>
/// Reset the empty pipe alarm
/// </summary>
@ -207,7 +241,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </summary>
/// <returns></returns>
MeterRegisters GetConfigRegistersDefinitions();
/// <summary>
/// Common routine for reboot being able to override this routine which will be called in
/// MeteResetPsu to simulate a reboot.
@ -239,6 +273,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Byte[] ReadRegister(String regName, Int32? expectedLength = null,
UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode);
/// <summary>
/// Clear all pending alarms.
/// </summary>
/// <remarks date="2025-Aug-26" author="Roland Drabesch">
/// - Initial.
/// </remarks>
void ClearAlarm();
#endregion
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
/// <summary>
/// Collection of interface information
/// </summary>
public class InterfaceInfo
{
/// <summary>
/// The interface version
/// </summary>
public String InterfaceVersion { get; set; }
/// <summary>
/// List of supported FW versions by this interface
/// </summary>
public List<String> SupportedFwVersions { get; set; }
}
}

View File

@ -65,7 +65,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public void BuildAndCheckCalibFactorsAllChannels(Double refVolumeCm, Double? refTimeS, Double reqDeviationPercent, Double maxCalibFactorTolerancePercent = MeterConfig.DefaultMaxCalibFactorTolerancePercent)
public void BuildAndCheckCalibFactorsAllChannels(Double refVolumeCm, Double? refTimeS, Double reqDeviationPercent, Double maxCalibFactorTolerancePercent = MeterConfig.DefaultMaxCalibFactorTolerancePercent, int? testrunNr = null)
{
for (var channel = 0; channel < MeterConfig.CalibChannels; channel++)
{
@ -107,7 +107,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Logger.Info($"Slot:{Slot}, Channel:{channel} - New calibration factor({_calibFactor[channel - 1].GetRelativeCalibFactor()}rel/{calibFactorRel})");
Logger.Info($"Slot:{Slot}, Channel:{channel} - Calc /{ _calibFactor[channel - 1].GetMeterRawCalibFactor()} * {calibFactorRel.Value}) -> UInt16");
Logger.Info($"Slot:{Slot}, Channel:{channel} - Calc /{_calibFactor[channel - 1].GetMeterRawCalibFactor()} * {calibFactorRel.Value}) -> UInt16");
//Setup the required tolerance value to check against
@ -125,7 +125,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var warnMessage = $"Slot:{Slot}, Channel:{channel} - " +
$"Calibration factor is out of range({calibFactorRel.Value}rel)";
Logger.Warn(warnMessage);
throw new ApplicationException(warnMessage);
// throw new ApplicationException(warnMessage);
}
@ -138,7 +138,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
p2Value = _calibFactor[1].GetMeterRawCalibFactor(),
p3Target = reqDeviationPercent,
p3Value = _calibFactor[2].GetMeterRawCalibFactor(),
dt = DateTime.UtcNow
dt = DateTime.UtcNow,
testrunNr = testrunNr
};
@ -146,14 +148,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
try
{
var tmpUrl = "http://10.49.40.25/MeterProcessState/api/TestBench/SetCalibrationValues";
Logger.Info($"Request Url: { tmpUrl}");
Logger.Info($"Request Url: {tmpUrl}");
//ToDO: Update to service URl
LocalWebRequest.PostAsJson<JustageResults>(t, tmpUrl);
}
catch (Exception ex)
{
Logger.Error($"Request Url: { ex.Message}");
Logger.Error($"Request Url: {ex.Message}");
}
@ -209,10 +211,30 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
//WriteRegister<UInt16>(Register.Genesisflow.ForwardArrow, 0, checkRegister: true);
WriteRegister<UInt16>(Register.Genesisflow.StoreCalibration, 1);
Logger.Info($"Slot:{Slot} - StoreCalibration { RegisterConverter.ByteArrayToValue<UInt16>(ReadRegister(Register.Genesisflow.StoreCalibration))}");
Logger.Info($"Slot:{Slot} - StoreCalibration {RegisterConverter.ByteArrayToValue<UInt16>(ReadRegister(Register.Genesisflow.StoreCalibration))}");
WriteRegister<UInt16>(Register.Genesisflow.TriggerActive, 1);
Logger.Info($"Slot:{Slot} - Set forward arrow of LCD, reset accumulators, set sample rate to 2Hz");
WriteRegister<Byte>(Register.Genesisflow.SampleRate, 10, checkRegister: true);
try
{
if (GetRegistersDic().Any(a => a.Key.RegisterName == "GENESISFLOW_DelayedLedOff"))
{
WriteRegister("GENESISFLOW_DelayedLedOff", 60 * 60 * 2, true);
Logger.Info($"Slot:{Slot} - GENESISFLOW_DelayedLedOff to {60 * 60 * 2}S");
}
else
{
Logger.Info($"Slot:{Slot} - GENESISFLOW_DelayedLedOff is not present");
}
}
catch (Exception ex)
{
Logger.Info($"Slot:{Slot} - {ex}");
}
}
}
}

View File

@ -95,6 +95,19 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
//WriteRegister(Register.Genesisflow.StoreCalibration, 1);
//WriteRegister(Register.Genesisflow.StoreConfiguration, 1);
try
{
if (GetRegistersDic().Any(a => a.Key.RegisterName == "GENESISFLOW_DelayedLedOff"))
{
WriteRegister("GENESISFLOW_DelayedLedOff", 60 * 60 * 2, false);
}
}
catch (Exception)
{
}
}
else

Some files were not shown because too many files have changed in this diff Show More