diff --git a/Common/Common.sln b/Common/Common.sln
index 8c097f02..21dceb97 100644
--- a/Common/Common.sln
+++ b/Common/Common.sln
@@ -199,8 +199,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InspectionUI.RemoteControl"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Hardware.Interfaces.Ports", "Hardware\Interfaces\Ports\Common.Hardware.Interfaces.Ports\Common.Hardware.Interfaces.Ports.csproj", "{9AE071C0-DB12-4E09-A3C7-43F6DCD518D6}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.UI.SIRTBroadcaster", "Ui\Common.UI.SIRTBroadcaster\Common.UI.SIRTBroadcaster.csproj", "{8D3B1C46-B23E-46CC-9B59-24E34DE60510}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.UI.VFM", "Ui\Common.UI.VFM\Common.UI.VFM.csproj", "{9C1C5522-E986-4FD6-8F2F-19821D704A88}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OmniPlus", "OmniPlus", "{68A1B84B-B38F-4BD1-94A8-DB18600457FF}"
@@ -4757,70 +4755,6 @@ Global
{9AE071C0-DB12-4E09-A3C7-43F6DCD518D6}.XP32bit|x64.Build.0 = Release|Any CPU
{9AE071C0-DB12-4E09-A3C7-43F6DCD518D6}.XP32bit|x86.ActiveCfg = Release|Any CPU
{9AE071C0-DB12-4E09-A3C7-43F6DCD518D6}.XP32bit|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.COM|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|x64.ActiveCfg = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|x64.Build.0 = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|x86.ActiveCfg = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Debug|x86.Build.0 = Debug|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.PerformTest|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.Release|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.ReleaseTest|x86.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|Any CPU.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|x64.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|x64.Build.0 = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|x86.ActiveCfg = Release|Any CPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}.XP32bit|x86.Build.0 = Release|Any CPU
{9C1C5522-E986-4FD6-8F2F-19821D704A88}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU
{9C1C5522-E986-4FD6-8F2F-19821D704A88}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU
{9C1C5522-E986-4FD6-8F2F-19821D704A88}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU
@@ -5678,7 +5612,6 @@ Global
{C6BFAC88-5647-4131-90B1-4D6265E08348} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{41E949AD-FBF6-47A3-AC1D-7E17AB7F1252} = {68323534-4337-4E3A-89BC-11D8BB55343A}
{9AE071C0-DB12-4E09-A3C7-43F6DCD518D6} = {B9444AB7-1EB1-484A-8DE6-4EEE03498CD7}
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
{9C1C5522-E986-4FD6-8F2F-19821D704A88} = {03D4F23E-7E4A-4091-BC96-036C996D351A}
{68A1B84B-B38F-4BD1-94A8-DB18600457FF} = {5563DD3B-2287-4BED-97BF-F0389FF505AF}
{9D89FA2A-1217-4CE9-B217-E7602B974EA9} = {68A1B84B-B38F-4BD1-94A8-DB18600457FF}
diff --git a/Common/CommonConsole/CommonConsole.csproj b/Common/CommonConsole/CommonConsole.csproj
index 681094de..77be462a 100644
--- a/Common/CommonConsole/CommonConsole.csproj
+++ b/Common/CommonConsole/CommonConsole.csproj
@@ -95,10 +95,6 @@
{F8D84B9A-0FCF-4083-B067-8C39B7314152}
OmniPlus
-
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}
- Common.UI.SIRTBroadcaster
-
{05f0ccaf-9f2b-45f9-a7f8-12f29ad182f3}
Common.Utils.Extensions
diff --git a/Common/CommonConsole/Program.cs b/Common/CommonConsole/Program.cs
index 1891fa28..4d24daf1 100644
--- a/Common/CommonConsole/Program.cs
+++ b/Common/CommonConsole/Program.cs
@@ -1,10 +1,30 @@
namespace CommonConsole
{
using System;
- using System.Collections.Generic;
public class Program
{
+ public static void Main()
+ {
+ int value = 333333333;
+ var bytes1 = BitConverter.GetBytes(value);
+
+ Array.Reverse(bytes1);
+
+ Console.WriteLine(BitConverter.ToString(bytes1).Replace('-', ' '));
+
+ var hex = string.Empty;
+
+ while (value > 0)
+ {
+ hex = $"{value % 256:X2}{hex}";
+ value /= 256;
+ }
+
+ Console.WriteLine(hex);
+ }
+
+
///
/// 0B
/// D0
@@ -16,51 +36,48 @@
///
/// 04 01 C7 47 9F 77 17 00 6A 00 08 08 00 00 00 00 05 68 46 89 02 01 01 16 00 0A 00 00 02 71 02 71 00 00 00 00 00 00 00 08
///
- public static void Main()
- {
- var bytes = new[] { 0x08, 0x11};
- var bits = new Byte[16];
- var x = 0;
+ //var bytes = new[] { 0x08, 0x11 };
+ //var bits = new Byte[16];
+ //var x = 0;
- foreach (var @byte in bytes)
- {
- for (var i = 0; i < 8; i++, x++)
- {
- bits[x] = (Byte)((@byte >> i) & 1);
- }
- }
+ //foreach (var @byte in bytes)
+ //{
+ // for (var i = 0; i< 8; i++, x++)
+ // {
+ // bits[x] = (Byte) ((@byte >> i) & 1);
+ // }
+ //}
- Array.Reverse(bits);
+ //Array.Reverse(bits);
- var type = bits[15] == 0 ? 'B' : 'R';
+ //var type = bits[15] == 0 ? 'B' : 'R';
- var majorBits = new Byte[8];
- majorBits[0] = bits[14];
- majorBits[1] = bits[13];
- majorBits[2] = bits[12];
+ //var majorBits = new Byte[8];
+ //majorBits[0] = bits[14];
+ //majorBits[1] = bits[13];
+ //majorBits[2] = bits[12];
- var major = 0;
+ //var major = 0;
- for (var i = 0; i < 8; i++)
- {
- major |= majorBits[i] << i;
- }
+ //for (var i = 0; i< 8; i++)
+ //{
+ // major |= majorBits[i] << i;
+ //}
- var minorBits = new Byte[8];
- majorBits[0] = bits[11];
- majorBits[1] = bits[10];
- majorBits[2] = bits[9];
- majorBits[2] = bits[8];
+ //var minorBits = new Byte[8];
+ //majorBits[0] = bits[11];
+ //majorBits[1] = bits[10];
+ //majorBits[2] = bits[9];
+ //majorBits[2] = bits[8];
- var minor = 0;
+ //var minor = 0;
- for (var i = 0; i < 8; i++)
- {
- minor |= minorBits[i] << i;
- }
+ //for (var i = 0; i< 8; i++)
+ //{
+ // minor |= minorBits[i] << i;
+ //}
- Console.WriteLine($"{type}{major}.{minor}.{0x08}");
- }
+ //Console.WriteLine($"{type}{major}.{minor}.{0x08}");
//var programmingBatch = new JusteRegisterProgrammingBatch();
diff --git a/Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Common.Hardware.Interfaces.Ports.SirtBroadcaster.csproj b/Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Common.Hardware.Interfaces.Ports.SirtBroadcaster.csproj
index 20cc1854..27f8de1f 100644
--- a/Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Common.Hardware.Interfaces.Ports.SirtBroadcaster.csproj
+++ b/Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Common.Hardware.Interfaces.Ports.SirtBroadcaster.csproj
@@ -44,7 +44,6 @@
-
@@ -57,12 +56,17 @@
+
+
+ {05F0CCAF-9F2B-45F9-A7F8-12F29AD182F3}
+ Common.Utils.Extensions
+
{B23BFAF9-08AE-4311-8C08-FB2BB49EA2AD}
Common.Hardware.Interfaces.Ports.Sirt
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/PAMStatus.cs b/Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Parameters/PAMStatus.cs
similarity index 95%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/PAMStatus.cs
rename to Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Parameters/PAMStatus.cs
index b19dae33..d1a20132 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/PAMStatus.cs
+++ b/Common/Hardware/Interfaces/Ports/Common.Hardware.Interfaces.Ports.SirtBroadcaster/Parameters/PAMStatus.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.Interfaces.Ports.SirtBroadcaster
{
using Common.Utils.Extensions;
diff --git a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache
index 8d4994b0..8865d283 100644
--- a/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache
+++ b/Common/Hardware/WaterMeter/WaterMeterCore/WaterMeterRegisters/obj/Debug/WaterMeterRegisters.csproj.CoreCompileInputs.cache
@@ -1 +1 @@
-8fbe991b217e7692af4817ad205b768685aa5a72
+89102b0142e574de38a9f47d370f3334e5e6c268
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 980409b8..56b20a09 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
@@ -53,26 +53,21 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ACKN.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/ACKN.cs
similarity index 95%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ACKN.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/ACKN.cs
index cde15dbe..65ebc112 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ACKN.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/ACKN.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
using Common.Hardware.Interfaces.Ports.Sirt.Responses;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/AppCode.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/AppCode.cs
similarity index 79%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/AppCode.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/AppCode.cs
index 70408be7..59afbf64 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/AppCode.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/AppCode.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
public enum AppCode
{
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/BUP.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/BUP.cs
similarity index 91%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/BUP.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/BUP.cs
index 9dd2f454..b0efd4a6 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/BUP.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/BUP.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
using Common.Hardware.WaterMeter.eRegister.Features;
using Common.Utils.Extensions;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Debug.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/DEBUG.cs
similarity index 98%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Debug.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/DEBUG.cs
index 56898f8f..4713762a 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Debug.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/DEBUG.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
using Common.Utils.Extensions;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Epoch20000101.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/Epoch20000101.cs
similarity index 95%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Epoch20000101.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/Epoch20000101.cs
index 0779bd95..323dc8fa 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Epoch20000101.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/Epoch20000101.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
using System;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Lat.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/LAT.cs
similarity index 70%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Lat.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/LAT.cs
index 99212f42..f145565e 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Lat.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/LAT.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
using System;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/MeterUnits.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/MeterUnits.cs
similarity index 70%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/MeterUnits.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/MeterUnits.cs
index 27bfd53b..c21fc1a7 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/MeterUnits.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/MeterUnits.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
public enum MeterUnits
{
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Payload.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/Payload.cs
similarity index 93%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Payload.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/Payload.cs
index c1c3826c..ea01852e 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Payload.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/Payload.cs
@@ -1,4 +1,4 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
using Common.Utils.Extensions;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/SEMI.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/SEMI.cs
similarity index 98%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/SEMI.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/SEMI.cs
index caf7d0b8..367cd60f 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/SEMI.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Data/SEMI.cs
@@ -1,5 +1,6 @@
-namespace Common.Hardware.WaterMeter.eRegister
+namespace Common.Hardware.WaterMeter.eRegister.Data
{
+ using Common.Hardware.Interfaces.Ports.SirtBroadcaster;
using Common.Utils.Extensions;
using System;
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Endpoint.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Endpoint.cs
deleted file mode 100644
index 77b1fa69..00000000
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Endpoint.cs
+++ /dev/null
@@ -1,233 +0,0 @@
-namespace Common.Hardware.WaterMeter.eRegister
-{
- using Common.Hardware.Interfaces.Ports.Sirt;
- using Common.Hardware.WaterMeter.eRegister.Features;
-
- using NLog;
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
-
- public class Endpoint
- {
- private readonly ILogger logger;
- private readonly Queue commands;
-
- private Int32 remeiningTasks;
- private EndpointTask checksTask;
-
- public Endpoint(ILogger logger)
- {
- this.logger = logger;
- this.commands = new Queue();
- }
-
- public event Action Done;
-
- public Int32 Slot { get; internal set; }
-
- public UInt32 Address { get; set; }
-
- public UInt32 FinalAddress { get; set; }
-
- public Int32 SerialNo { get; set; }
-
- public Byte[] Key { get; set; }
-
- public Boolean Sealed { get; set; }
-
- public DEBUG DEBUG { get; private set; }
-
- public SEMI SEMI { get; private set; }
-
- public LAT LAT { get; private set; }
-
- public void AddHexCommand(Byte[] bytes)
- {
- if (bytes?.Length > 0)
- {
- this.commands.Enqueue(bytes);
- }
- }
-
- public EndpointTask InitForInspection()
- {
- this.remeiningTasks++;
-
- var task = new EndpointTask
- {
- Address = this.Address,
- WakeUpCmd = true,
- DelPamSemi = true,
- Payload = new ChangeWakeUp
- {
- Mode = WakeUpMode.StayAwake
- }
- .Append(new ChangeLATWindows
- {
- N = 0
- })
- .Append(new WMBusMode
- {
- WMBusEnabled = true,
- InstallationModeEnabled = true,
- EncryptionEnabled = true,
- })
- .Append(new ChangeTransmission
- {
- LatWindowIntervalCount = 0,
- LatTXIntervalSeconds = 3
- })
- .Append(new ProvidePin
- {
- AuthLevel = AuthLevel.II
- })
- };
- task.Done += this.Task_Done;
- task.TRXLogging += this.Task_TRXLogging;
-
- return task;
- }
-
- internal EndpointTask RunCommand()
- {
- if (this.commands.Count > 0)
- {
- this.remeiningTasks++;
-
- var task = new EndpointTask
- {
- Address = this.Address,
- WakeUpCmd = true,
- DelPamSemi = true,
- Payload = this.commands.Dequeue()
- };
- task.Done += this.Task_Done;
- task.TRXLogging += this.Task_TRXLogging;
-
- return task;
- }
-
- return null;
- }
-
- public EndpointTask SetupForInspection()
- {
- this.remeiningTasks++;
-
- var task = new EndpointTask
- {
- Address = this.Address,
- WakeUpCmd = true,
- DelPamSemi = true,
- Payload = new SetMetrologyParameters
- {
- DecimalPoint = DecimalPointLocations.Three,
- FactoryCalibration = 0,
- MeterSize = 37,
- OffsetFactor = 0,
- OffsetTime = 5,
- Units = Features.MeterUnits.CubicMeters,
- UseCandIRules = true,
- Vpp = 40960000,
- VppLED = 218843648
- }
- .Append(new ProvidePin
- {
- AuthLevel = AuthLevel.III
- })
- };
- task.Done += this.Task_Done;
- task.TRXLogging += this.Task_TRXLogging;
-
- return task;
- }
-
- public EndpointTask SetDisplay111111111()
- {
- this.remeiningTasks++;
-
- var task = new EndpointTask
- {
- Address = this.Address,
- WakeUpCmd = true,
- DelPamSemi = true,
- Payload = new ChangeMeterReading
- {
- Value = 111_111_111
- }
- .Append(new ProvidePin
- {
- AuthLevel = AuthLevel.III
- })
- };
- task.Done += this.Task_Done;
- task.TRXLogging += this.Task_TRXLogging;
-
- return task;
- }
-
- public EndpointTask StartLED()
- {
- this.remeiningTasks++;
-
- var task = new EndpointTask
- {
- Address = this.Address,
- WakeUpCmd = true,
- DelPamSemi = true,
- Payload = new GetDebug
- {
- Cmd = new OpticalTelegram
- {
- Minutes = 1,
- }
- }
- .Append(new ProvidePin
- {
- AuthLevel = AuthLevel.III
- })
- };
- task.Done += this.Task_Done;
- task.TRXLogging += this.Task_TRXLogging;
-
- return task;
- }
-
- public EndpointTask DoChecks()
- {
- this.checksTask = new EndpointTask();
-
- return this.checksTask;
- }
-
- private void Task_TRXLogging(Byte[] bytes) => this.logger?.Debug($"{this.Slot}|{BitConverter.ToString(bytes)}");
-
- private void Task_Done(SIRTTask task)
- {
- this.remeiningTasks--;
-
- if (this.remeiningTasks <= 0)
- {
- if (this.checksTask != null && task is EndpointTask endpointTask)
- {
- this.LAT = endpointTask.LATS.LastOrDefault();
- this.DEBUG = endpointTask.DEBUGS.LastOrDefault();
- this.SEMI = endpointTask.SEMIS.LastOrDefault();
-
- var batteryVoltage = 2 + (this.DEBUG?.BatteryVoltage ?? 1) / 64F >= 3.565;
- var batteryRemaining = 2 + (this.SEMI?.BatteryRemaining ?? 54669) <= 54668;
- var rebootCount = (this.DEBUG?.RebootCount ?? Byte.MaxValue) <= 2;
-
- if (batteryVoltage && batteryRemaining && rebootCount)
- {
- this.checksTask.NotifyCompleted();
- }
- }
-
- this.Done?.Invoke(0);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EndpointTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EndpointTask.cs
deleted file mode 100644
index 51a3901a..00000000
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EndpointTask.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-namespace Common.Hardware.WaterMeter.eRegister
-{
- using Common.Hardware.Interfaces.Ports.Sirt;
- using Common.Hardware.Interfaces.Ports.Sirt.Responses;
- using Common.Utils.Extensions;
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
-
- public class EndpointTask : WritePamTask
- {
- private Byte[] key;
-
- public EndpointTask() : base(5)
- {
- this.Done += _ => this.NotifyCompleted();
- base.Cancelled += _ => this.NotifyCancelled();
- }
-
- public event Action Completed;
- public new event Action Cancelled;
- public event Action Received;
-
- public override UInt32 Address => base.Address;
-
- public String KEY
- {
- get => BitConverter.ToString(this.key);
- set => this.key = value.GetBytes();
- }
-
- public ICollection ACKNS { get; private set; } = new List();
-
- public ICollection LATS { get; private set; } = new List();
-
- public ICollection DEBUGS { get; private set; } = new List();
-
- public ICollection SEMIS { get; } = new List();
-
- public ICollection BUPS { get; } = new List();
-
- public String FirstPamId => $"PAM {this.request.Payload.FirstOrDefault()}";
-
- protected override Boolean FromAirReceived(FromAirResponse response)
- {
- var payload = response.Payload;
- var length = response.Payload.Length;
- var succeeded = false;
-
- if (length == 13)
- {
- var bup = new LAT(payload);
-
- if (bup.AppCode == AppCode.LAT)
- {
- this.LATS.Add(bup);
-
- if (this.request.Payload[0] == 0x35)
- {
- var oldAddress = this.Address;
- var newAddress = this.request.Payload.ToUInt32BigEndian(1);
-
- if (oldAddress != newAddress)
- {
- this.NotifyAddressChanged(oldAddress, newAddress);
- }
- }
-
- this.Received?.Invoke($"LAT({this.LATS.Count})");
- }
- else
- {
- this.BUPS.Add(bup);
-
- this.Received?.Invoke($"BUP({this.BUPS.Count})");
- }
- }
- else if (length == 52)
- {
- this.DEBUGS.Add(new DEBUG(payload));
-
- this.Received?.Invoke($"DEBUG({this.DEBUGS.Count})");
- }
- else if (length == 91)
- {
- this.SEMIS.Add(new SEMI(payload, response.MHz));
-
- this.Received?.Invoke($"SEMI({this.SEMIS.Count})");
-
- succeeded = true;
- }
- else
- {
- // TODO: unrecognized response received.!?
- }
-
- this.NotifyTRX(response);
-
- /// If SEMI received, task is done
- return succeeded;
- }
-
- protected override Boolean AcknOrAnswerReceived(AcknOrAnswerResponse response)
- {
- this.ACKNS.Add(new ACKN(response));
-
- this.Received?.Invoke($"LAT({this.ACKNS.Count})");
- this.NotifyTRX(response);
-
- return base.AcknOrAnswerReceived(response);
- }
-
- protected override Byte[] GetRequestBytes()
- {
- var bytes = base.GetRequestBytes();
-
- this.NotifyTRX(bytes);
-
- return bytes;
- }
-
- internal void NotifyCompleted() => this.Completed?.Invoke();
-
- internal new void NotifyCancelled() => this.Cancelled?.Invoke();
- }
-}
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JustTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JustTask.cs
new file mode 100644
index 00000000..acf8a493
--- /dev/null
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JustTask.cs
@@ -0,0 +1,33 @@
+namespace Common.Hardware.WaterMeter.eRegister
+{
+ using System;
+ using System.Linq;
+
+ public class JustTask
+ {
+ public event Action OnProgress;
+
+ public Int32 Slotno { get; internal set; }
+
+ public Int32 Rowno { get; internal set; }
+
+ public String Label { get; protected set; }
+
+ public TaskState State { get; protected set; } = TaskState.None;
+
+ public Func> TaskHandler { get; internal set; }
+
+ public Action ProgressHandler
+ {
+ get => (Action)this.OnProgress?.GetInvocationList()?.FirstOrDefault();
+ set => this.OnProgress += value;
+ }
+
+ public void Execute(ParameterSet parameterSet)
+ {
+ var result = this.TaskHandler?.Invoke(parameterSet);
+
+ this.OnProgress?.Invoke(this.Slotno, this.Rowno, result.Item1, result.Item2);
+ }
+ }
+}
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProcess.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProcess.cs
deleted file mode 100644
index bacf8f2e..00000000
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProcess.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Common.Hardware.WaterMeter.eRegister
-{
- using System;
-
- public class JusteRegisterProcess
- {
-
- }
-}
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProgrammingBatch.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProgrammingBatch.cs
deleted file mode 100644
index 84e17fe4..00000000
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProgrammingBatch.cs
+++ /dev/null
@@ -1,462 +0,0 @@
-namespace Common.Hardware.WaterMeter.eRegister
-{
- using Common.Hardware.Interfaces.Ports.SirtBroadcaster;
-
- using NLog;
- using NLog.Config;
- using NLog.Targets;
-
- using System;
- using System.Collections.Generic;
- using System.Threading;
-
- public class JusteRegisterProgrammingBatch
- {
- private readonly Dictionary programmingParameters
- = new Dictionary();
- private readonly Dictionary> programmingTasks
- = new Dictionary>();
- private readonly Dictionary> eregisterTasks
- = new Dictionary>();
- private readonly Dictionary> completedTasks
- = new Dictionary>();
- private readonly ILogger logger = CreateNLogger("SIRT");
- private JustSirtBroadcaster broadcaster;
- private Int32 rssiRow;
-
- public event Action OnProgress;
-
- public void AddOrReplace(JusteRegisterParameterSet parameterSet)
- => this.programmingParameters[parameterSet.Slotno] = parameterSet;
-
- public void InitializeCalibration()
- {
- this.programmingTasks.Clear();
- this.eregisterTasks.Clear();
-
- this.OnProgress?.Invoke(0, 0, $"Einbauplatz", JusteRegisterTaskState.Disabled);
-
- for (var x = 1; x < 11; x++)
- {
- this.OnProgress?.Invoke(x, 0, $"{x}", JusteRegisterTaskState.Disabled);
- }
-
- var rowno = 1;
-
- this.OnProgress?.Invoke(0, rowno++, $"Seriennr", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Radio Adresse", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Finale Adresse", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"RSSI", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"WUP-TX-LAT-MBus", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Parametersatz", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Anzeige-111111111", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Opto ein", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"MBus status = 7", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Batteriespannung (Volts)", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Batterielaufzeit (Jahre)", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"FW Version", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Reboots <= 2", JusteRegisterTaskState.Disabled);
-
- foreach (var kvp in this.programmingParameters)
- {
- var slotno = kvp.Key;
- var parameterSet = kvp.Value;
-
- rowno = 1;
-
- this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.Serialno}", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.RadioAddress}", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.FinalAddress}", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(slotno, rowno++, $"0dBm (0%)", JusteRegisterTaskState.Disabled);
- this.rssiRow = rowno - 1;
-
- if (!this.programmingTasks.ContainsKey(slotno))
- {
- this.programmingTasks[slotno] = new Queue();
- }
-
- var tasks = this.programmingTasks[slotno];
-
- var task1 = parameterSet.BuildWupTxLatMBusTask();
- task1.OnProgress += this.Task_OnProgress;
- task1.Slotno = slotno;
- task1.Rowno = rowno++;
- tasks.Enqueue(task1);
-
- var task2 = parameterSet.BuildTestParametersTask();
- task2.OnProgress += this.Task_OnProgress;
- task2.Slotno = slotno;
- task2.Rowno = rowno++;
- tasks.Enqueue(task2);
-
- var task3 = parameterSet.BuildSetupDisplayTask();
- task3.OnProgress += this.Task_OnProgress;
- task3.Slotno = slotno;
- task3.Rowno = rowno++;
- tasks.Enqueue(task3);
-
- var task4 = parameterSet.BuildOptoOnTask();
- task4.OnProgress += this.Task_OnProgress;
- task4.Slotno = slotno;
- task4.Rowno = rowno++;
- tasks.Enqueue(task4);
-
- if (!this.eregisterTasks.ContainsKey(slotno))
- {
- this.eregisterTasks[slotno] = new Queue();
- }
-
- var etasks = this.eregisterTasks[slotno];
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckMBusStatus,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckBatteryVoltage,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckBatteryRemaining,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckRadioFWVersion,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckReboots,
- ProgressHandler = this.Task_OnProgress
- });
- }
- }
-
- public void InitializeCalibration(Int32 slotno)
- {
- var parameterSet = this.programmingParameters[slotno];
- var rowno = 1;
-
- this.OnProgress?.Invoke(0, rowno++, $"Seriennr", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Radio Adresse", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Finale Adresse", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"WUP-TX-LAT-MBus", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Parametersatz", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Anzeige-111111111", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Opto ein", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"MBus status = 7", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Batteriespannung (Volts)", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Batterielaufzeit (Jahre)", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"FW Version", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(0, rowno++, $"Reboots <= 2", JusteRegisterTaskState.Disabled);
-
- rowno = 1;
-
- this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.Serialno}", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.RadioAddress}", JusteRegisterTaskState.Disabled);
- this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.FinalAddress}", JusteRegisterTaskState.Disabled);
-
- this.programmingTasks[slotno] = new Queue();
- var tasks = this.programmingTasks[slotno];
-
- var task1 = parameterSet.BuildWupTxLatMBusTask();
- task1.OnProgress += this.Task_OnProgress;
- task1.Slotno = slotno;
- task1.Rowno = rowno++;
- tasks.Enqueue(task1);
-
- var task2 = parameterSet.BuildTestParametersTask();
- task2.OnProgress += this.Task_OnProgress;
- task2.Slotno = slotno;
- task2.Rowno = rowno++;
- tasks.Enqueue(task2);
-
- var task3 = parameterSet.BuildSetupDisplayTask();
- task3.OnProgress += this.Task_OnProgress;
- task3.Slotno = slotno;
- task3.Rowno = rowno++;
- tasks.Enqueue(task3);
-
- var task4 = parameterSet.BuildOptoOnTask();
- task4.OnProgress += this.Task_OnProgress;
- task4.Slotno = slotno;
- task4.Rowno = rowno++;
- tasks.Enqueue(task4);
-
- this.eregisterTasks[slotno] = new Queue();
- var etasks = this.eregisterTasks[slotno];
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckMBusStatus,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckBatteryVoltage,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckBatteryRemaining,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckRadioFWVersion,
- ProgressHandler = this.Task_OnProgress
- });
-
- etasks.Enqueue(new JusteRegisterTask
- {
- Slotno = slotno,
- Rowno = rowno++,
- TaskHandler = task4.CheckReboots,
- ProgressHandler = this.Task_OnProgress
- });
- }
-
- public void Run()
- {
- var tasks = default(List);
- var allDone = true;
-
- do
- {
- tasks = new List();
-
- foreach (var queue in this.programmingTasks.Values)
- {
- if (queue.Count > 0)
- {
- tasks.Add(queue.Dequeue());
- }
- }
-
- do
- {
- allDone = true;
-
- foreach (var task in tasks)
- {
- if (task.TaskStatus != JustTaskStatus.Completed)
- {
- this.broadcaster.TryRun(task);
-
- Thread.Sleep(100);
-
- allDone = false;
- }
- }
-
- Thread.Sleep(100);
-
- } while (!allDone);
-
- foreach (var task in tasks)
- {
- var slotno = task.Slotno;
-
- if (!this.completedTasks.ContainsKey(slotno))
- {
- this.completedTasks[slotno] = new Queue();
- }
-
- this.completedTasks[slotno].Enqueue(task);
- }
-
- } while (tasks.Count > 0);
-
- foreach (var kvp in this.completedTasks)
- {
- foreach (var task in kvp.Value)
- {
- task.Refresh();
- }
- }
-
- var countTasks = this.eregisterTasks[1].Count;
-
- for (var c = 0; c < countTasks; c++)
- {
- foreach (var kvp in this.eregisterTasks)
- {
- var slotno = kvp.Key;
- var parameterSet = this.programmingParameters[slotno];
- var eregisterTask = kvp.Value.Dequeue();
-
- eregisterTask.Execute(parameterSet);
- kvp.Value.Enqueue(eregisterTask);
- }
- }
- }
-
- public void Run(Int32 slotno)
- {
- this.completedTasks[slotno] = new Queue();
-
- var queue = this.programmingTasks[slotno];
- var awaiter = new ManualResetEventSlim();
-
- while (queue.Count > 0)
- {
- var task = queue.Dequeue();
-
- while (true)
- {
- if (this.broadcaster.TryRun(task) == JustTaskStatus.Sent)
- {
- task.Cancelled += _ => awaiter.Set();
- task.Completed += _ => awaiter.Set();
-
- awaiter.Wait();
- awaiter.Reset();
- }
-
- if (task.TaskStatus == JustTaskStatus.Completed)
- {
- break;
- }
-
- Thread.Sleep(100);
- }
-
- this.completedTasks[slotno].Enqueue(task);
- }
-
- foreach (var kvp in this.completedTasks)
- {
- foreach (var task in kvp.Value)
- {
- task.Refresh();
- }
- }
-
- var countTasks = this.eregisterTasks[1].Count;
- var eregisterTasks = this.eregisterTasks[slotno];
- var eregisterTasksCount = eregisterTasks.Count;
- var parameterSet = this.programmingParameters[slotno];
-
- for (var row = 0; row < eregisterTasksCount; row++)
- {
- var eregisterTask = eregisterTasks.Dequeue();
-
- eregisterTask.Execute(parameterSet);
- eregisterTasks.Enqueue(eregisterTask);
- }
- }
-
- public void Run(JusteRegisterProgrammingTask task)
- {
- var status = this.broadcaster.TryRun(task);
- var awaiter = new ManualResetEventSlim();
-
- while (status != JustTaskStatus.Sent)
- {
- awaiter.Wait(1000);
- awaiter.Reset();
-
- status = this.broadcaster.TryRun(task);
- }
- }
-
- public Boolean StartOnCOMPort(String portName)
- {
- var activated = false;
-
- for (var i = 0; i < 10; i++)
- {
- this.Stop();
-
- this.broadcaster = new JustSirtBroadcaster(portName);
- this.broadcaster.Logging += this.logger.Debug;
-
- if (this.broadcaster.TryActivate())
- {
- activated = true;
-
- break;
- }
-
- Thread.Sleep(1000);
- }
-
- return activated;
- }
-
- public void Stop()
- {
- if (this.broadcaster != null)
- {
- this.broadcaster.TryDeactivate();
- this.programmingParameters.Clear();
- this.programmingTasks.Clear();
-
- this.broadcaster = null;
- }
- }
-
- private void Task_OnProgress(JusteRegisterProgrammingTask task)
- {
- this.OnProgress?.Invoke(task.Slotno, task.Rowno, task.Label, task.State);
-
- if (!String.IsNullOrWhiteSpace(task.RSSI))
- {
- this.OnProgress?.Invoke(task.Slotno, this.rssiRow, task.RSSI, JusteRegisterTaskState.Disabled);
- }
- }
-
- private void Task_OnProgress(Int32 slot, Int32 rowno, String label, JusteRegisterTaskState state)
- => this.OnProgress?.Invoke(slot, rowno, label, state);
-
- private static ILogger CreateNLogger(string name)
- {
- LogManager.Configuration = new LoggingConfiguration();
- LogManager.ThrowConfigExceptions = true;
- LogManager.ThrowExceptions = true;
- LogManager.AutoShutdown = true;
-
- LogManager.Configuration.AddTarget(new FileTarget(name)
- {
- CreateDirs = true,
- KeepFileOpen = true,
- FileName = $"${{CurrentDir}}/{name}/{DateTime.Now:yyyy-MM-dd}.txt"
- });
-
- LogManager.Configuration.AddRule(LogLevel.Trace, LogLevel.Fatal, name);
- LogManager.LogFactory.ReconfigExistingLoggers(true);
- LogManager.ReconfigExistingLoggers(true);
-
- return LogManager.GetLogger(name);
- }
- }
-}
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterTask.cs
deleted file mode 100644
index 27256754..00000000
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterTask.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace Common.Hardware.WaterMeter.eRegister
-{
- using System;
- using System.Linq;
-
- public class JusteRegisterTask
- {
- public event Action OnProgress;
-
- public Int32 Slotno { get; internal set; }
-
- public Int32 Rowno { get; internal set; }
-
- public String Label { get; protected set; }
-
- public JusteRegisterTaskState State { get; protected set; } = JusteRegisterTaskState.None;
-
- public Func> TaskHandler { get; internal set; }
-
- public Action ProgressHandler
- {
- get => (Action)this.OnProgress?.GetInvocationList()?.FirstOrDefault();
- set => this.OnProgress += value;
- }
-
- public void Execute(JusteRegisterParameterSet parameterSet)
- {
- var result = this.TaskHandler?.Invoke(parameterSet);
-
- this.OnProgress?.Invoke(this.Slotno, this.Rowno, result.Item1, result.Item2);
- }
- }
-}
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterParameterSet.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ParameterSet.cs
similarity index 87%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterParameterSet.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ParameterSet.cs
index 18b46bb8..bdaa0ca6 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterParameterSet.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ParameterSet.cs
@@ -7,7 +7,7 @@
using System;
- public class JusteRegisterParameterSet
+ public class ParameterSet
{
public Int32 SharedId { get; set; }
@@ -27,8 +27,8 @@
public Byte[] Parameters { get; set; }
- internal JusteRegisterProgrammingTask BuildWupTxLatMBusTask()
- => new JusteRegisterProgrammingTask
+ internal ProgrammingTask BuildWupTxLatMBusTask()
+ => new ProgrammingTask
{
Cmd = JustSirtMessage.W_PAM,
P1 = new P811
@@ -48,8 +48,8 @@
EncryptionKey = this.IsSealed ? this.RadioKey : null
};
- internal JusteRegisterProgrammingTask BuildTestParametersTask()
- => new JusteRegisterProgrammingTask
+ internal ProgrammingTask BuildTestParametersTask()
+ => new ProgrammingTask
{
Cmd = JustSirtMessage.W_PAM,
P1 = new P811
@@ -74,8 +74,8 @@
EncryptionKey = this.IsSealed ? this.RadioKey : null
};
- internal JusteRegisterProgrammingTask BuildSetupDisplayTask()
- => new JusteRegisterProgrammingTask
+ internal ProgrammingTask BuildSetupDisplayTask()
+ => new ProgrammingTask
{
Cmd = JustSirtMessage.W_PAM,
P1 = new P811
@@ -91,8 +91,8 @@
EncryptionKey = this.IsSealed ? this.RadioKey : null
};
- internal JusteRegisterProgrammingTask BuildOptoOnTask()
- => new JusteRegisterProgrammingTask
+ internal ProgrammingTask BuildOptoOnTask()
+ => new ProgrammingTask
{
Cmd = JustSirtMessage.W_PAM,
P1 = new P811
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingBatch.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingBatch.cs
index b1407b2e..b211e86c 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingBatch.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingBatch.cs
@@ -1,7 +1,6 @@
namespace Common.Hardware.WaterMeter.eRegister
{
- using Common.Hardware.Interfaces.Ports;
- using Common.Hardware.Interfaces.Ports.Sirt;
+ using Common.Hardware.Interfaces.Ports.SirtBroadcaster;
using NLog;
using NLog.Config;
@@ -9,129 +8,436 @@
using System;
using System.Collections.Generic;
- using System.Linq;
using System.Threading;
public class ProgrammingBatch
{
- private readonly ILogger logger;
- private readonly SIRTBroadcaster broadcaster;
- private readonly IDictionary endpoints;
+ private readonly Dictionary programmingParameters
+ = new Dictionary();
+ private readonly Dictionary> programmingTasks
+ = new Dictionary>();
+ private readonly Dictionary> eregisterTasks
+ = new Dictionary>();
+ private readonly Dictionary> completedTasks
+ = new Dictionary>();
+ private readonly ILogger logger = CreateNLogger("SIRT");
+ private JustSirtBroadcaster broadcaster;
+ private Int32 rssiRow;
- private Int32 tasksDone;
+ public event Action OnProgress;
- public ProgrammingBatch(String portName, Int32 rwTimeout = 3000)
+ public void AddOrReplace(ParameterSet parameterSet)
+ => this.programmingParameters[parameterSet.Slotno] = parameterSet;
+
+ public void InitializeCalibration()
{
- this.logger = CreateNLogger("SIRT");
- this.endpoints = new Dictionary();
- this.broadcaster = new SIRTBroadcaster(new SerialPortSettings
+ this.programmingTasks.Clear();
+ this.eregisterTasks.Clear();
+
+ this.OnProgress?.Invoke(0, 0, $"Einbauplatz", TaskState.Disabled);
+
+ for (var x = 1; x < 11; x++)
{
- BaudRate = SerialPortBaudRate.X115200,
- DataBits = SerialPortDataBits.X8,
- Parity = SerialPortParity.None,
- PortName = portName,
- StopBits = SerialPortStopBits.One,
- RWTimeout = rwTimeout
+ this.OnProgress?.Invoke(x, 0, $"{x}", TaskState.Disabled);
+ }
+
+ var rowno = 1;
+
+ this.OnProgress?.Invoke(0, rowno++, $"Seriennr", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Radio Adresse", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Finale Adresse", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"RSSI", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"WUP-TX-LAT-MBus", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Parametersatz", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Anzeige-111111111", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Opto ein", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"MBus status = 7", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Batteriespannung (Volts)", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Batterielaufzeit (Jahre)", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"FW Version", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Reboots <= 2", TaskState.Disabled);
+
+ foreach (var kvp in this.programmingParameters)
+ {
+ var slotno = kvp.Key;
+ var parameterSet = kvp.Value;
+
+ rowno = 1;
+
+ this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.Serialno}", TaskState.Disabled);
+ this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.RadioAddress}", TaskState.Disabled);
+ this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.FinalAddress}", TaskState.Disabled);
+ this.OnProgress?.Invoke(slotno, rowno++, $"0dBm (0%)", TaskState.Disabled);
+ this.rssiRow = rowno - 1;
+
+ if (!this.programmingTasks.ContainsKey(slotno))
+ {
+ this.programmingTasks[slotno] = new Queue();
+ }
+
+ var tasks = this.programmingTasks[slotno];
+
+ var task1 = parameterSet.BuildWupTxLatMBusTask();
+ task1.OnProgress += this.Task_OnProgress;
+ task1.Slotno = slotno;
+ task1.Rowno = rowno++;
+ tasks.Enqueue(task1);
+
+ var task2 = parameterSet.BuildTestParametersTask();
+ task2.OnProgress += this.Task_OnProgress;
+ task2.Slotno = slotno;
+ task2.Rowno = rowno++;
+ tasks.Enqueue(task2);
+
+ var task3 = parameterSet.BuildSetupDisplayTask();
+ task3.OnProgress += this.Task_OnProgress;
+ task3.Slotno = slotno;
+ task3.Rowno = rowno++;
+ tasks.Enqueue(task3);
+
+ var task4 = parameterSet.BuildOptoOnTask();
+ task4.OnProgress += this.Task_OnProgress;
+ task4.Slotno = slotno;
+ task4.Rowno = rowno++;
+ tasks.Enqueue(task4);
+
+ if (!this.eregisterTasks.ContainsKey(slotno))
+ {
+ this.eregisterTasks[slotno] = new Queue();
+ }
+
+ var etasks = this.eregisterTasks[slotno];
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckMBusStatus,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckBatteryVoltage,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckBatteryRemaining,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckRadioFWVersion,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckReboots,
+ ProgressHandler = this.Task_OnProgress
+ });
+ }
+ }
+
+ public void InitializeCalibration(Int32 slotno)
+ {
+ var parameterSet = this.programmingParameters[slotno];
+ var rowno = 1;
+
+ this.OnProgress?.Invoke(0, rowno++, $"Seriennr", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Radio Adresse", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Finale Adresse", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"WUP-TX-LAT-MBus", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Parametersatz", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Anzeige-111111111", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Opto ein", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"MBus status = 7", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Batteriespannung (Volts)", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Batterielaufzeit (Jahre)", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"FW Version", TaskState.Disabled);
+ this.OnProgress?.Invoke(0, rowno++, $"Reboots <= 2", TaskState.Disabled);
+
+ rowno = 1;
+
+ this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.Serialno}", TaskState.Disabled);
+ this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.RadioAddress}", TaskState.Disabled);
+ this.OnProgress?.Invoke(slotno, rowno++, $"{parameterSet.FinalAddress}", TaskState.Disabled);
+
+ this.programmingTasks[slotno] = new Queue();
+ var tasks = this.programmingTasks[slotno];
+
+ var task1 = parameterSet.BuildWupTxLatMBusTask();
+ task1.OnProgress += this.Task_OnProgress;
+ task1.Slotno = slotno;
+ task1.Rowno = rowno++;
+ tasks.Enqueue(task1);
+
+ var task2 = parameterSet.BuildTestParametersTask();
+ task2.OnProgress += this.Task_OnProgress;
+ task2.Slotno = slotno;
+ task2.Rowno = rowno++;
+ tasks.Enqueue(task2);
+
+ var task3 = parameterSet.BuildSetupDisplayTask();
+ task3.OnProgress += this.Task_OnProgress;
+ task3.Slotno = slotno;
+ task3.Rowno = rowno++;
+ tasks.Enqueue(task3);
+
+ var task4 = parameterSet.BuildOptoOnTask();
+ task4.OnProgress += this.Task_OnProgress;
+ task4.Slotno = slotno;
+ task4.Rowno = rowno++;
+ tasks.Enqueue(task4);
+
+ this.eregisterTasks[slotno] = new Queue();
+ var etasks = this.eregisterTasks[slotno];
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckMBusStatus,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckBatteryVoltage,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckBatteryRemaining,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckRadioFWVersion,
+ ProgressHandler = this.Task_OnProgress
+ });
+
+ etasks.Enqueue(new JustTask
+ {
+ Slotno = slotno,
+ Rowno = rowno++,
+ TaskHandler = task4.CheckReboots,
+ ProgressHandler = this.Task_OnProgress
});
}
- public event Action Done;
-
- public event Action Activated
+ public void Run()
{
- add => this.broadcaster.Activated += value;
- remove => this.broadcaster.Activated -= value;
- }
+ var tasks = default(List);
+ var allDone = true;
- public void Add(Int32 slotno, Int32 serialno, UInt32 address, UInt32 finalAddress, Byte[] key, Boolean @sealed)
- {
- this.endpoints[slotno] = new Endpoint(this.logger)
- {
- Slot = slotno,
- SerialNo = serialno,
- Address = address,
- FinalAddress = finalAddress,
- Key = key,
- Sealed = @sealed
- };
- this.endpoints[slotno].Done += this.Endpoint_Done;
- }
-
- public void AddHexCommand(Int32 slotno, Byte[] command)
- {
- if (this.endpoints.ContainsKey(slotno))
- {
- this.endpoints[slotno].AddHexCommand(command);
- }
- }
-
- public void ActivateSIRT() => this.broadcaster.Open();
-
- public void DeactivateSIRT() => this.broadcaster.Close();
-
- public IEnumerable Slots() => this.endpoints.Values.Select(x => x.Slot);
-
- public IEnumerable SerialNumbers() => this.endpoints.Values.Select(x => x.SerialNo);
-
- public IEnumerable RadioAddresses() => this.endpoints.Values.Select(x => x.Address);
-
- public IEnumerable InitForInspection() => this.endpoints.Values.Select(x => this.Run(x.InitForInspection));
-
- public IEnumerable SetupForInspection() => this.endpoints.Values.Select(x => this.Run(x.SetupForInspection));
-
- public IEnumerable SetDisplay111111111() => this.endpoints.Values.Select(x => this.Run(x.SetDisplay111111111));
-
- public IEnumerable StartLED() => this.endpoints.Values.Select(x => this.Run(x.StartLED));
-
- public IEnumerable DoChecks() => this.endpoints.Values.Select(x => x.DoChecks());
-
- public IEnumerable> RunCommands()
- {
do
{
- var commands = this.endpoints.Values.Select(x => x.RunCommand()).ToArray();
+ tasks = new List();
- foreach (var command in commands)
+ foreach (var queue in this.programmingTasks.Values)
{
- if (command != null)
+ if (queue.Count > 0)
{
- this.Run(() => command);
+ tasks.Add(queue.Dequeue());
}
}
- if (commands.Any(x => x is null))
+ do
{
- break;
- }
- else
+ allDone = true;
+
+ foreach (var task in tasks)
+ {
+ if (task.TaskStatus != JustTaskStatus.Completed)
+ {
+ this.broadcaster.TryRun(task);
+
+ Thread.Sleep(100);
+
+ allDone = false;
+ }
+ }
+
+ Thread.Sleep(100);
+
+ } while (!allDone);
+
+ foreach (var task in tasks)
{
- yield return commands;
+ var slotno = task.Slotno;
+
+ if (!this.completedTasks.ContainsKey(slotno))
+ {
+ this.completedTasks[slotno] = new Queue();
+ }
+
+ this.completedTasks[slotno].Enqueue(task);
}
- } while (true);
- }
+ } while (tasks.Count > 0);
- private EndpointTask Run(Func taskHandler)
- {
- var task = taskHandler();
-
- this.broadcaster.Add(task);
-
- return task;
- }
-
- private void Endpoint_Done(Int32 remainingTasks)
- {
- this.tasksDone++;
-
- Thread.Sleep(1000);
-
- if (this.tasksDone == this.endpoints.Count)
+ foreach (var kvp in this.completedTasks)
{
- this.Done?.Invoke(0);
+ foreach (var task in kvp.Value)
+ {
+ task.Refresh();
+ }
+ }
+
+ var countTasks = this.eregisterTasks[1].Count;
+
+ for (var c = 0; c < countTasks; c++)
+ {
+ foreach (var kvp in this.eregisterTasks)
+ {
+ var slotno = kvp.Key;
+ var parameterSet = this.programmingParameters[slotno];
+ var eregisterTask = kvp.Value.Dequeue();
+
+ eregisterTask.Execute(parameterSet);
+ kvp.Value.Enqueue(eregisterTask);
+ }
}
}
+ public void Run(Int32 slotno)
+ {
+ this.completedTasks[slotno] = new Queue();
+
+ var queue = this.programmingTasks[slotno];
+ var awaiter = new ManualResetEventSlim();
+
+ while (queue.Count > 0)
+ {
+ var task = queue.Dequeue();
+
+ while (true)
+ {
+ if (this.broadcaster.TryRun(task) == JustTaskStatus.Sent)
+ {
+ task.Cancelled += _ => awaiter.Set();
+ task.Completed += _ => awaiter.Set();
+
+ awaiter.Wait();
+ awaiter.Reset();
+ }
+
+ if (task.TaskStatus == JustTaskStatus.Completed)
+ {
+ break;
+ }
+
+ Thread.Sleep(100);
+ }
+
+ this.completedTasks[slotno].Enqueue(task);
+ }
+
+ foreach (var kvp in this.completedTasks)
+ {
+ foreach (var task in kvp.Value)
+ {
+ task.Refresh();
+ }
+ }
+
+ var countTasks = this.eregisterTasks[1].Count;
+ var eregisterTasks = this.eregisterTasks[slotno];
+ var eregisterTasksCount = eregisterTasks.Count;
+ var parameterSet = this.programmingParameters[slotno];
+
+ for (var row = 0; row < eregisterTasksCount; row++)
+ {
+ var eregisterTask = eregisterTasks.Dequeue();
+
+ eregisterTask.Execute(parameterSet);
+ eregisterTasks.Enqueue(eregisterTask);
+ }
+ }
+
+ public void Run(ProgrammingTask task)
+ {
+ var status = this.broadcaster.TryRun(task);
+ var awaiter = new ManualResetEventSlim();
+
+ while (status != JustTaskStatus.Sent)
+ {
+ awaiter.Wait(1000);
+ awaiter.Reset();
+
+ status = this.broadcaster.TryRun(task);
+ }
+ }
+
+ public Boolean StartOnCOMPort(String portName)
+ {
+ var activated = false;
+
+ for (var i = 0; i < 10; i++)
+ {
+ this.Stop();
+
+ this.broadcaster = new JustSirtBroadcaster(portName);
+ this.broadcaster.Logging += this.logger.Debug;
+
+ if (this.broadcaster.TryActivate())
+ {
+ activated = true;
+
+ break;
+ }
+
+ Thread.Sleep(1000);
+ }
+
+ return activated;
+ }
+
+ public void Stop()
+ {
+ if (this.broadcaster != null)
+ {
+ this.broadcaster.TryDeactivate();
+ this.programmingParameters.Clear();
+ this.programmingTasks.Clear();
+
+ this.broadcaster = null;
+ }
+ }
+
+ private void Task_OnProgress(ProgrammingTask task)
+ {
+ this.OnProgress?.Invoke(task.Slotno, task.Rowno, task.Label, task.State);
+
+ if (!String.IsNullOrWhiteSpace(task.RSSI))
+ {
+ this.OnProgress?.Invoke(task.Slotno, this.rssiRow, task.RSSI, TaskState.Disabled);
+ }
+ }
+
+ private void Task_OnProgress(Int32 slot, Int32 rowno, String label, TaskState state)
+ => this.OnProgress?.Invoke(slot, rowno, label, state);
+
private static ILogger CreateNLogger(string name)
{
LogManager.Configuration = new LoggingConfiguration();
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProgrammingTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingTask.cs
similarity index 77%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProgrammingTask.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingTask.cs
index 80c1c4aa..55d0266b 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterProgrammingTask.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/ProgrammingTask.cs
@@ -3,12 +3,13 @@
using Common.Hardware.Interfaces.Ports.Sirt;
using Common.Hardware.Interfaces.Ports.Sirt.Parameters;
using Common.Hardware.Interfaces.Ports.SirtBroadcaster;
+ using Common.Hardware.WaterMeter.eRegister.Data;
using System;
using System.Collections.Generic;
using System.Linq;
- public class JusteRegisterProgrammingTask : JustSirtTask
+ public class ProgrammingTask : JustSirtTask
{
private const String PENDING = nameof(PENDING);
@@ -17,7 +18,7 @@
private readonly ICollection debugs = new List();
private readonly ICollection semis = new List();
- public event Action OnProgress;
+ public event Action OnProgress;
public Byte[] EncryptionKey { get; set; }
@@ -29,7 +30,7 @@
public String RSSI { get; private set; }
- public JusteRegisterTaskState State { get; private set; } = JusteRegisterTaskState.None;
+ public TaskState State { get; private set; } = TaskState.None;
public override void PrepareForRun()
{
@@ -45,7 +46,7 @@
this.DecryptResponse(response);
}
- if (this.State != JusteRegisterTaskState.Success && response.Cmd == JustSirtMessage.FROMAIR)
+ if (this.State != TaskState.Success && response.Cmd == JustSirtMessage.FROMAIR)
{
var label = this.Label;
var state = this.State;
@@ -59,12 +60,12 @@
if (semi.PAMStatus == PAMStatus.OK)
{
- state = JusteRegisterTaskState.Success;
+ state = TaskState.Success;
this.TaskStatus = JustTaskStatus.Completed;
}
else
{
- state = JusteRegisterTaskState.Error;
+ state = TaskState.Error;
this.TaskStatus = JustTaskStatus.Cancelled;
}
@@ -73,21 +74,21 @@
else if (type == JustSirtMessage.BUP)
{
label = nameof(JustSirtMessage.BUP);
- state = JusteRegisterTaskState.Warning;
+ state = TaskState.Warning;
this.bups.Add(new BUP(data));
}
else if (type == JustSirtMessage.LAT)
{
label = nameof(JustSirtMessage.LAT);
- state = JusteRegisterTaskState.Warning;
+ state = TaskState.Warning;
this.lats.Add(new LAT(data));
}
else if (type == JustSirtMessage.DEBUG)
{
label = nameof(JustSirtMessage.DEBUG);
- state = JusteRegisterTaskState.Warning;
+ state = TaskState.Warning;
this.debugs.Add(new DEBUG(data));
}
@@ -121,11 +122,11 @@
if (semi.PAMStatus == PAMStatus.OK)
{
- this.State = JusteRegisterTaskState.Success;
+ this.State = TaskState.Success;
}
else
{
- this.State = JusteRegisterTaskState.Error;
+ this.State = TaskState.Error;
}
}
else if (this.LastPayload != null)
@@ -136,73 +137,73 @@
if (p11.LenOverflow)
{
this.Label = "LEN OVERFLOW";
- this.State = JusteRegisterTaskState.Error;
+ this.State = TaskState.Error;
}
else if (!p11.SrcChannel && p11.InvalidMod1)
{
this.Label = "MOD 1 CRC ERROR";
- this.State = JusteRegisterTaskState.Error;
+ this.State = TaskState.Error;
}
else if (p11.SrcChannel && p11.InvalidMod2)
{
this.Label = "MOD 2 CRC ERROR";
- this.State = JusteRegisterTaskState.Error;
+ this.State = TaskState.Error;
}
else
{
this.Label = nameof(PAMStatus.OK);
- this.State = JusteRegisterTaskState.Success;
+ this.State = TaskState.Success;
}
}
else
{
this.Label = "NA";
- this.State = JusteRegisterTaskState.Error;
+ this.State = TaskState.Error;
}
this.OnProgress?.Invoke(this);
}
- internal Tuple CheckMBusStatus(JusteRegisterParameterSet parameterSet)
+ internal Tuple CheckMBusStatus(ParameterSet parameterSet)
{
var label = $"{this.semis.LastOrDefault()?.MBusStatus} OK";
- return new Tuple(label, JusteRegisterTaskState.Success);
+ return new Tuple(label, TaskState.Success);
}
- internal Tuple CheckBatteryVoltage(JusteRegisterParameterSet parameterSet)
+ internal Tuple CheckBatteryVoltage(ParameterSet parameterSet)
{
var label = $"{this.debugs.LastOrDefault()?.BatteryVoltage:0.00} OK";
- return new Tuple(label, JusteRegisterTaskState.Success);
+ return new Tuple(label, TaskState.Success);
}
- internal Tuple CheckBatteryRemaining(JusteRegisterParameterSet parameterSet)
+ internal Tuple CheckBatteryRemaining(ParameterSet parameterSet)
{
var label = $"{this.semis.LastOrDefault()?.BatteryRemaining:0.0} OK";
- return new Tuple(label, JusteRegisterTaskState.Success);
+ return new Tuple(label, TaskState.Success);
}
- internal Tuple CheckRadioFWVersion(JusteRegisterParameterSet parameterSet)
+ internal Tuple CheckRadioFWVersion(ParameterSet parameterSet)
{
var label = $"{this.debugs.LastOrDefault()?.RadioFirmwareVersion} OK";
- return new Tuple(label, JusteRegisterTaskState.Success);
+ return new Tuple(label, TaskState.Success);
}
- internal Tuple CheckMetrologyFWVersion(JusteRegisterParameterSet arg)
+ internal Tuple CheckMetrologyFWVersion(ParameterSet arg)
{
var label = $"{this.debugs.LastOrDefault()?.MetrologyFirmwareVersion} OK";
- return new Tuple(label, JusteRegisterTaskState.Success);
+ return new Tuple(label, TaskState.Success);
}
- internal Tuple CheckReboots(JusteRegisterParameterSet parameterSet)
+ internal Tuple CheckReboots(ParameterSet parameterSet)
{
var label = $"{this.debugs.LastOrDefault()?.RebootCount} OK";
- return new Tuple(label, JusteRegisterTaskState.Success);
+ return new Tuple(label, TaskState.Success);
}
private void DecryptResponse(JustSirtMessage response)
diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterTaskState.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/TaskState.cs
similarity index 78%
rename from Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterTaskState.cs
rename to Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/TaskState.cs
index fa108c53..e06d6018 100644
--- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/JusteRegisterTaskState.cs
+++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/TaskState.cs
@@ -1,6 +1,6 @@
namespace Common.Hardware.WaterMeter.eRegister
{
- public enum JusteRegisterTaskState
+ public enum TaskState
{
Disabled,
None,
diff --git a/Common/OmniPlus/InspectionUI/InspectionUI.csproj b/Common/OmniPlus/InspectionUI/InspectionUI.csproj
index c410fd5d..46e5dcda 100644
--- a/Common/OmniPlus/InspectionUI/InspectionUI.csproj
+++ b/Common/OmniPlus/InspectionUI/InspectionUI.csproj
@@ -72,17 +72,6 @@
MSBuild:Compile
Designer
-
- Init.xaml
-
-
- RunCommans.xaml
-
-
-
-
-
-
ItemsGrid.xaml
@@ -113,14 +102,6 @@
-
- Designer
- MSBuild:Compile
-
-
- Designer
- MSBuild:Compile
-
Designer
MSBuild:Compile
diff --git a/Common/OmniPlus/InspectionUI/eRegister/Init.xaml b/Common/OmniPlus/InspectionUI/eRegister/Init.xaml
deleted file mode 100644
index 3e6077d2..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/Init.xaml
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Common/OmniPlus/InspectionUI/eRegister/Init.xaml.cs b/Common/OmniPlus/InspectionUI/eRegister/Init.xaml.cs
deleted file mode 100644
index 8d9a2a9f..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/Init.xaml.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace InspectionUI.eRegister
-{
- ///
- /// Interaction logic for Init.xaml
- ///
- public partial class Init : Window
- {
- public Init()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/Common/OmniPlus/InspectionUI/eRegister/RunCommans.xaml b/Common/OmniPlus/InspectionUI/eRegister/RunCommans.xaml
deleted file mode 100644
index 878d08e2..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/RunCommans.xaml
+++ /dev/null
@@ -1,176 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Common/OmniPlus/InspectionUI/eRegister/RunCommans.xaml.cs b/Common/OmniPlus/InspectionUI/eRegister/RunCommans.xaml.cs
deleted file mode 100644
index 4a6a347a..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/RunCommans.xaml.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-
-namespace InspectionUI.eRegister
-{
- ///
- /// Interaction logic for RunCommans.xaml
- ///
- public partial class RunCommans : Window
- {
- public RunCommans()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/GridCellVM.cs b/Common/OmniPlus/InspectionUI/eRegister/ViewModels/GridCellVM.cs
deleted file mode 100644
index ba93b787..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/GridCellVM.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-namespace InspectionUI.eRegister.ViewModels
-{
- using System;
- using System.Windows;
- using System.Windows.Media;
-
- public class GridCellVM : VM
- {
- private Int32 gridColumn;
- private Int32 gridRow;
- private String view;
- private TextAlignment textAlignment;
- private Brush background;
- private Brush foreground;
- private FontWeight fontWeight;
-
- public GridCellVM() : base()
- {
- this.Background = Brushes.White;
- this.Foreground = Brushes.Black;
- this.TextAlignment = TextAlignment.Center;
- this.FontWeight = FontWeights.Normal;
- }
-
- public String View
- {
- get => this.view;
- set => this.Set(x => x.view = value);
- }
-
- public Int32 GridColumn
- {
- get => this.gridColumn;
- set => this.Set(x => x.gridColumn = value);
- }
-
- public Int32 GridRow
- {
- get => this.gridRow;
- set => this.Set(x => x.gridRow = value);
- }
-
- public TextAlignment TextAlignment
- {
- get => this.textAlignment;
- set => this.Set(x => x.textAlignment = value);
- }
-
- public Brush Background
- {
- get => this.background;
- set => this.Set(x => x.background = value);
- }
-
- public Brush Foreground
- {
- get => this.foreground;
- set => this.Set(x => x.foreground = value);
- }
-
- public FontWeight FontWeight
- {
- get => this.fontWeight;
- set => this.Set(x => x.fontWeight = value);
- }
- }
-}
diff --git a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/InitVM.cs b/Common/OmniPlus/InspectionUI/eRegister/ViewModels/InitVM.cs
deleted file mode 100644
index c0e167d4..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/InitVM.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-namespace InspectionUI.eRegister.ViewModels
-{
- using Common.Hardware.WaterMeter.eRegister;
-
- using System;
- using System.Collections.ObjectModel;
- using System.Threading;
- using System.Windows;
- using System.Windows.Media;
-
- public class InitVM : VM
- {
- private ProgrammingBatch programmingBatch;
- private Boolean waitingActivation;
- private String sirt;
-
- public InitVM() : base()
- {
- this.waitingActivation = true;
- this.ItemsSource = new ObservableCollection();
- }
-
- public Boolean WaitingActivation
- {
- get => this.waitingActivation;
- set => this.Set(vm => vm.waitingActivation = value);
- }
-
- public String SIRT
- {
- get => this.sirt;
- set => this.Set(vm => vm.sirt = value);
- }
-
- public ObservableCollection ItemsSource { get; }
-
- public override void Dispose()
- {
- this.programmingBatch.DeactivateSIRT();
-
- foreach (var disposable in this.ItemsSource)
- {
- disposable.Dispose();
- }
-
- base.Dispose();
- }
-
- public void Activate(ProgrammingBatch programmingBatch)
- {
- this.programmingBatch = programmingBatch;
- this.programmingBatch.Activated += this.LoadEndpoints;
- this.programmingBatch.Done += this.Shutdown;
-
- this.StartTask(this.programmingBatch.ActivateSIRT);
- }
-
- private void Shutdown(Int32 exitCode)
- {
- this.DispatcherInvoke(() =>
- {
- this.Dispose();
-
- Thread.Sleep(5000);
- App.Current.Shutdown(exitCode);
- });
- }
-
- private void LoadEndpoints(String sirtID, Int32 MHz)
- {
- this.SIRT = $"SIRT({sirtID}) - {MHz}MHz";
- this.programmingBatch.Activated -= this.LoadEndpoints;
-
- this.DispatcherInvoke(() =>
- {
- var gridRow = 0;
-
- this.AddSlots(gridRow++);
- this.AddSerialNumbers(gridRow++);
- this.AddRadioAddresses(gridRow++);
- this.AddInitTasks(gridRow++);
- this.AddSetupTasks(gridRow++);
- this.AddMeterReading(gridRow++);
- this.AddLED(gridRow++);
- this.AddChecks(gridRow++);
- });
- }
-
- private void AddSlots(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "Einbauplatz",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var slot in this.programmingBatch.Slots())
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = $"{slot}",
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
- }
- }
-
- private void AddSerialNumbers(Int32 gridRow, Int32 gridColumn = 0)
- {
-
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "SerienNr",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var serialno in this.programmingBatch.SerialNumbers())
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = $"{serialno}",
- });
- }
- }
-
- private void AddRadioAddresses(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "Adresse",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var address in this.programmingBatch.RadioAddresses())
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = $"{address}",
- });
- }
- }
-
- private void AddInitTasks(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "WUP|LAT|TXIV|MBUS",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var task in this.programmingBatch.InitForInspection())
- {
- this.ItemsSource.Add(new TaskVM(gridRow, gridColumn++, task));
- }
- }
-
- private void AddSetupTasks(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "Prüfunginitialisierung",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var task in this.programmingBatch.InitForInspection())
- {
- this.ItemsSource.Add(new TaskVM(gridRow, gridColumn++, task));
- }
- }
-
- private void AddMeterReading(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "111111.111",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var task in this.programmingBatch.SetDisplay111111111())
- {
- this.ItemsSource.Add(new TaskVM(gridRow, gridColumn++, task));
- }
- }
-
- private void AddLED(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "LED AN",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var task in this.programmingBatch.StartLED())
- {
- this.ItemsSource.Add(new TaskVM(gridRow, gridColumn++, task));
- }
- }
-
- private void AddChecks(Int32 gridRow, Int32 gridColumn = 0)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "Überprüfen",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var task in this.programmingBatch.DoChecks())
- {
- this.ItemsSource.Add(new TaskVM(gridRow, gridColumn++, task));
- }
- }
- }
-}
diff --git a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/RunCommandsVM.cs b/Common/OmniPlus/InspectionUI/eRegister/ViewModels/RunCommandsVM.cs
deleted file mode 100644
index 4350b1fd..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/RunCommandsVM.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-namespace InspectionUI.eRegister.ViewModels
-{
- using Common.Hardware.WaterMeter.eRegister;
-
- using System;
- using System.Collections.ObjectModel;
- using System.Threading;
- using System.Windows;
- using System.Windows.Media;
-
- public class RunCommandsVM : VM
- {
- private ProgrammingBatch programmingBatch;
- private Boolean waitingActivation;
- private String sirt;
-
- public RunCommandsVM() : base()
- {
- this.waitingActivation = true;
- this.ItemsSource = new ObservableCollection();
- }
-
- public Boolean WaitingActivation
- {
- get => this.waitingActivation;
- set => this.Set(vm => vm.waitingActivation = value);
- }
-
- public String SIRT
- {
- get => this.sirt;
- set => this.Set(vm => vm.sirt = value);
- }
-
- public ObservableCollection ItemsSource { get; }
-
- public override void Dispose()
- {
- this.programmingBatch.DeactivateSIRT();
-
- foreach (var disposable in this.ItemsSource)
- {
- disposable.Dispose();
- }
-
- base.Dispose();
- }
-
- public void Activate(ProgrammingBatch programmingBatch)
- {
- this.programmingBatch = programmingBatch;
- this.programmingBatch.Activated += this.LoadEndpoints;
- this.programmingBatch.Done += this.Shutdown;
-
- this.StartTask(this.programmingBatch.ActivateSIRT);
- }
-
- private void Shutdown(Int32 exitCode)
- {
- this.DispatcherInvoke(() =>
- {
- this.Dispose();
-
- Thread.Sleep(5000);
- App.Current.Shutdown(exitCode);
- });
- }
-
- private void LoadEndpoints(String sirtID, Int32 MHz)
- {
- this.SIRT = $"SIRT({sirtID}) - {MHz}MHz";
- this.programmingBatch.Activated -= this.LoadEndpoints;
-
- this.DispatcherInvoke(() =>
- {
- var gridRow = 0;
- var first = false;
-
- foreach (var commands in this.programmingBatch.RunCommands())
- {
- var gridColumn = 0;
-
- if (!first)
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "Einbauplatz",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
-
- foreach (var slot in this.programmingBatch.Slots())
- {
- this.ItemsSource.Add(new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = $"{slot}",
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- });
- }
-
- first = true;
- }
-
- var headerSet = false;
- var header = new TextVM
- {
- GridColumn = gridColumn++,
- GridRow = gridRow,
- View = "PAM -1",
- TextAlignment = TextAlignment.Right,
- FontWeight = FontWeights.SemiBold,
- Background = Brushes.WhiteSmoke
- };
-
- this.ItemsSource.Add(header);
-
- foreach (var command in commands)
- {
- if (!headerSet)
- {
- header.View = command.FirstPamId;
- headerSet = true;
- }
-
- this.ItemsSource.Add(new TaskVM(gridRow, gridColumn++, command));
- }
- }
- });
- }
- }
-}
diff --git a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/TaskVM.cs b/Common/OmniPlus/InspectionUI/eRegister/ViewModels/TaskVM.cs
deleted file mode 100644
index 56d0e6cb..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/TaskVM.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-namespace InspectionUI.eRegister.ViewModels
-{
- using Common.Hardware.WaterMeter.eRegister;
-
- using System;
- using System.Windows.Media;
-
- public class TaskVM : GridCellVM
- {
- const String VIEW = "-----";
-
- private readonly EndpointTask task;
-
- public TaskVM(Int32 gridRow, Int32 gridColumn, EndpointTask task) : base()
- {
- this.GridRow = gridRow;
- this.GridColumn = gridColumn;
- this.task = task;
- this.task.Cancelled += this.Cancelled;
- this.task.Completed += this.Completed;
- this.task.Received += this.Received;
- this.View = VIEW;
- }
-
- public override void Dispose()
- {
- this.task.Cancelled -= this.Cancelled;
- this.task.Completed -= this.Completed;
-
- base.Dispose();
- }
-
- private void Completed()
- {
- this.Background = Brushes.LightGreen;
- this.Foreground = Brushes.DarkGreen;
-
- if (this.View == VIEW)
- {
- this.View = "OK";
- }
- }
-
- private void Cancelled()
- {
- this.Background = Brushes.LightCoral;
- this.Foreground = Brushes.DarkRed;
-
- if (this.View == VIEW)
- {
- this.View = "FEHLER";
- }
- }
-
- private void Received(String type)
- {
- this.Background = Brushes.White;
- this.Foreground = Brushes.Black;
- this.View = type;
- }
- }
-}
diff --git a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/TextVM.cs b/Common/OmniPlus/InspectionUI/eRegister/ViewModels/TextVM.cs
deleted file mode 100644
index 9c0faf0a..00000000
--- a/Common/OmniPlus/InspectionUI/eRegister/ViewModels/TextVM.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace InspectionUI.eRegister.ViewModels
-{
- public class TextVM : GridCellVM
- {
- public TextVM() : base()
- {
- }
- }
-}
diff --git a/Common/Service/MeterProcessState/Controllers/FinalCheckController.cs b/Common/Service/MeterProcessState/Controllers/FinalCheckController.cs
index 88942590..5539a4fb 100644
--- a/Common/Service/MeterProcessState/Controllers/FinalCheckController.cs
+++ b/Common/Service/MeterProcessState/Controllers/FinalCheckController.cs
@@ -1329,6 +1329,11 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
Succeeded = x.GetValue(18),
});
+ if (result is null)
+ {
+ return this.NotFound();
+ }
+
return this.Json(result);
}
}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/App.config b/Common/Ui/Common.UI.SIRTBroadcaster/App.config
deleted file mode 100644
index 6551dddf..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/App.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/App.xaml b/Common/Ui/Common.UI.SIRTBroadcaster/App.xaml
deleted file mode 100644
index 6f249b31..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/App.xaml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/App.xaml.cs b/Common/Ui/Common.UI.SIRTBroadcaster/App.xaml.cs
deleted file mode 100644
index 81ab4403..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/App.xaml.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-namespace Common.UI.SIRTBroadcaster
-{
- using System;
- using System.Windows;
-
- public partial class App : Application
- {
- private static Boolean activatedForFirstTime;
-
- public static event Action Exited;
- public static event Action Started;
-
- public static void Invoke(Action action) => Current?.Dispatcher?.Invoke(action);
-
- protected override void OnActivated(EventArgs e)
- {
- base.OnActivated(e);
-
- if (!activatedForFirstTime)
- {
- activatedForFirstTime = true;
-
- Started?.Invoke();
- }
- }
-
- protected override void OnExit(ExitEventArgs e)
- {
- Exited?.Invoke();
-
- base.OnExit(e);
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Common.UI.SIRTBroadcaster.csproj b/Common/Ui/Common.UI.SIRTBroadcaster/Common.UI.SIRTBroadcaster.csproj
deleted file mode 100644
index 62e083e4..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Common.UI.SIRTBroadcaster.csproj
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {8D3B1C46-B23E-46CC-9B59-24E34DE60510}
- WinExe
- Common.UI.SIRTBroadcaster
- Common.UI.SIRTBroadcaster
- v4.0
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- true
-
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- IDE0003;IDE0049;
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
- ..\..\packages\Newtonsoft.Json.13.0.3\lib\net40\Newtonsoft.Json.dll
-
-
- ..\..\packages\NLog.5.3.2\lib\net35\NLog.dll
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
- InitInspectionWindow.xaml
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- App.xaml
- Code
-
-
- MainWindow.xaml
- Code
-
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
- {b23bfaf9-08ae-4311-8c08-fb2bb49ea2ad}
- Common.Hardware.Interfaces.Ports.Sirt
-
-
- {9ae071c0-db12-4e09-a3c7-43f6dcd518d6}
- Common.Hardware.Interfaces.Ports
-
-
- {E19C1694-132E-477C-86CB-8E146D5F59B0}
- Common.Hardware.WaterMeter.eRegister.Features
-
-
- {4E8BB839-D40A-488C-88CE-F21811F1F476}
- Common.Hardware.WaterMeter.eRegister
-
-
- {05f0ccaf-9f2b-45f9-a7f8-12f29ad182f3}
- Common.Utils.Extensions
-
-
-
-
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/InitInspectionWindow.xaml b/Common/Ui/Common.UI.SIRTBroadcaster/InitInspectionWindow.xaml
deleted file mode 100644
index 6ced5c2e..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/InitInspectionWindow.xaml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/InitInspectionWindow.xaml.cs b/Common/Ui/Common.UI.SIRTBroadcaster/InitInspectionWindow.xaml.cs
deleted file mode 100644
index 14944a74..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/InitInspectionWindow.xaml.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-namespace Common.UI.SIRTBroadcaster
-{
- using Common.Hardware.WaterMeter.eRegister;
- using Common.UI.SIRTBroadcaster.ViewModels;
-
- using System.Windows;
-
- public partial class InitInspectionWindow : Window
- {
- public InitInspectionWindow()
- {
- this.InitializeComponent();
-
- App.Started += this.App_Started;
- }
-
- private void App_Started()
- {
- if (this.DataContext is InitInspectionVM inspection)
- {
- inspection.Shutdown += App.Current.Shutdown;
- inspection.StartProgramming();
- }
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/MainWindow.xaml b/Common/Ui/Common.UI.SIRTBroadcaster/MainWindow.xaml
deleted file mode 100644
index d5adcd04..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/MainWindow.xaml
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/MainWindow.xaml.cs b/Common/Ui/Common.UI.SIRTBroadcaster/MainWindow.xaml.cs
deleted file mode 100644
index ce8eca7b..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/MainWindow.xaml.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace Common.UI.SIRTBroadcaster
-{
- using System.Windows;
-
- public partial class MainWindow : Window
- {
- public MainWindow() => this.InitializeComponent();
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Models/InitInspectionM.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Models/InitInspectionM.cs
deleted file mode 100644
index 46928920..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Models/InitInspectionM.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Models
-{
- using Common.Hardware.WaterMeter.eRegister;
-
- using System.Collections.Generic;
-
- public class InitInspectionM
- {
- private ProgrammingBatch programmingBatch;
-
- internal void InitProgramming(ProgrammingBatch programmingBatch)
- => this.programmingBatch = programmingBatch;
-
- internal IEnumerable> ProgrammingTasks()
- => null;
-
- internal void StartProgramming()
- {
-
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Models/Result.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Models/Result.cs
deleted file mode 100644
index 421af9c1..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Models/Result.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Models
-{
- using System;
-
- public enum Result : Byte
- {
- None,
- NA,
- Processing,
- Completed,
- Succes,
- Warning,
- Fail,
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Models/SIRTBroadcasterModel.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Models/SIRTBroadcasterModel.cs
deleted file mode 100644
index 41d87b11..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Models/SIRTBroadcasterModel.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Models
-{
- using Common.Hardware.Interfaces.Ports;
- using Common.Hardware.Interfaces.Ports.Sirt;
- using Common.UI.SIRTBroadcaster.Utilities;
-
- using NLog;
-
- using System;
-
- public partial class SIRTBroadcasterModel
- {
- private readonly SIRTBroadcaster broadcaster;
- private readonly ILogger logger;
-
- public SIRTBroadcasterModel(String portName, Int32 timeout)
- {
- this.logger = Appsettings.CreateNLogger(nameof(SIRTBroadcaster));
- this.broadcaster = new SIRTBroadcaster(new SerialPortSettings
- {
- BaudRate = SerialPortBaudRate.X115200,
- DataBits = SerialPortDataBits.X8,
- Parity = SerialPortParity.None,
- PortName = portName,
- StopBits = SerialPortStopBits.One,
- RWTimeout = timeout
- });
- this.broadcaster.Logging += text => this.logger.Trace(text);
- }
-
- public Int32 Frequency => this.broadcaster?.MHz ?? 0;
-
- public String Id => this.broadcaster?.SIRTID ?? String.Empty;
-
- public Boolean IsConnected => this.broadcaster?.IsOpen ?? false;
-
- public event Action DeviceAvailable
- {
- add => this.broadcaster.EndpointAvailable += value;
- remove => this.broadcaster.EndpointAvailable -= value;
- }
-
- //public event Action PamPoolChanged
- //{
- // add => this.broadcaster.PamPoolChanged += value;
- // remove => this.broadcaster.PamPoolChanged -= value;
- //}
-
- public event Action ProgrammingDone;
-
- public void Activate() => this.broadcaster.Open();
-
- public void Deactivate() => this.broadcaster.Close();
-
- internal void StartProgramming()
- {
- //var awaiter = new ManualResetEventSlim();
- //var request = new WritePamRequest
- //{
- // Address = 319020416,
- // DelPamSemi = true,
- // Payload = new Byte[]
- // {
- // 0x35, 0x13, 0x03, 0xDD, 0x7f,
- // 0x43, 0x03, 0x63, 0x93, 0x73, 0x22
- // }
- //};
- //var task = new WritePamTask(request);
-
- //task.Done += _ => awaiter.Set();
- //task.Cancelled += _ => awaiter.Set();
- //task.Logging += content =>
- //{
- // this.ProgrammingDone?.Invoke(task.Address, content);
- //};
-
- //this.broadcaster.Run(task);
-
- //awaiter.Wait();
- //awaiter.Reset();
-
- //request = new WritePamRequest
- //{
- // Address = task.Address,
- // DelPamSemi = true,
- // Payload = new Byte[]
- // {
- // 0x1F, 0x01, 0x08,
- // 0x43, 0x03, 0x63, 0x93, 0x73, 0x22
- // }
- //};
- //task = new WritePamTask(request);
-
- //var payload = new ChangeWakeUp()
- //{
- // Mode = WakeUpMode.StayAwake
- //}
- //.Append(new ChangeLATWindows
- //{
- // N = 0
- //})
- //.Append(new WMBusMode
- //{
- // WMBusEnabled = true,
- // InstallationModeEnabled = true,
- // EncryptionEnabled = true,
- //})
- //.Append(new ChangeTransmission
- //{
- // LatWindowIntervalCount = 0,
- // LatTXIntervalSeconds = 3
- //})
- //.Append(new ProvidePin
- //{
- // AuthLevel = AuthLevel.II
- //});
-
- //var request = new WritePamRequest
- //{
- // Address = 319020415,
- // WakeUpCmd = true,
- // DelPamSemi = true,
- // Payload = payload
- //};
-
- //var task = new WritePamTask(request);
- //task.Done += _ => awaiter.Set();
- //task.Cancelled += _ => awaiter.Set();
- //task.Logging += content =>
- //{
- // this.ProgrammingDone?.Invoke(task.RequestAddress, content);
- //};
-
- //this.broadcaster.Run(task);
-
- //awaiter.Wait();
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Models/WritePamTask.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Models/WritePamTask.cs
deleted file mode 100644
index e3ed461c..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Models/WritePamTask.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Models
-{
- using Common.Hardware.Interfaces.Ports.Sirt;
- using Common.Hardware.Interfaces.Ports.Sirt.Requests;
- using Common.Hardware.Interfaces.Ports.Sirt.Responses;
- using Common.Hardware.WaterMeter.eRegister;
- using Common.Utils.Extensions;
-
- using Newtonsoft.Json;
-
- using System;
- using System.Collections.Generic;
-
- public class WritePamTask : SIRTTask
- {
- public WritePamTask(UInt32 timeoutSeconds = 60) : base(timeoutSeconds)
- {
- }
-
- public event Action Logging;
-
- public SIRTRequest Request => this.request;
-
- public ACKN ACKN { get; private set; }
-
- public LAT LAT { get; private set; }
-
- public DEBUG DEBUG { get; private set; }
-
- public SEMI SEMI { get; private set; }
-
- public ICollection Bups { get; } = new List();
-
- protected override Boolean FromAirReceived(FromAirResponse response)
- {
- var payload = response.Payload;
- var length = response.Payload.Length;
-
- if (length == 13)
- {
- var bup = new LAT(payload);
-
- if (bup.AppCode == AppCode.LAT)
- {
- this.LAT = bup;
-
- if (this.request.Payload[0] == 0x35)
- {
- var oldAddress = this.Address;
- var newAddress = this.request.Payload.ToUInt32BigEndian(1);
-
- if (oldAddress != newAddress)
- {
- this.NotifyAddressChanged(oldAddress, newAddress);
- }
- }
- }
- else
- {
- this.Bups.Add(bup);
- }
- }
- else if (length == 52)
- {
- this.DEBUG = new DEBUG(payload);
- }
- else if (length == 91)
- {
- this.SEMI = new SEMI(payload, response.MHz);
- }
- else
- {
- // TODO:
- }
-
- this.Logging.Invoke(JsonConvert.SerializeObject(this, Formatting.Indented));
-
- return this.SEMI != null;
- }
-
- protected override Boolean AcknOrAnswerReceived(AcknOrAnswerResponse response)
- {
- this.ACKN = new ACKN(response);
-
- this.Logging.Invoke(JsonConvert.SerializeObject(this, Formatting.Indented));
-
- return base.AcknOrAnswerReceived(response);
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/AssemblyInfo.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Properties/AssemblyInfo.cs
deleted file mode 100644
index f459f9e5..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Windows;
-
-// 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.UI.SIRTBroadcaster")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Common.UI.SIRTBroadcaster")]
-[assembly: AssemblyCopyright("Copyright © 2024")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-//In order to begin building localizable applications, set
-//CultureYouAreCodingWith in your .csproj file
-//inside a . For example, if you are using US english
-//in your source files, set the to en-US. Then uncomment
-//the NeutralResourceLanguage attribute below. Update the "en-US" in
-//the line below to match the UICulture setting in the project file.
-
-//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
-
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
-
-
-// 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")]
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Resources.Designer.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Resources.Designer.cs
deleted file mode 100644
index 6e2083cb..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Resources.Designer.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Common.UI.SIRTBroadcaster.Properties
-{
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Resources()
- {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Common.UI.SIRTBroadcaster.Properties.Resources", typeof(Resources).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
- return resourceCulture;
- }
- set
- {
- resourceCulture = value;
- }
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Resources.resx b/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Resources.resx
deleted file mode 100644
index af7dbebb..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Resources.resx
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Settings.Designer.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Settings.Designer.cs
deleted file mode 100644
index 0869499e..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Settings.Designer.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Common.UI.SIRTBroadcaster.Properties
-{
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
- private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
- public static Settings Default
- {
- get
- {
- return defaultInstance;
- }
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Settings.settings b/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Settings.settings
deleted file mode 100644
index 033d7a5e..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Properties/Settings.settings
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/Appsettings.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/Appsettings.cs
deleted file mode 100644
index 4bbc6460..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/Appsettings.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Utilities
-{
- using NLog;
- using NLog.Config;
- using NLog.Targets;
-
- using System;
- using System.Configuration;
-
- public class Appsettings
- {
- private static Configuration Configuration => ConfigurationManager.OpenExeConfiguration(typeof(Appsettings).Assembly.Location);
-
- private static AppSettingsSection AppSettings => Configuration.AppSettings;
-
- private static String AppSettingsSectionName => AppSettings.SectionInformation.Name;
-
- public static readonly Appsettings Current = new Appsettings();
-
- public Appsettings() { }
-
- public String this[String key] => Value(key);
-
- internal static String Value(String settingKey)
- {
- ConfigurationManager.RefreshSection(AppSettingsSectionName);
-
- return AppSettings.Settings[settingKey].Value ?? String.Empty;
- }
-
- internal static ILogger CreateNLogger(string name)
- {
- LogManager.Configuration = new LoggingConfiguration();
- LogManager.ThrowConfigExceptions = true;
- LogManager.ThrowExceptions = true;
- LogManager.AutoShutdown = true;
-
- LogManager.Configuration.AddTarget(new FileTarget(name)
- {
- CreateDirs = true,
- KeepFileOpen = true,
- FileName = $"${{CurrentDir}}/{name}/{DateTime.Now:yyyy-MM-dd}.txt"
- });
-
- LogManager.Configuration.AddRule(LogLevel.Trace, LogLevel.Fatal, name);
- LogManager.LogFactory.ReconfigExistingLoggers(true);
- LogManager.ReconfigExistingLoggers(true);
-
- return LogManager.GetLogger(name);
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/BooleanToVisibilityConverter.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/BooleanToVisibilityConverter.cs
deleted file mode 100644
index 311ae7f4..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/BooleanToVisibilityConverter.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Utilities
-{
- using System;
- using System.Globalization;
- using System.Windows;
- using System.Windows.Data;
-
- public class BooleanToVisibilityConverter : IValueConverter
- {
- public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- if (value is Boolean _bool && _bool)
- {
- return Visibility.Visible;
- }
-
- return Visibility.Collapsed;
- }
-
- public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/CompilerServices.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/CompilerServices.cs
deleted file mode 100644
index 698b37d5..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/CompilerServices.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
- public class CallerMemberNameAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
- public class CallerFilePathAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
- public class CallerLineNumberAttribute : Attribute
- {
- }
-}
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToBackgroundConverter.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToBackgroundConverter.cs
deleted file mode 100644
index 8b7d246f..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToBackgroundConverter.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Utilities
-{
- using Common.UI.SIRTBroadcaster.Models;
-
- using System;
- using System.Globalization;
- using System.Windows.Data;
- using System.Windows.Media;
-
- public class ResultToBackgroundConverter : IValueConverter
- {
- public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- var color = Brushes.White;
-
- //if (value is Result result)
- //{
- // if (result == Result.Succes)
- // {
- // color = Brushes.LightGreen;
- // }
- // else if (result == Result.Fail)
- // {
- // color = Brushes.LightSalmon;
- // }
- // else if (result == Result.Warning)
- // {
- // color = Brushes.LightYellow;
- // }
- // else if (result == Result.Processing)
- // {
- // color = Brushes.AliceBlue;
- // }
- // else if (result == Result.NA )
- // {
- // color = Brushes.LightGray;
- // }
- //}
-
- return color;
- }
-
- public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToForegroundConverter.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToForegroundConverter.cs
deleted file mode 100644
index aaae87d1..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToForegroundConverter.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Utilities
-{
- using Common.UI.SIRTBroadcaster.Models;
-
- using System;
- using System.Globalization;
- using System.Windows.Data;
- using System.Windows.Media;
-
- public class ResultToForegroundConverter : IValueConverter
- {
- public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- var color = Brushes.White;
-
- if (value is Result result)
- {
- if (result == Result.Succes)
- {
- color = Brushes.Green;
- }
- else if (result == Result.Fail)
- {
- color = Brushes.Red;
- }
- else if (result == Result.Warning)
- {
- color = Brushes.Orange;
- }
- }
-
- return color;
- }
-
- public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToStringConverter.cs b/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToStringConverter.cs
deleted file mode 100644
index 29e9136d..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/Utilities/ResultToStringConverter.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.Utilities
-{
- using Common.UI.SIRTBroadcaster.Models;
-
- using System;
- using System.Globalization;
- using System.Windows.Data;
-
- public class ResultToStringConverter : IValueConverter
- {
- public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- var text = default(String);
-
- if (value is Result result)
- {
- if (result == Result.Succes)
- {
- text = "✓";
- }
- else if (result == Result.Fail)
- {
- text = "✘";
- }
- else if (result == Result.Warning)
- {
- text = "❗";
- }
- }
-
- return text;
- }
-
- public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitInspectionTaskVM.cs b/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitInspectionTaskVM.cs
deleted file mode 100644
index 18b67087..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitInspectionTaskVM.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.ViewModels
-{
- public class InitInspectionTaskVM
- {
- }
-}
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitInspectionVM.cs b/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitInspectionVM.cs
deleted file mode 100644
index 8bb4aae8..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitInspectionVM.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.ViewModels
-{
- using Common.Hardware.WaterMeter.eRegister;
- using Common.UI.SIRTBroadcaster.Models;
-
- using System;
- using System.Collections.ObjectModel;
-
- public class InitInspectionVM : VM
- {
- private readonly InitInspectionM model;
-
- public InitInspectionVM()
- {
- this.model = new InitInspectionM();
- this.Tasks = new ObservableCollection();
- }
-
- public event Action Shutdown;
-
- public ObservableCollection Tasks { get; }
-
- public void InitInspection(ProgrammingBatch programmingBatch)
- {
- this.model.InitProgramming(programmingBatch);
-
- foreach (var tasks in this.model.ProgrammingTasks())
- {
-
- }
- }
-
- internal void StartProgramming()
- {
- this.model.StartProgramming();
- this.Shutdown?.Invoke();
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitResultVM.cs b/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitResultVM.cs
deleted file mode 100644
index 844fee1b..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/InitResultVM.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.ViewModels
-{
- using Common.UI.SIRTBroadcaster.Models;
-
- using System;
-
- public class InitResultVM : VM
- {
- private Int32 serialNo;
- public Int32 SerialNo
- {
- get => this.serialNo;
- set => this.Set(() => this.serialNo = value);
- }
-
- private Int32 address;
- public Int32 Address
- {
- get => this.address;
- set => this.Set(() => this.address = value);
- }
-
- private Result wakeup = Result.Succes;
- public Result WakeUp
- {
- get => this.wakeup;
- set => this.Set(() => this.wakeup = value);
- }
-
- private Result txInterval = Result.Warning;
- public Result TxInterval
- {
- get => this.txInterval;
- set => this.Set(() => this.txInterval = value);
- }
-
- private Result latInterval = Result.Fail;
- public Result LatInterval
- {
- get => this.latInterval;
- set => this.Set(() => this.latInterval = value);
- }
-
- private Result mbus = Result.NA;
- public Result Mbus
- {
- get => this.mbus;
- set => this.Set(() => this.mbus = value);
- }
-
- private Result setup = Result.Processing;
- public Result Setup
- {
- get => this.setup;
- set => this.Set(() => this.setup = value);
- }
-
- private Result reading;
- public Result Reading
- {
- get => this.reading;
- set => this.Set(() => this.reading = value);
- }
-
- private Result led;
- public Result LED
- {
- get => this.led;
- set => this.Set(() => this.led = value);
- }
-
- private Boolean skipChecks;
- public Boolean SkipChecks
- {
- get => this.skipChecks;
- set => this.Set(() => this.skipChecks = value);
- }
-
- private Result batteryVoltage;
- public Result BatteryVoltage
- {
- get => this.batteryVoltage;
- set => this.Set(() => this.batteryVoltage = value);
- }
-
- private Result batteryRemaining;
- public Result BatteryRemaining
- {
- get => this.batteryRemaining;
- set => this.Set(() => this.batteryRemaining = value);
- }
-
- private Result fwVersion;
- public Result FWVersion
- {
- get => this.fwVersion;
- set => this.Set(() => this.fwVersion = value);
- }
-
- private Result rebootCounter;
- public Result RebootCounter
- {
- get => this.rebootCounter;
- set => this.Set(() => this.rebootCounter = value);
- }
-
- private Result meterType;
- public Result MeterType
- {
- get => this.meterType;
- set => this.Set(() => this.meterType = value);
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/SIRTBroadcasterViewModel.cs b/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/SIRTBroadcasterViewModel.cs
deleted file mode 100644
index 8197640f..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/SIRTBroadcasterViewModel.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.ViewModels
-{
- using Common.UI.SIRTBroadcaster.Models;
- using Common.UI.SIRTBroadcaster.Utilities;
-
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Threading.Tasks;
- using System.Windows.Input;
-
- public class SIRTBroadcasterViewModel : VM
- {
- private readonly SortedDictionary devices;
- private readonly SIRTBroadcasterModel model;
-
- public SIRTBroadcasterViewModel()
- {
- App.Started += App_Started;
- App.Exited += App_Exited;
-
- var portName = Appsettings.Value("SIRT.PortName");
- var _timeout = Appsettings.Value("SIRT.RWTimeout");
- var parsed = Int32.TryParse(_timeout, out var timeout);
-
- this.model = new SIRTBroadcasterModel(portName, parsed ? timeout : 3000);
- this.model.DeviceAvailable += this.Model_DeviceAvailable;
- // this.model.PamPoolChanged += this.BroadcasterModel_PamPoolChanged;
-
- this.devices = new SortedDictionary();
- this.StartProgramming = new Command(this.StartProgrammingHandler);
- }
-
- private String sirtIdentity;
- public String SIRTIdentity
- {
- get => this.sirtIdentity;
- set => this.Set(() => this.sirtIdentity = value);
- }
-
- private String programming;
- public String Programming
- {
- get => this.programming;
- set => this.Set(() => this.programming = value);
- }
-
- private Int32 availableAddressesCount;
- public Int32 AvailableDevicesCount
- {
- get => this.availableAddressesCount;
- set => this.Set(() => this.availableAddressesCount = value);
- }
-
- public ICommand StartProgramming { get; }
-
- public ObservableCollection PamPool { get; }
- = new ObservableCollection { 0, 0, 0, 0, 0 };
-
- public ObservableCollection AvailableDevices { get; }
- = new ObservableCollection();
-
- private void App_Exited() => this.model.Deactivate();
-
- private void App_Started() => Task.Factory.StartNew(() =>
- {
- this.model.Activate();
-
- this.SIRTIdentity = $"Pam Pool of SIRT: {this.model.Id} - {this.model.Frequency} MHz";
- });
-
- private void Model_DeviceAvailable(UInt32 address)
- => App.Invoke(() =>
- {
- this.devices[address] = true;
- this.RefreshAvailableDevices();
- });
-
- private void RefreshAvailableDevices()
- {
- this.AvailableDevices.Clear();
-
- foreach (var key in this.devices.Keys)
- {
- this.AvailableDevices.Add(key);
- }
-
- this.AvailableDevicesCount = this.AvailableDevices.Count;
- }
-
- private void StartProgrammingHandler()
- {
- void LogProgramming(UInt32 address, String log) => this.Programming += $"{Environment.NewLine}{address}: {log}";
-
- this.model.ProgrammingDone += LogProgramming;
-
- Task.Factory
- .StartNew(this.model.StartProgramming)
- .ContinueWith(_ => this.model.ProgrammingDone -= LogProgramming);
- }
-
- private void BroadcasterModel_PamPoolChanged(UInt32[] addressesInPamPool)
- {
- var length = addressesInPamPool.Length;
-
- for (var i = 0; i < length; i++)
- {
- App.Invoke(() => this.PamPool[i] = addressesInPamPool[i]);
- }
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/VM.cs b/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/VM.cs
deleted file mode 100644
index 53c15d53..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/ViewModels/VM.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-namespace Common.UI.SIRTBroadcaster.ViewModels
-{
- using System;
- using System.ComponentModel;
- using System.Runtime.CompilerServices;
- using System.Windows.Input;
-
- public abstract class VM : INotifyPropertyChanged, IDisposable
- {
- protected VM() => App.Exited += this.Dispose;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- public virtual void Dispose() => App.Exited -= this.Dispose;
-
- protected void Invoke(Action action) => App.Current.Dispatcher.Invoke(action);
-
- protected void NotifyPropertyChanged([CallerMemberName] string property = "")
- {
- this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
- }
-
- protected void Set(Action setExpression, [CallerMemberName] string property = "")
- {
- setExpression?.Invoke();
- this.NotifyPropertyChanged(property);
- }
-
- protected class Command : ICommand
- {
- private readonly Action executable;
-
- public Command(Action executable)
- {
- this.executable = executable;
- }
-
- public event EventHandler CanExecuteChanged
- {
- add => CommandManager.RequerySuggested += value;
- remove => CommandManager.RequerySuggested -= value;
- }
-
- public bool CanExecute(object _)
- {
- return this.executable != null;
- }
-
- public void Execute(object _)
- {
- this.executable?.Invoke();
- }
- }
-
- protected class Command : ICommand
- {
- private readonly Action executable;
-
- public Command(Action executable)
- {
- this.executable = executable;
- }
-
- public event EventHandler CanExecuteChanged
- {
- add => CommandManager.RequerySuggested += value;
- remove => CommandManager.RequerySuggested -= value;
- }
-
- public bool CanExecute(object _)
- {
- return this.executable != null;
- }
-
- public void Execute(object parameter)
- {
- this.executable?.Invoke(parameter is T t ? t : default(T));
- }
- }
- }
-}
diff --git a/Common/Ui/Common.UI.SIRTBroadcaster/packages.config b/Common/Ui/Common.UI.SIRTBroadcaster/packages.config
deleted file mode 100644
index ec30915e..00000000
--- a/Common/Ui/Common.UI.SIRTBroadcaster/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/Common/Ui/Common.UI.WPF/Infrastructure/Auftrag.cs b/Common/Ui/Common.UI.WPF/Infrastructure/Auftrag.cs
index 0e633ad0..9362b757 100644
--- a/Common/Ui/Common.UI.WPF/Infrastructure/Auftrag.cs
+++ b/Common/Ui/Common.UI.WPF/Infrastructure/Auftrag.cs
@@ -12,7 +12,7 @@
{
private static readonly ISQLConnection sqlConnection = SQLConnection.CreateSQLConnection(Appsettings.Current["PS.ConnectionString"]);
- internal static IEnumerable All_eRegister_Shared_ByRunno(Int32 scharedId)
+ internal static IEnumerable All_eRegister_Shared_ByRunno(Int32 scharedId)
=> sqlConnection
.CreateCommand($@"
SELECT P2000_Shared_Id
@@ -29,7 +29,7 @@
.SetParameter(nameof(scharedId), scharedId)
.ExecuteReader(ReadJusteRegisterParameterSet);
- internal static JusteRegisterParameterSet eRegister_Shared_ByRunno_Slotno(Int32 scharedId, Int32 slotno)
+ internal static ParameterSet eRegister_Shared_ByRunno_Slotno(Int32 scharedId, Int32 slotno)
=> sqlConnection
.CreateCommand($@"
SELECT P2000_Shared_Id
@@ -85,8 +85,8 @@
return succeeded;
}
- private static JusteRegisterParameterSet ReadJusteRegisterParameterSet(ISQLReader reader)
- => new JusteRegisterParameterSet
+ private static ParameterSet ReadJusteRegisterParameterSet(ISQLReader reader)
+ => new ParameterSet
{
SharedId = reader.GetValue(0),
Slotno = reader.GetValue(1),
diff --git a/Common/Ui/Common.UI.WPF/Models/eRegisterPruefungInitialisierungModel.cs b/Common/Ui/Common.UI.WPF/Models/eRegisterPruefungInitialisierungModel.cs
index 4588dc19..e3b4825b 100644
--- a/Common/Ui/Common.UI.WPF/Models/eRegisterPruefungInitialisierungModel.cs
+++ b/Common/Ui/Common.UI.WPF/Models/eRegisterPruefungInitialisierungModel.cs
@@ -12,12 +12,12 @@
public class eRegisterPruefungInitialisierungModel
{
private readonly IMainModel mainModel;
- private readonly JusteRegisterProgrammingBatch programmingBatch;
+ private readonly ProgrammingBatch programmingBatch;
public eRegisterPruefungInitialisierungModel(IMainModel mainModel)
{
this.mainModel = mainModel;
- this.programmingBatch = new JusteRegisterProgrammingBatch();
+ this.programmingBatch = new ProgrammingBatch();
}
public event Action OnProgress;
@@ -38,7 +38,7 @@
}
}
- private void ProgrammingBatch_OnProgress(Int32 slot, Int32 processno, String label, JusteRegisterTaskState state)
+ private void ProgrammingBatch_OnProgress(Int32 slot, Int32 processno, String label, Hardware.WaterMeter.eRegister.TaskState state)
=> this.OnProgress?.Invoke(new TaskModel
{
Column = slot,