From ef8f1cf7ccb3ed8954a71d561619b438522ecbf0 Mon Sep 17 00:00:00 2001 From: Stoyan Zlatev Date: Thu, 20 Feb 2025 15:27:22 +0100 Subject: [PATCH] sync the state --- Common/.vs/config/applicationhost.config | 2 +- Common/Common.sln | 67 ++ Common/CommonConsole/CommonConsole.csproj | 19 +- Common/CommonConsole/Program.cs | 187 ------ .../CordonelAssemblyLine.csproj | 11 +- .../Common.Hardware.SIRT.csproj | 12 +- .../Common.Hardware.SIRT/PamChanel.cs | 22 + .../Parameters/BluetoothOperating.cs | 2 - .../Common.Hardware.SIRT/Parameters/P11.cs | 2 - .../Common.Hardware.SIRT/Parameters/P12.cs | 2 - .../Common.Hardware.SIRT/Parameters/P811.cs | 2 - .../Common.Hardware.SIRT/Parameters/P821.cs | 2 - .../Parameters/PAMStatus.cs | 2 - .../Parameters/RFModuleOperating.cs | 2 - .../Parameters/SirtOperating.cs | 4 +- .../SIRTBroadcaster.Internal.cs | 41 +- .../SIRTBroadcaster.Public.cs | 2 - .../Common.Hardware.SIRT/SIRTFactory.cs | 32 +- .../Hardware/Common.Hardware.SIRT/SIRTKey.cs | 30 + .../Common.Hardware.SIRT/SIRTMessage.cs | 91 ++- .../Common.Hardware.SIRT/SIRTStream.cs | 263 ++++++++ .../Common.Hardware.SIRT/SIRTStreamFactory.cs | 81 +++ .../Common.Hardware.SIRT/SIRTTask.Internal.cs | 6 +- .../Common.Hardware.SIRT/SIRTTask.Public.cs | 4 +- .../SerialDataExtensions.cs | 584 ++++++++++++++++++ .../Common.Hardware.SIRT/SerialPort.cs | 207 +++++++ .../Registers/Json/JsonVersionsConverter.cs | 33 + ...ommon.Hardware.WaterMeter.eRegister.csproj | 5 +- .../Eregister.cs | 55 +- .../EregisterChangeMeterTypeTask.cs | 40 ++ .../EregisterCheckFinalizationTask.cs | 1 - .../EregisterCheckInitializationTask.cs | 6 +- .../EregisterExtensions.cs | 2 +- .../EregisterTask.cs | 28 +- .../Features/ActivateMetrologyTestMode.cs | 2 +- .../Features/AlarmsMask.cs | 2 +- .../Features/ChangeDataLoggerSettings.cs | 2 +- .../ChangeFixedDateReadingSettings.cs | 2 +- .../Features/ChangeMeterId.cs | 2 +- .../Features/ChangeMeterReading.cs | 2 +- .../Features/ChangeRadioId.cs | 2 +- .../Features/ChangeSensusRFEncryptionKey.cs | 2 +- .../OpenMeteringTransmitionIntervalWMBus.cs | 2 +- .../Features/ParameterizeLeakageDetection.cs | 2 +- .../Features/SendBubbleUpBurst.cs | 2 +- .../Features/SetAlarms.cs | 2 +- .../Features/SetBytterySeconds.cs | 2 +- .../Features/SetDateAndTime.cs | 2 +- .../Features/SetFrequencyOffset.cs | 2 +- .../Features/SetMetrologyParameters.cs | 2 +- .../Features/SetPcbId.cs | 2 +- .../Features/SetTFXParameters.cs | 2 +- .../Features/WirelessMBusMode.cs | 2 +- .../Models/EregisterProgrammingParameters.cs | 11 +- .../Telegrams/BUP.cs | 2 +- .../Telegrams/DEBUG.cs | 2 +- .../Telegrams/Payload.cs | 2 +- .../Telegrams/SEMI.cs | 2 +- Common/LaaPackages | 2 +- Common/Ui/Common.UI/App.config | 2 +- Common/Ui/Common.UI/Common.UI.csproj | 5 - .../Common.UI/Controls/SIRTBroadcasters.xaml | 126 ++-- Common/Ui/Common.UI/Infrastructure/AppHost.cs | 2 +- Common/Ui/Common.UI/MainWindow.xaml | 2 +- .../Ui/Common.UI/Models/SIRTFactoryModel.cs | 42 -- .../Ui/Common.UI/Pages/EregisterFinalize.xaml | 11 +- .../Common.UI/Pages/EregisterInitialize.xaml | 17 +- .../ViewModels/EregisterInitializeVM.cs | 38 +- .../Common.UI/ViewModels/SIRTBroadcasterVM.cs | 179 +----- .../Common.UI/ViewModels/SIRTConnectionVM.cs | 77 ++- 70 files changed, 1714 insertions(+), 695 deletions(-) create mode 100644 Common/Hardware/Common.Hardware.SIRT/PamChanel.cs create mode 100644 Common/Hardware/Common.Hardware.SIRT/SIRTKey.cs create mode 100644 Common/Hardware/Common.Hardware.SIRT/SIRTStream.cs create mode 100644 Common/Hardware/Common.Hardware.SIRT/SIRTStreamFactory.cs create mode 100644 Common/Hardware/Common.Hardware.SIRT/SerialDataExtensions.cs create mode 100644 Common/Hardware/Common.Hardware.SIRT/SerialPort.cs create mode 100644 Common/Hardware/WaterMeter/Genesis/Registers/Json/JsonVersionsConverter.cs create mode 100644 Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterChangeMeterTypeTask.cs delete mode 100644 Common/Ui/Common.UI/Models/SIRTFactoryModel.cs diff --git a/Common/.vs/config/applicationhost.config b/Common/.vs/config/applicationhost.config index de10b180..a894c3cf 100644 --- a/Common/.vs/config/applicationhost.config +++ b/Common/.vs/config/applicationhost.config @@ -155,7 +155,7 @@ - + diff --git a/Common/Common.sln b/Common/Common.sln index 57877fd6..ef8a8b2d 100644 --- a/Common/Common.sln +++ b/Common/Common.sln @@ -356,6 +356,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaPackages.HttpClient", "L EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stichproben", "Stichproben\Stichproben.csproj", "{F69A79FA-548D-4E21-887E-01FABDAD9E73}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaaPackages.Features.Cordonel", "LaaPackages\LaaPackages.Features.Cordonel\LaaPackages.Features.Cordonel.csproj", "{8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4 @@ -5638,6 +5640,70 @@ Global {F69A79FA-548D-4E21-887E-01FABDAD9E73}.XP32bit|x64.Build.0 = Release|Any CPU {F69A79FA-548D-4E21-887E-01FABDAD9E73}.XP32bit|x86.ActiveCfg = Release|Any CPU {F69A79FA-548D-4E21-887E-01FABDAD9E73}.XP32bit|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.COM|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|x64.ActiveCfg = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|x64.Build.0 = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|x86.ActiveCfg = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Debug|x86.Build.0 = Debug|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.PerformTest|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.Release|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.ReleaseTest|x86.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|Any CPU.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|x64.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|x64.Build.0 = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|x86.ActiveCfg = Release|Any CPU + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB}.XP32bit|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -5783,6 +5849,7 @@ Global {F90B940C-9A83-496D-AAE0-11CD02CE0A22} = {2E31C385-4FFC-473E-9C00-D7DC48140704} {C9816412-7752-4F7A-8BD2-765DB6D58B3C} = {2E31C385-4FFC-473E-9C00-D7DC48140704} {F69A79FA-548D-4E21-887E-01FABDAD9E73} = {696A94BE-7237-4AE2-9E36-6059DE519971} + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB} = {2E31C385-4FFC-473E-9C00-D7DC48140704} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164} diff --git a/Common/CommonConsole/CommonConsole.csproj b/Common/CommonConsole/CommonConsole.csproj index f9cee383..b754bbe4 100644 --- a/Common/CommonConsole/CommonConsole.csproj +++ b/Common/CommonConsole/CommonConsole.csproj @@ -57,11 +57,24 @@ + - - {4E8BB839-D40A-488C-88CE-F21811F1F476} - Common.Hardware.WaterMeter.eRegister + + {f013a56b-7be6-4852-9cd8-b971cd1add0c} + GenesisConfig + + + {04201e95-90a0-4b73-a72f-379739b2a3ae} + GenesisCore + + + {f4aaf7e6-7333-4284-b735-e32deb076c64} + Registers + + + {8BEFD3AC-BB21-4B62-8D9A-CF8CBFD439EB} + LaaPackages.Features.Cordonel {F69A79FA-548D-4E21-887E-01FABDAD9E73} diff --git a/Common/CommonConsole/Program.cs b/Common/CommonConsole/Program.cs index f43aac82..5cb6671b 100644 --- a/Common/CommonConsole/Program.cs +++ b/Common/CommonConsole/Program.cs @@ -1,197 +1,10 @@ namespace CommonConsole { - using Common.Hardware.WaterMeter.eRegister.Features; - using Common.Hardware.WaterMeter.eRegister.Models; - - using Stichproben.Cordonel; - - using System; - using System.Collections.Generic; - using System.Reflection; - public static class Program { public static void Main() { - var stichproben = new Stichproben(typeof(Program).Assembly.Location); - var result = stichproben.ShouldBePressureTested(20250205); } - - - public static void ___Main() - { - var features = new List(); - - foreach (var featureInfo in typeof(EregisterFeatures).GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - var featurePamAttribute = featureInfo.GetCustomAttribute(); - - if (featurePamAttribute is null) - { - continue; - } - - var featureType = featureInfo.PropertyType; - - if (typeof(Pam).IsAssignableFrom(featureType)) - { - var featurePam = Activator.CreateInstance(featureType) as Pam; - var feature = new EregisterFeature - { - FeatureType = featureType, - Cmd = featurePam.CmdHex, - IsSingleCmd = featurePamAttribute.IsSingleCmd, - OnlyProductionMode = featurePamAttribute.OnlyProductionMode, - AuthLevel = featurePamAttribute.AuthLevel, - }; - - foreach (var featurePropertyInfo in feature.FeatureType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - if (!featurePropertyInfo.CanRead || !featureInfo.CanWrite) - { - continue; - } - - - feature.Add(new EregisterFeatureProperty - { - Name = featurePropertyInfo.Name, - Type = featurePropertyInfo.PropertyType, - Getter = featurePropertyInfo.GetValue, - Setter = featurePropertyInfo.SetValue, - }); - } - - features.Add(feature); - } - else if (featureType == typeof(EregisterDebugFeatures)) - { - var feature = new EregisterDebugFeature - { - AuthLevel = AuthLevel.III, - Cmd = "F1", - FeatureType = featureType, - IsSingleCmd = true - }; - - foreach (var debugFeatureFeatureInfo in typeof(EregisterDebugFeatures).GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - var debugFeaturePamAttribute = debugFeatureFeatureInfo.GetCustomAttribute(); - - if (debugFeaturePamAttribute is null) - { - continue; - } - - var debugFeatureType = debugFeatureFeatureInfo.PropertyType; - var debugFeaturePam = Activator.CreateInstance(debugFeatureType) as Pam; - var debugFeature = new EregisterDebugFeature - { - FeatureType = featureType, - Cmd = debugFeaturePam.CmdHex, - IsSingleCmd = featurePamAttribute.IsSingleCmd, - OnlyProductionMode = featurePamAttribute.OnlyProductionMode, - AuthLevel = featurePamAttribute.AuthLevel, - }; - - foreach (var debugFeaturePropertyInfo in debugFeatureType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - if (!debugFeaturePropertyInfo.CanRead || !featureInfo.CanWrite) - { - continue; - } - - debugFeature.Add(new EregisterFeatureProperty - { - Name = debugFeaturePropertyInfo.Name, - Type = debugFeaturePropertyInfo.PropertyType, - Getter = debugFeaturePropertyInfo.GetValue, - Setter = debugFeaturePropertyInfo.SetValue, - }); - } - - feature.Add(debugFeature); - } - - features.Add(feature); - } - } - - foreach (var feature in features) - { - foreach (var items in feature.GetItems()) - { - Console.Write($"{items[0],40}"); - Console.Write($"{items[1],5}"); - Console.Write($"{items[2],5}"); - Console.Write($"{items[3],5}"); - Console.Write($"{items[4],5}"); - Console.WriteLine(); - } - } - } - } - - public class EregisterFeature - { - private readonly ICollection properties - = new List(); - - public Type FeatureType { get; set; } - - public string Cmd { get; set; } - - public bool IsSingleCmd { get; set; } - - public bool OnlyProductionMode { get; set; } - - public AuthLevel AuthLevel { get; set; } - - public virtual void Add(EregisterFeatureProperty eregisterFeatureProperty) - => this.properties.Add(eregisterFeatureProperty); - - public virtual IEnumerable GetItems() - { - yield return new[] - { - this.FeatureType.Name, - this.Cmd, - $"{this.AuthLevel}", - this.IsSingleCmd ? "v" : " ", - this.OnlyProductionMode ? "v" : " " - }; - } - } - - public class EregisterDebugFeature : EregisterFeature - { - private readonly ICollection features - = new List(); - - public virtual void Add(EregisterFeature feature) - => this.features.Add(feature); - - public override IEnumerable GetItems() - { - foreach (var feature in this.features) - { - foreach (var items in feature.GetItems()) - { - yield return items; - } - } - } - } - - public class EregisterFeatureProperty - { - public string Name { get; set; } - - public Type Type { get; set; } - - public Func Getter { get; set; } - - public Action Setter { get; set; } } } \ No newline at end of file diff --git a/Common/CordonelAssemblyLine/CordonelAssemblyLine.csproj b/Common/CordonelAssemblyLine/CordonelAssemblyLine.csproj index 324f374d..6148fb5a 100644 --- a/Common/CordonelAssemblyLine/CordonelAssemblyLine.csproj +++ b/Common/CordonelAssemblyLine/CordonelAssemblyLine.csproj @@ -14,10 +14,10 @@ 4 true true - false - \\sla12file\auftrag\Aktuelle Anwendungen\CAL\ + true + \\SLA12IIS01\LaaProductionWeb\Apps\CordonelAssembly\ true - Unc + Web true Foreground 7 @@ -25,12 +25,13 @@ false false true - \\sla12file\auftrag\Aktuelle Anwendungen\CAL\ + http://sla12iis01.emea.sensus.net/LaaProductionWeb/Apps/CordonelAssembly/ Cordonel Assembly Line Xylem Sensus Laatzen Cordonel Assembly Line + true publish.htm - 6 + 8 1.0.0.%2a false true diff --git a/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj b/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj index 046490be..f3d094c8 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj +++ b/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj @@ -43,6 +43,7 @@ + @@ -55,21 +56,20 @@ + + + + + - - - {9ae071c0-db12-4e09-a3c7-43f6dcd518d6} - Common.Hardware.Ports - - \ No newline at end of file diff --git a/Common/Hardware/Common.Hardware.SIRT/PamChanel.cs b/Common/Hardware/Common.Hardware.SIRT/PamChanel.cs new file mode 100644 index 00000000..dd767934 --- /dev/null +++ b/Common/Hardware/Common.Hardware.SIRT/PamChanel.cs @@ -0,0 +1,22 @@ +namespace Common.Hardware.SIRT +{ + using System; + using System.Collections.Concurrent; + + public class PamChanel + { + private readonly ConcurrentQueue tasks = new ConcurrentQueue(); + + public uint Address { get; set; } + + public void Push(SIRTMessage message) + { + + } + + internal void Pop() + { + throw new NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/BluetoothOperating.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/BluetoothOperating.cs index 1ddb845a..8e03de10 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/BluetoothOperating.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/BluetoothOperating.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - public class BluetoothOperating { private readonly byte[] bits; diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/P11.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/P11.cs index 5e798312..66d95785 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/P11.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/P11.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - using System.Text; /// diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/P12.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/P12.cs index 0e67df2a..63afe912 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/P12.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/P12.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - using System; /// diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/P811.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/P811.cs index 58a36787..0fa603c4 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/P811.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/P811.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - /// /// Parameter P81-1 is the first modifier of "Write to PAM Pool" command and is placed at third position, /// if telegram from PC -> SIRT begins with {0x55, 0x81}. diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/P821.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/P821.cs index 33390c12..669ce466 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/P821.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/P821.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - public class P821 { private readonly byte[] bits; diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/PAMStatus.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/PAMStatus.cs index ca939000..132ce6bb 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/PAMStatus.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/PAMStatus.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - using System.Text; public class PAMStatus diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/RFModuleOperating.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/RFModuleOperating.cs index 79955af1..b996434d 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/RFModuleOperating.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/RFModuleOperating.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - using System; public class RFModuleOperating diff --git a/Common/Hardware/Common.Hardware.SIRT/Parameters/SirtOperating.cs b/Common/Hardware/Common.Hardware.SIRT/Parameters/SirtOperating.cs index fe67c05e..2d723368 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Parameters/SirtOperating.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Parameters/SirtOperating.cs @@ -1,7 +1,5 @@ -namespace Common.Hardware.SIRT +namespace Common.Hardware.SIRT.Parameters { - using Common.Hardware.Ports; - public class SirtOperating { private readonly byte[] bits; diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Internal.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Internal.cs index da60c062..14ab674b 100644 --- a/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Internal.cs +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Internal.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT { - using Common.Hardware.Ports; - using System.Collections.Concurrent; using System.Threading.Tasks; using System.Threading; @@ -13,6 +11,8 @@ { private readonly ConcurrentDictionary> tasks = new ConcurrentDictionary>(); + private readonly ManualResetEventSlim tasksAwaiter = new ManualResetEventSlim(); + private readonly IList tasksInPampool = new List(); private readonly SerialPort serialPort; private CancellationTokenSource cancellationTokenSource; @@ -165,29 +165,41 @@ { this.IsActivated = true; - this.processingTask = Task.Factory.StartNew(() => + this.processingTask = Task.Factory.StartNew(async () => { - var manualResetEventSlim = new ManualResetEventSlim(); - while (!this.cancellationToken.IsCancellationRequested) { + if (this.tasksInPampool.Count >= 5) + { + this.tasksAwaiter.Wait(); + this.tasksAwaiter.Reset(); + } + foreach (var tasksQueue in this.tasks.Values.ToArray()) { + if (this.tasksInPampool.Count >= 5) + { + this.tasksAwaiter.Wait(); + this.tasksAwaiter.Reset(); + } + if (tasksQueue.TryPeek(out var task) && task.State == SIRTTaskState.Pending) { + this.tasksInPampool.Add(true); this.serialPort.Write(task.Start()); this.Logging?.Invoke(task.ToString()); } - manualResetEventSlim.Wait(100); - manualResetEventSlim.Reset(); + await Task.Delay(10); } - manualResetEventSlim.Wait(100); - manualResetEventSlim.Reset(); + await Task.Delay(10); } - }, this.cancellationToken, TaskCreationOptions.LongRunning, TaskScheduler.Current) + } + , this.cancellationToken + , TaskCreationOptions.LongRunning + , TaskScheduler.Current) .ContinueWith(this.ExceptionLogging); } @@ -268,6 +280,15 @@ task.Cancelled -= this.OnStateChanged; task.Completed -= this.OnStateChanged; task.Timeouted -= this.OnTaskTimeout; + + var lastIX = this.tasksInPampool.Count - 1; + + if (lastIX >= 0) + { + this.tasksInPampool.RemoveAt(lastIX); + } + + this.tasksAwaiter.Set(); } private bool TryRun(TTask task) where TTask : SIRTTask diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Public.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Public.cs index 8d58f0bf..7cddb6bd 100644 --- a/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Public.cs +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTBroadcaster.Public.cs @@ -1,7 +1,5 @@ namespace Common.Hardware.SIRT { - using Common.Hardware.Ports; - using System; using System.Collections.Concurrent; diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTFactory.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTFactory.cs index 7429bfb9..92059385 100644 --- a/Common/Hardware/Common.Hardware.SIRT/SIRTFactory.cs +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTFactory.cs @@ -21,15 +21,6 @@ } } - public void CloseConnections() - { - foreach (var broadcaster in this.GetConnections()) - { - broadcaster.Logging -= this.NotifyMessage; - broadcaster.Close(); - } - } - public void DequeueTasks(uint address) { foreach (var broadcaster in this.GetConnections()) @@ -38,15 +29,6 @@ } } - public void OpenConnections() - { - foreach (var broadcaster in this.GetConnections()) - { - broadcaster.Logging += this.NotifyMessage; - broadcaster.Open(); - } - } - public void ConnectSIRT(string portName, Action callback) { if (!this.broadcasters.TryGetValue(portName, out var broadcaster)) @@ -60,13 +42,12 @@ } } - callback(broadcaster); - if (broadcaster?.IsActivated == false) { - broadcaster?.Close(); broadcaster?.Open(); } + + callback(broadcaster); } public void EnqueueTask(SIRTTask task) @@ -77,9 +58,6 @@ } } - public IEnumerable GetPortNames() - => this.broadcasters.Keys.ToArray(); - public void RemoveConnections() { foreach (var key in this.broadcasters.Keys.ToArray()) @@ -92,10 +70,10 @@ } } + private IEnumerable GetConnections() + => this.broadcasters.Values.ToArray(); + private void NotifyMessage(string message) => this.Logging?.Invoke(message); - - private IEnumerable GetConnections() - => this.broadcasters.Values.ToArray(); } } diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTKey.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTKey.cs new file mode 100644 index 00000000..1a34a006 --- /dev/null +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTKey.cs @@ -0,0 +1,30 @@ +namespace Common.Hardware.SIRT +{ + using System; + + public struct SIRTKey : IEquatable + { + public SIRTKey(string identity, int frecuency) : this() + { + this.SirtId = identity; + this.Frequency = frecuency; + } + + public string SirtId { get; set; } + + public int Frequency { get; set; } + + public bool Equals(SIRTKey other) + => other.SirtId == this.SirtId; + + public override bool Equals(object other) + => other is SIRTKey sirtKey + && this.Equals(sirtKey); + + public override int GetHashCode() + => this.ToString().GetHashCode(); + + public override string ToString() + => $"{this.SirtId}|{this.Frequency}"; + } +} diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTMessage.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTMessage.cs index e9b11931..b3e7b3ed 100644 --- a/Common/Hardware/Common.Hardware.SIRT/SIRTMessage.cs +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTMessage.cs @@ -1,7 +1,7 @@ namespace Common.Hardware.SIRT { - using Common.Hardware.Ports; - using Newtonsoft.Json; + using Common.Hardware.SIRT.Parameters; + using System; public class SIRTMessage @@ -26,13 +26,17 @@ public SIRTMessage() { this.bytes = new byte[MIN_LEN]; - this.bytes[0] = PC2SIRT; + this.Start = PC2SIRT; + this.Stop = STOP; } - public SIRTMessage(byte[] bytes) + public SIRTMessage(byte[] bytes) : this() + => this.bytes = bytes; + + public byte Start { - this.bytes = bytes; - this.bytes[0] = SIRT2PC; + get => this.bytes[0]; + set => this.bytes[0] = value; } public byte Cmd @@ -59,9 +63,12 @@ set => value.GetBytesBE().CopyTo(this.bytes, 4); } - public byte Length => this.bytes[8]; + public byte Length + { + get => this.bytes[8]; + set => this.bytes[8] = value; + } - [JsonIgnore] public byte[] Data { get @@ -87,24 +94,68 @@ } } - public ushort CRC => this.bytes.ToUInt16BE(this.bytes.Length - 3); - - public string Content => this.ToString(); - - public byte[] ToByteArray() + public ushort CRC { - var length = this.bytes.Length; - var crc = this.bytes.CRCCCITT(1, length - 3); - var crcBytes = crc.GetBytesBE(); + get => this.bytes.ToUInt16BE(this.bytes.Length - 3); + set => value.GetBytesBE().CopyTo(this.bytes, this.bytes.Length - 3); + } - this.bytes[length - 3] = crcBytes[0]; - this.bytes[length - 2] = crcBytes[1]; - this.bytes[length - 1] = STOP; + public byte Stop + { + get => this.bytes[this.bytes.Length - 1]; + set => this.bytes[this.bytes.Length - 1] = value; + } + + public byte[] GetBytes() + { + this.CRC = this.bytes.CRCCCITT(1, this.bytes.Length - 3); + this.Stop = STOP; return this.bytes; } public override string ToString() - => BitConverter.ToString(this.ToByteArray()); + => BitConverter.ToString(this.bytes); + + public static implicit operator byte[] (SIRTMessage message) + => message.bytes; + + public static implicit operator SIRTMessage(byte[] bytes) + => new SIRTMessage(bytes); + + internal static SIRTMessage Activate = new SIRTMessage + { + Cmd = W_REG, + Address = 0x20000000, + P2 = 0x05, + Data = new byte[] + { + new SirtOperating { /* default */ }, + new BluetoothOperating { BtOff = true }, + new RFModuleOperating { RfOff = true }, + new RFModuleOperating { OpMode = OperatingModes.ReceiveF1TransmitSensusRFF3 }, + new PamTimeout { Minutes = 1 } + } + }; + + internal static SIRTMessage Identify = new SIRTMessage + { + Cmd = SIRTMessage.R_REG, + Address = 0x11001820, + P2 = 0x08 + }; + + internal static readonly SIRTMessage ReadPamPool = new SIRTMessage + { + Cmd = R_PAM, + Address = 0xFFFFFFFF + }; + + internal static SIRTMessage DeleteFromPamPool(uint address) => new SIRTMessage + { + Cmd = W_PAM, + P1 = new P811 { DelPamAdr = true }, + Address = address + }; } } diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTStream.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTStream.cs new file mode 100644 index 00000000..f30f93df --- /dev/null +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTStream.cs @@ -0,0 +1,263 @@ +namespace Common.Hardware.SIRT +{ + using System; + using System.Collections.Generic; + using System.IO.Ports; + using System.Threading; + using System.Threading.Tasks; + + using SystemSerialPort = System.IO.Ports.SerialPort; + + public class SIRTStream + { + private readonly SystemSerialPort serialPort = new SystemSerialPort + { + BaudRate = 112500, + DataBits = 8, + Parity = Parity.None, + StopBits = StopBits.One + }; + + public bool IsRunning { get; private set; } + + public string Identity { get; private set; } + + public int Frecuency { get; private set; } + + public SIRTKey Key { get; private set; } + + public string PortName => this.serialPort.PortName; + + public void Close(int timeout = 3000) + { + var disposeAwaiter = new ManualResetEventSlim(); + + void Disposed(object _, EventArgs _1) + { + this.serialPort.Disposed -= Disposed; + disposeAwaiter.Set(); + } + + try + { + this.serialPort.Disposed += Disposed; + this.serialPort.Close(); + disposeAwaiter.Wait(timeout); + } + catch // TODO: (Exception e) + { + this.serialPort.Disposed -= Disposed; + disposeAwaiter.Set(); + } + } + + public void Open(string portName, int timeout = 3000) + { + if (this.serialPort.IsOpen) + { + this.IsRunning = false; + + this.Close(); + } + + this.serialPort.PortName = portName; + + try + { + this.serialPort.Open(); + } + catch // TODO: (Exception e) + { + return; + } + + var sirtRequest = default(SIRTMessage); + var sirtRequestBytes = default(byte[]); + var sirtResponse = default(SIRTMessage); + var sirtResponseAwaiter = new ManualResetEventSlim(); + var cancellationTokenSource = new CancellationTokenSource(); + var cancellationToken = cancellationTokenSource.Token; + var cancellationTask = Task.Run(() => + { + foreach (var message in this.ReadStream()) + { + var sameAddress = message.Address == sirtRequest?.Address; + var isAnswer = message.Cmd == SIRTMessage.ACKNANSW; + var withNoErrors = message.P1 == 0; + var readOrWrite = message.P2 == SIRTMessage.W_REG || message.P2 == SIRTMessage.R_REG; + + if (sameAddress && isAnswer && withNoErrors && readOrWrite) + { + sirtResponse = message; + sirtResponseAwaiter.Set(); + } + } + }, cancellationToken); + + try + { + sirtResponse = null; + sirtRequest = SIRTMessage.Activate; + sirtRequestBytes = sirtRequest.GetBytes(); + + for (var i = 0; i < 5; i++) + { + this.Write(sirtRequestBytes); + sirtResponseAwaiter.Wait(timeout); + sirtResponseAwaiter.Reset(); + + if (sirtResponse != null) + { + break; + } + } + + sirtResponse = null; + sirtRequest = SIRTMessage.Identify; + sirtRequestBytes = sirtRequest.GetBytes(); + + for (var i = 0; i < 5; i++) + { + this.Write(sirtRequestBytes); + sirtResponseAwaiter.Wait(timeout); + sirtResponseAwaiter.Reset(); + + if (sirtResponse != null) + { + this.IsRunning = true; + this.Identity = BitConverter.ToString(sirtResponse.Data ?? Array.Empty()); + this.Frecuency = string.IsNullOrWhiteSpace(this.Identity) + ? -1 + : this.Identity[10] == '0' + ? 868 + : 433; + this.Key = new SIRTKey(this.Identity, this.Frecuency); + + break; + } + } + + cancellationTokenSource.Cancel(); + } + catch // TODO: (Exception e) + { + return; + } + } + + public IEnumerable ReadStream() + { + var readAwaiter = new ManualResetEventSlim(); + + void DataReceived(object _, SerialDataReceivedEventArgs args) + { + if (args.EventType == SerialData.Chars) + { + readAwaiter.Set(); + } + } + + this.serialPort.DataReceived += DataReceived; + + var buffer = new List(); + var bytes = default(byte[]); + var length = default(int); + + while (this.serialPort.IsOpen) + { + readAwaiter.Wait(); + readAwaiter.Reset(); + + bytes = new byte[this.serialPort.BytesToRead]; + length = this.serialPort.Read(bytes, 0, bytes.Length); + + if (length <= 0) + { + continue; + } + + buffer.AddRange(bytes); + + while (this.TryParseMessage(buffer, out var message)) + { + yield return message; + } + } + + this.serialPort.DataReceived -= DataReceived; + } + + public void Write(byte[] bytes) + { + if (this.serialPort.IsOpen && bytes?.Length > 0) + { + this.serialPort.Write(bytes, 0, bytes.Length); + } + } + + private bool TryParseMessage(List buffer, out SIRTMessage message) + { + message = default(SIRTMessage); + + var bufferLength = buffer.Count; + + if (bufferLength <= 0) + { + return false; + } + + var msgLength = 0; + var msg = default(byte[]); + + var startIX = buffer.IndexOf(SIRTMessage.SIRT2PC); + + if (startIX < 0) + { + buffer.Clear(); + + return false; + } + + var lengthIX = startIX + 8; + + if (lengthIX >= bufferLength) + { + return false; + } + + var dataLength = buffer[lengthIX]; + var stopIX = lengthIX + dataLength + 3; + + if (stopIX >= bufferLength) + { + return false; + } + + if (buffer[stopIX] != SIRTMessage.STOP) + { + startIX = buffer.IndexOf(SIRTMessage.SIRT2PC, startIX + 1); + + if (startIX >= 0) + { + buffer.RemoveRange(0, startIX + 1); + } + else + { + buffer.Clear(); + } + + return false; + } + + msgLength = stopIX - startIX + 1; + msg = new byte[msgLength]; + + buffer.CopyTo(startIX, msg, 0, msgLength); + buffer.RemoveRange(0, startIX + msgLength); + + message = new SIRTMessage(msg); + + return true; + } + } +} diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTStreamFactory.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTStreamFactory.cs new file mode 100644 index 00000000..79605887 --- /dev/null +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTStreamFactory.cs @@ -0,0 +1,81 @@ +namespace Common.Hardware.SIRT +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + + public class SIRTStreamFactory + { + private readonly ConcurrentDictionary streams = new ConcurrentDictionary(); + private readonly ConcurrentDictionary> pams = new ConcurrentDictionary>(); + private readonly ConcurrentDictionary readers = new ConcurrentDictionary(); + private readonly ConcurrentDictionary chanels + = new ConcurrentDictionary(); + private readonly ConcurrentDictionary> addresses + = new ConcurrentDictionary>(); + + private CancellationTokenSource cancellationTokenSource; + private CancellationToken cancellationToken; + private Task cancellationTaks; + + public void ConnectSirts(params string[] portNames) + { + this.cancellationTokenSource = new CancellationTokenSource(); + this.cancellationToken = this.cancellationTokenSource.Token; + var tasks = new List(); + + foreach (var portName in portNames.Intersect(SerialPort.GetPortNames())) + { + var task = Task.Run(() => + { + var sirtStream = new SIRTStream(); + sirtStream.Open(portName); + + if (sirtStream.IsRunning) + { + this.streams.GetOrAdd(sirtStream.Key, sirtStream); + this.pams.GetOrAdd(sirtStream.Key, new List()); + this.readers.GetOrAdd(sirtStream.Key, Task.Run(() => + { + var stream = sirtStream; + var key = stream.Key; + + foreach (var message in stream.ReadStream()) + { + var address = message.Address; + + this.addresses + .GetOrAdd(address, new ConcurrentBag()) + .Add(key); + + this.chanels + .GetOrAdd(message.Address, new PamChanel()) + .Push(message); + } + } + , this.cancellationToken)); + } + }); + + tasks.Add(task); + } + + Task.WaitAll(tasks.ToArray()); + this.cancellationTaks = Task.Run((Action)this.StartSendingPams, this.cancellationToken); + } + + private void StartSendingPams() + { + while (!this.cancellationToken.IsCancellationRequested) + { + foreach (var chanel in this.chanels.Values) + { + chanel.Pop(); + } + } + } + } +} diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Internal.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Internal.cs index d7fae13c..33d55e6e 100644 --- a/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Internal.cs +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Internal.cs @@ -21,9 +21,9 @@ return Array.Empty(); } - internal class AnswerTask : SIRTTask + public class AnswerTask : SIRTTask { - public AnswerTask() : base(0, 1000) + public AnswerTask() : base(0, 3000) { } @@ -38,7 +38,7 @@ } } - internal static readonly AnswerTask ActivateSIRT = new AnswerTask + public static readonly AnswerTask ActivateSIRT = new AnswerTask { Cmd = SIRTMessage.W_REG, RequestAddress = 0x20000000, diff --git a/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Public.cs b/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Public.cs index 2188103a..b5981867 100644 --- a/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Public.cs +++ b/Common/Hardware/Common.Hardware.SIRT/SIRTTask.Public.cs @@ -69,7 +69,7 @@ public int Frequency { get; } - public SIRTTaskState State { get; protected set; } + public SIRTTaskState State { get; set; } public void PushResponse(SIRTMessage response) { @@ -84,7 +84,7 @@ } } - public virtual byte[] ToByteArray() => this.request.ToByteArray(); + public virtual byte[] ToByteArray() => this.request.GetBytes(); public override string ToString() => BitConverter.ToString(this.ToByteArray()); diff --git a/Common/Hardware/Common.Hardware.SIRT/SerialDataExtensions.cs b/Common/Hardware/Common.Hardware.SIRT/SerialDataExtensions.cs new file mode 100644 index 00000000..0a95d106 --- /dev/null +++ b/Common/Hardware/Common.Hardware.SIRT/SerialDataExtensions.cs @@ -0,0 +1,584 @@ +namespace Common.Hardware.SIRT +{ + using System; + using System.Collections.Generic; + using System.Text.RegularExpressions; + + public static class SerialDataExtensions + { + private const int ByteSize = 8; + private const int SByteSize = 16; + private const int Int16Size = 16; + private const int UInt16Size = 16; + private const int Int32Size = 32; + private const int UInt32Size = 32; + 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) + { + var bits = new byte[ByteSize]; + + for (var i = 0; i < ByteSize; i++) + { + bits[i] = (byte)((value >> i) & 1); + } + + return bits; + } + + public static byte[] GetBitsLE(this ushort value) + { + var bits = new byte[UInt16Size]; + + for (var i = 0; i < UInt16Size; i++) + { + bits[i] = (byte)((value >> i) & 1); + } + + return bits; + } + + public static byte GetByteLE(this byte[] bits) + { + if (bits is null) + { + return default(byte); + } + + var value = default(byte); + + for (var i = 0; i < ByteSize; i++) + { + value ^= (byte)(bits[i] << i); + } + + return value; + } + + public static byte GetByteLE(this byte[] bits, int start = 0, int count = 0) + { + if (bits is null) + { + return default(byte); + } + + if (count == 0) + { + count = bits.Length; + } + + var length = start + count; + var _byte = default(byte); + + for (int i = start, x = 0; i < length; i++, x++) + { + _byte ^= (byte)(bits[i] << x); + } + + return _byte; + } + + public static void SetBitsLE(this byte value, byte[] bits, int start = 0, int count = 0) + { + if (bits is null) + { + return; + } + + if (count == 0 || count > bits.Length) + { + count = bits.Length; + } + + for (int i = start, x = 0; i < count; i++, x++) + { + bits[i] = (byte)((value >> x) % 2); + } + } + + 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) + { + var bytes = new byte[4]; + var index = 0; + + 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 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) + { + var bytes = new byte[2]; + var index = 0; + + bytes[index++] = (byte)(value >> 8); + bytes[index] = (byte)value; + + return bytes; + } + + public static byte[] GetBytesBE(this uint value) + { + var bytes = new byte[4]; + var index = 0; + + 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 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]; + 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 sbyte ToSByteBE(this byte[] bytes, int start = 0) + { + 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]; + + return value; + } + + public static int ToInt32BE(this byte[] bytes, int start = 0) + { + 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]; + + return value; + } + + public static ushort ToUInt16BE(this byte[] bytes, int start = 0) + { + var value = default(ushort); + + value ^= (ushort)(bytes[start++] << 8); + value ^= bytes[start]; + + return value; + } + + public static uint ToUInt32BE(this byte[] bytes, int start = 0) + { + 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; + + return value; + } + + public static ushort ToUInt16LE(this byte[] bytes, int start = 0) + { + var value = default(ushort); + + value ^= bytes[start++]; + value ^= (ushort)(bytes[start] << 8); + + return value; + } + + public static ushort ToUIint16LEFromBits(this byte[] bits) + { + const int size = 16; + + if (bits is null) + { + bits = new byte[size]; + } + + Array.Resize(ref bits, size); + + ushort value = 0; + + for (var i = 0; i < size; 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 (length == 0) + { + length = bytes.Length; + } + + var crc = (ushort)0xFFFF; + + for (var b = start; b < length; b++) + { + var _byte = bytes[b]; + var token = (ushort)((_byte << 8) & 0xFF00); + + for (var i = 0; i < 8; i++) + { + if (0x8000 == ((crc ^ token) & 0x8000)) + { + crc <<= 1; + crc ^= 0x1021; + } + else + { + crc <<= 1; + } + + token <<= 1; + } + } + + return crc; + } + + public static byte[] GetBytes(this string hexString) + { + var bytes = new List(); + + if (!string.IsNullOrWhiteSpace(hexString)) + { + hexString = Regex.Replace(hexString, "[^a-fA-F0-9]*", string.Empty); + + var first = true; + var x = 0; + + foreach (var hex in hexString) + { + if ('0' <= hex && hex <= '9') + { + x += hex - '0'; + } + else if ('A' <= hex && hex <= 'F') + { + x += hex - 'A' + 10; + } + else if ('a' <= hex && hex <= 'f') + { + x = hex - 'a' + 10; + } + else + { + continue; + } + + if (first) + { + x *= 16; + } + else + { + bytes.Add((byte)x); + + x = 0; + } + + first = !first; + } + } + + return bytes.ToArray(); + } + + public static byte[] GetEncryptionKey(this string hexString, int requiredLength = 16) + { + var bytes = hexString.GetBytes(); + + if (bytes?.Length != requiredLength) + { + return default(byte[]); + } + + return bytes; + } + } +} diff --git a/Common/Hardware/Common.Hardware.SIRT/SerialPort.cs b/Common/Hardware/Common.Hardware.SIRT/SerialPort.cs new file mode 100644 index 00000000..4497c19a --- /dev/null +++ b/Common/Hardware/Common.Hardware.SIRT/SerialPort.cs @@ -0,0 +1,207 @@ +namespace Common.Hardware.SIRT +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.IO.Ports; + using System.Threading; + + using SysSerialPort = System.IO.Ports.SerialPort; + + public sealed class SerialPort + { + private static readonly ConcurrentDictionary serialPorts + = new ConcurrentDictionary(); + + private readonly ManualResetEventSlim readAwaiter; + private readonly ManualResetEventSlim closeAwaiter; + + public SerialPort(string name, int baudRate, Parity parity, int dataBits, StopBits stopBits) + { + this.COMPort = name; + this.readAwaiter = new ManualResetEventSlim(); + this.closeAwaiter = new ManualResetEventSlim(); + var sp = new SysSerialPort(this.COMPort, baudRate, parity, dataBits, stopBits); + + serialPorts.AddOrUpdate(this.COMPort, sp, (key, value) => + { + value?.Close(); + + return sp; + }); + } + + public event Action Connected; + public event Action Disconnected; + public event Action Logging; + + public string COMPort { get; } + + public bool IsOpen => serialPorts.TryGetValue(this.COMPort, out var sp) && sp.IsOpen; + + public void Close() + { + if (serialPorts.TryGetValue(this.COMPort, out var sp)) + { + try + { + sp.Close(); + this.closeAwaiter.Wait(5000); + this.closeAwaiter.Reset(); + + sp.DataReceived -= this.SP_DataReceived; + sp.Disposed -= this.SP_Disposed; + } + catch (Exception e) + { + this.Logging?.Invoke(e.ToString()); + } + } + } + + public void Open() + { + if (serialPorts.TryGetValue(this.COMPort, out var sp) && !sp.IsOpen) + { + try + { + sp.DataReceived += this.SP_DataReceived; + sp.Disposed += this.SP_Disposed; + + sp.Open(); + + this.Connected?.Invoke(); + } + catch (Exception e) + { + this.Logging?.Invoke(e.ToString()); + } + } + } + + public IEnumerable ReadBytes() + { + var sp = this.GetOpenedSP(); + var size = sp.ReadBufferSize; + var buffer = new byte[size]; + var length = 0; + + using (sp) + { + while (sp.IsOpen) + { + this.readAwaiter.Wait(); + + try + { + buffer = new byte[size]; + length = sp.Read(buffer, 0, size); + + Array.Resize(ref buffer, length); + } + catch (Exception e) + { + this.Logging?.Invoke(e.ToString()); + } + + this.readAwaiter.Reset(); + + yield return buffer; + } + + sp.Close(); + } + } + + public IEnumerable ReadLines() + { + var sp = this.GetOpenedSP(); + var text = default(string); + + using (sp) + { + while (sp.IsOpen) + { + this.readAwaiter.Wait(); + + try + { + text = sp.ReadLine(); + } + catch (Exception e) + { + this.Logging?.Invoke(e.ToString()); + } + + this.readAwaiter.Reset(); + + yield return text; + } + } + } + + public void Remove() + { + if (serialPorts.TryRemove(this.COMPort, out var sp)) + { + sp.Close(); + } + } + + public void Write(byte[] bytes) + { + var sp = this.GetOpenedSP(); + + try + { + sp.Write(bytes, 0, bytes.Length); + } + catch (Exception e) + { + this.Logging?.Invoke(e.ToString()); + } + } + + public void Write(string text) + { + var sp = this.GetOpenedSP(); + + try + { + sp.Write(text); + } + catch (Exception e) + { + this.Logging?.Invoke(e.ToString()); + } + } + + private SysSerialPort GetOpenedSP() + { + if (!serialPorts.TryGetValue(this.COMPort, out var sp)) + { + throw new InvalidOperationException($"{nameof(SerialPort)} on {this.COMPort} dose not exists!"); + } + + if (!sp.IsOpen) + { + this.Close(); + this.Open(); + } + + return sp; + } + + private void SP_DataReceived(object _, SerialDataReceivedEventArgs args) + => this.readAwaiter.Set(); + + private void SP_Disposed(object _, EventArgs _1) + { + this.closeAwaiter.Set(); + this.Disconnected?.Invoke(); + } + + public static string[] GetPortNames() + => SysSerialPort.GetPortNames(); + } +} diff --git a/Common/Hardware/WaterMeter/Genesis/Registers/Json/JsonVersionsConverter.cs b/Common/Hardware/WaterMeter/Genesis/Registers/Json/JsonVersionsConverter.cs new file mode 100644 index 00000000..0c178cc6 --- /dev/null +++ b/Common/Hardware/WaterMeter/Genesis/Registers/Json/JsonVersionsConverter.cs @@ -0,0 +1,33 @@ +namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Json +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + using System; + + public class JsonVersionsConverter : JsonConverter + { + public override FwVersion ReadJson(JsonReader reader, Type objectType, FwVersion existingValue, Boolean hasExistingValue, JsonSerializer serializer) + { + var jobject = JToken.Load(reader); + + if (jobject.Type != JTokenType.Object) + { + if (int.TryParse($"{jobject}", out var version)) + { + return new FwVersion + { + First = version + }; + } + } + + return jobject.ToObject(); + } + + public override void WriteJson(JsonWriter writer, FwVersion value, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + } +} diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj index 42c96d72..a938d6e2 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Common.Hardware.WaterMeter.eRegister.csproj @@ -58,6 +58,7 @@ + @@ -157,10 +158,6 @@ - - {9ae071c0-db12-4e09-a3c7-43f6dcd518d6} - Common.Hardware.Ports - {8de8e742-ee0a-4004-aa49-3d08d748e5ac} Common.Hardware.SIRT diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs index 78c31aa8..0546a43c 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs @@ -7,7 +7,9 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; + using System.Globalization; using System.Linq; + using System.Runtime.CompilerServices; using System.Threading; public class Eregister @@ -33,6 +35,35 @@ } } + internal IEnumerable LoadInspectionInitializationTasks() + { + var features = parameters.LoadInspectionInitializationFeatures(); + + this.LoadProgrammingParameters(features); + + var lastTask = this.runningTasks.LastOrDefault(); + + if (lastTask != null) + { + this.runningTasks.Enqueue(new EregisterChangeMeterTypeTask(lastTask.Frequency, lastTask.Timeout) + { + SlotNr = features.SlotNr, + PoNr = features.PoNr, + SerialNr = features.SerialNr, + P1 = new P811 + { + DelPamSemi = true, + }, + RequestAddress = features.RequestAddress, + ResponseAddress = features.ResponseAddress, + EncryptionKey = features.EncryptionKey, + Name = "Change Meter Type" + }); + } + + return this.runningTasks.AsEnumerable(); + } + internal IEnumerable LoadInspectionFinalizationTasks() { var features = parameters.LoadInspectionFinalizationFeatures(); @@ -56,15 +87,6 @@ return this.runningTasks.AsEnumerable(); } - internal IEnumerable LoadInspectionInitializationTasks() - { - var features = parameters.LoadInspectionInitializationFeatures(); - - this.LoadProgrammingParameters(features); - - return this.runningTasks.AsEnumerable(); - } - internal void StartProgramming() { var manualResetEventSlim = new ManualResetEventSlim(); @@ -76,6 +98,9 @@ if (task is EregisterTask _task) { + var numberStyles = NumberStyles.HexNumber | NumberStyles.AllowHexSpecifier; + var cultureInfo = CultureInfo.InvariantCulture; + foreach (var etask in this.runningTasks) { if (etask.State != SIRTTaskState.Cancelled && etask.State != SIRTTaskState.Completed) @@ -85,6 +110,16 @@ etask.RequestAddress = _task.RequestAddress; etask.ResponseAddress = _task.ResponseAddress; } + + if (etask.RadioFWVersion is null) + { + etask.RadioFWHex = _task.DEBUG?.RadioFWVersion; + + if (int.TryParse($"{etask.RadioFWHex}", numberStyles, cultureInfo, out var radioFWVersion)) + { + etask.RadioFWVersion = radioFWVersion; + } + } } } @@ -112,7 +147,7 @@ } } - private void LoadProgrammingParameters(EregisterFeatures features) + private void LoadProgrammingParameters(EregisterFeatures features, [CallerMemberName] string caller = "") { this.Clear(); diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterChangeMeterTypeTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterChangeMeterTypeTask.cs new file mode 100644 index 00000000..2bfa0e85 --- /dev/null +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterChangeMeterTypeTask.cs @@ -0,0 +1,40 @@ +namespace Common.Hardware.WaterMeter.eRegister +{ + using System; + using System.Globalization; + + public class EregisterChangeMeterTypeTask : EregisterTask + { + public EregisterChangeMeterTypeTask(int frequency, int timeout = 5000) : base(frequency, timeout) + => this.Name = "Change meter type"; + + public override byte[] ToByteArray() + { + var numberStyles = NumberStyles.HexNumber | NumberStyles.AllowHexSpecifier; + var cultureInfo = CultureInfo.InvariantCulture; + + // from Pruef2000.exe + if (int.TryParse($"1108", numberStyles, cultureInfo, out var minFWVersion) && int.TryParse($"110B", numberStyles, cultureInfo, out var exceptFWVersion)) + { + if (this.RadioFWVersion < minFWVersion && this.RadioFWVersion != exceptFWVersion) + { + // do not change the type + this.request.Data = Array.Empty(); + } + } + + if (this.request.Data.Length > 0) + { + this.Name = $"FW: {this.RadioFWHex} - C & I"; + } + else + { + this.Name = $"FW: {this.RadioFWHex} - Residential"; + } + + this.NotifyChanged(); + + return base.ToByteArray(); + } + } +} diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs index b7a27551..7a8dbbb9 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs @@ -1,6 +1,5 @@ namespace Common.Hardware.WaterMeter.eRegister { - using Common.Hardware.Ports; using Common.Hardware.SIRT; using Common.Hardware.WaterMeter.eRegister.Attributes; using Common.Hardware.WaterMeter.eRegister.Features; diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckInitializationTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckInitializationTask.cs index 25af68fb..bea3bc9f 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckInitializationTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckInitializationTask.cs @@ -19,7 +19,6 @@ this.parameters = parameters; this.pendingState = SIRTTaskState.Completed; this.Name = "Initial Check"; - this.Data = new OpticalTelegram { Minutes = 0 @@ -99,10 +98,7 @@ message.AppendLine(); message.AppendLine("Möchten Sie mit die Prüfung fortfahren (Yes), oder Abbrechen (No)?"); - var result = MessageBox.Show( - message.ToString() - , $"Fehler bei der Prüfungsinitialisierung" - , MessageBoxButtons.YesNo); + var result = MessageBox.Show(message.ToString(), $"Fehler bei der Prüfungsinitialisierung", MessageBoxButtons.YesNo); if (result == DialogResult.No) { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterExtensions.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterExtensions.cs index f14df26e..c44dbd69 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterExtensions.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterExtensions.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; using Common.Hardware.WaterMeter.eRegister.Features; using Common.Hardware.WaterMeter.eRegister.Models; diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs index 86444617..b05f05b6 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs @@ -56,6 +56,10 @@ public FactoryState Mode { get; set; } + public int? RadioFWVersion { get; set; } + + public string RadioFWHex { get; set; } + public override byte[] ToByteArray() { var data = this.request.Data; @@ -78,7 +82,7 @@ P1 = this.request.P1, P2 = this.request.P2, - }.ToByteArray(); + }.GetBytes(); } protected override void OnTimeout(object sender, ElapsedEventArgs e) @@ -149,19 +153,25 @@ { this.SEMI = new SEMI(data, this.Frequency, this.P11); this.IsEncrypted = this.SEMI.Crc != 0; - this.Label = this.SEMI.PAMStatus.ToString(); + this.Label = default(string); - if (this.request.Data.Length > 0 && this.request.Data[0] == Pam.GetDebug && this.DEBUG == null) + if (this.SEMI.PAMStatus == PAMStatus.OK) { - this.Label = "!DEBUG"; - } - else if (this.SEMI.PAMStatus == PAMStatus.OK) - { - this.State = SIRTTaskState.Completed; - this.EndProcessResponse(response); + if (this.request.Data.Length > 0 && this.request.Data[0] == Pam.GetDebug && this.DEBUG == null) + { + this.Label = "!DEBUG"; + } + else + { + this.State = SIRTTaskState.Completed; + this.Label = this.SEMI.PAMStatus.ToString(); + this.EndProcessResponse(response); + } } else { + this.Label = this.SEMI.PAMStatus.ToString(); + if (this.SEMI.PAMStatus == PAMStatus.EXPIREDAUTH) { this.State = SIRTTaskState.Cancelled; diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ActivateMetrologyTestMode.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ActivateMetrologyTestMode.cs index 3119f397..e02c5457 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ActivateMetrologyTestMode.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ActivateMetrologyTestMode.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ActivateMetrologyTestMode : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs index fcc02a44..b8907c57 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/AlarmsMask.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class AlarmsMask : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeDataLoggerSettings.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeDataLoggerSettings.cs index d6798580..c6cd800c 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeDataLoggerSettings.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeDataLoggerSettings.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ChangeDataLoggerSettings : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeFixedDateReadingSettings.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeFixedDateReadingSettings.cs index 1afad12b..d90ba4f8 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeFixedDateReadingSettings.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeFixedDateReadingSettings.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ChangeFixedDateReadingSettings : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterId.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterId.cs index dc2f0ab2..c65530f2 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterId.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterId.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ChangeMeterId : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterReading.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterReading.cs index ea9c2a9c..7b704fac 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterReading.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeMeterReading.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ChangeMeterReading : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeRadioId.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeRadioId.cs index ccb58692..c681f569 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeRadioId.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeRadioId.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ChangeRadioId : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeSensusRFEncryptionKey.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeSensusRFEncryptionKey.cs index e66b33b5..08232a60 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeSensusRFEncryptionKey.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ChangeSensusRFEncryptionKey.cs @@ -2,7 +2,7 @@ { using System; - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ChangeSensusRFEncryptionKey : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/OpenMeteringTransmitionIntervalWMBus.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/OpenMeteringTransmitionIntervalWMBus.cs index 8791225a..e2e1a0e3 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/OpenMeteringTransmitionIntervalWMBus.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/OpenMeteringTransmitionIntervalWMBus.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class OpenMeteringTransmitionIntervalWMBus : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ParameterizeLeakageDetection.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ParameterizeLeakageDetection.cs index 310abb0a..f3fa196b 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ParameterizeLeakageDetection.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/ParameterizeLeakageDetection.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class ParameterizeLeakageDetection : SingleBytePam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SendBubbleUpBurst.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SendBubbleUpBurst.cs index c9d83546..1bceb08a 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SendBubbleUpBurst.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SendBubbleUpBurst.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SendBubbleUpBurst : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetAlarms.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetAlarms.cs index f48696ce..09669ef6 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetAlarms.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetAlarms.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetAlarms : AlarmsMask { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetBytterySeconds.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetBytterySeconds.cs index 5324a878..d5f998b1 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetBytterySeconds.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetBytterySeconds.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetBytterySeconds : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetDateAndTime.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetDateAndTime.cs index f6c0c66b..0e7271ad 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetDateAndTime.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetDateAndTime.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetDateAndTime : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetFrequencyOffset.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetFrequencyOffset.cs index 772fab03..69d1752e 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetFrequencyOffset.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetFrequencyOffset.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetFrequencyOffset : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetMetrologyParameters.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetMetrologyParameters.cs index b9fcdecf..027b018c 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetMetrologyParameters.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetMetrologyParameters.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetMetrologyParameters : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetPcbId.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetPcbId.cs index 108e3ef9..8a6af6c1 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetPcbId.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetPcbId.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetPcbId : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetTFXParameters.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetTFXParameters.cs index 7f253c0a..987d2ce9 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetTFXParameters.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/SetTFXParameters.cs @@ -2,7 +2,7 @@ { using System; - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class SetTFXParameters : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/WirelessMBusMode.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/WirelessMBusMode.cs index 97bdeccd..7d4a8db2 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/WirelessMBusMode.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Features/WirelessMBusMode.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Features { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; public class WirelessMBusMode : Pam { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs index c996a37f..25973a12 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Models/EregisterProgrammingParameters.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Models { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; using Common.Hardware.WaterMeter.eRegister.Attributes; using Common.Hardware.WaterMeter.eRegister.Features; using Common.Hardware.WaterMeter.eRegister.Telegrams; @@ -434,15 +434,6 @@ Vpp = this.VolumePerPulse, VppLED = (uint)this.VolumePerLedPulse }; - - features.Debug = new EregisterDebugFeatures - { - SetMeterType = new SetMeterType - { - Type = (MeterTypes)this.CandIType - }, - - }; } return features; diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/BUP.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/BUP.cs index 594287b8..e7cafd5e 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/BUP.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/BUP.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Telegrams { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; using Common.Hardware.SIRT.Parameters; using Common.Hardware.WaterMeter.eRegister.Features; diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs index eb24c82d..7ce05435 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/DEBUG.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Telegrams { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; using Common.Hardware.SIRT.Parameters; public class DEBUG : Payload diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/Payload.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/Payload.cs index ab209cd6..933a2c28 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/Payload.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/Payload.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Telegrams { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; using Common.Hardware.SIRT.Parameters; using System; diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs index 84976aad..7ded9834 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Telegrams/SEMI.cs @@ -1,6 +1,6 @@ namespace Common.Hardware.WaterMeter.eRegister.Telegrams { - using Common.Hardware.Ports; + using Common.Hardware.SIRT; using Common.Hardware.SIRT.Parameters; using Common.Hardware.WaterMeter.eRegister.Features; diff --git a/Common/LaaPackages b/Common/LaaPackages index fc6d1c60..1713caf9 160000 --- a/Common/LaaPackages +++ b/Common/LaaPackages @@ -1 +1 @@ -Subproject commit fc6d1c60141d1dcce304443fe14f62a94e9dc123 +Subproject commit 1713caf91ba8771f7331a878005598ef8c47d263 diff --git a/Common/Ui/Common.UI/App.config b/Common/Ui/Common.UI/App.config index dece2444..9e735fb2 100644 --- a/Common/Ui/Common.UI/App.config +++ b/Common/Ui/Common.UI/App.config @@ -6,7 +6,7 @@ - + diff --git a/Common/Ui/Common.UI/Common.UI.csproj b/Common/Ui/Common.UI/Common.UI.csproj index 33ccfc63..55a62f0c 100644 --- a/Common/Ui/Common.UI/Common.UI.csproj +++ b/Common/Ui/Common.UI/Common.UI.csproj @@ -151,7 +151,6 @@ - EregisterFinalize.xaml @@ -279,10 +278,6 @@ - - {9ae071c0-db12-4e09-a3c7-43f6dcd518d6} - Common.Hardware.Ports - {8de8e742-ee0a-4004-aa49-3d08d748e5ac} Common.Hardware.SIRT diff --git a/Common/Ui/Common.UI/Controls/SIRTBroadcasters.xaml b/Common/Ui/Common.UI/Controls/SIRTBroadcasters.xaml index 86cc5ebb..d747a27e 100644 --- a/Common/Ui/Common.UI/Controls/SIRTBroadcasters.xaml +++ b/Common/Ui/Common.UI/Controls/SIRTBroadcasters.xaml @@ -5,91 +5,47 @@ - - - - - - - - - - - - - - - - -