diff --git a/Common/.vs/Common/config/applicationhost.config b/Common/.vs/Common/config/applicationhost.config index 8f2db308..143ad9e1 100644 --- a/Common/.vs/Common/config/applicationhost.config +++ b/Common/.vs/Common/config/applicationhost.config @@ -171,7 +171,7 @@ - + diff --git a/Common/Common.Services.LaserImport/App.config b/Common/Common.Services.LaserImport/App.config new file mode 100644 index 00000000..76af1c8f --- /dev/null +++ b/Common/Common.Services.LaserImport/App.config @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Common/Common.Services.LaserImport/Common.Services.LaserImport.csproj b/Common/Common.Services.LaserImport/Common.Services.LaserImport.csproj new file mode 100644 index 00000000..de15ea70 --- /dev/null +++ b/Common/Common.Services.LaserImport/Common.Services.LaserImport.csproj @@ -0,0 +1,54 @@ + + + + + Debug + AnyCPU + {6746517C-BE89-4637-A283-0A932A50497A} + Exe + Common.Services.LaserImport + Common.Services.LaserImport + v4.0 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Common/Common.Services.LaserImport/Program.cs b/Common/Common.Services.LaserImport/Program.cs new file mode 100644 index 00000000..fbbceb5f --- /dev/null +++ b/Common/Common.Services.LaserImport/Program.cs @@ -0,0 +1,78 @@ +namespace Common.Services.LaserImport +{ + using System; + using System.Configuration; + using System.IO; + using System.Threading; + + class Program + { + static readonly KeyValueConfigurationCollection appsettings + = ConfigurationManager + .OpenExeConfiguration(typeof(Program).Assembly.Location) + .AppSettings + .Settings; + static readonly string sharedFolder = appsettings["SharedFolder"].Value; + static readonly string localFolder = appsettings["LocalFolder"].Value; + static readonly FileSystemWatcher serverWatcher = new FileSystemWatcher(sharedFolder); + static readonly FileSystemWatcher clientWhatcher = new FileSystemWatcher(localFolder); + + static void Main() + { + serverWatcher.Created += ServerWatcher_FileCreated; + serverWatcher.NotifyFilter = NotifyFilters.FileName; + serverWatcher.EnableRaisingEvents = true; + + clientWhatcher.Deleted += CleintWatcher_FileDeleted; + clientWhatcher.NotifyFilter = NotifyFilters.FileName; + clientWhatcher.EnableRaisingEvents = true; + + Console.ReadKey(); + } + + private static void CleintWatcher_FileDeleted(object sender, FileSystemEventArgs args) + { + var fileFile = args.FullPath; + + Console.WriteLine($"{fileFile} - deleted"); + + var filePath = Path.Combine(sharedFolder, args.Name); + + if (File.Exists(filePath)) + { + File.Delete(filePath); + Console.WriteLine($"{filePath} - deleted"); + } + } + + private static void ServerWatcher_FileCreated(object sender, FileSystemEventArgs args) + { + var sourceFilePath = args.FullPath; + + Console.WriteLine($"{sourceFilePath} - created"); + + if (File.Exists(sourceFilePath)) + { + var destinationFilePath = Path.Combine(localFolder, args.Name); + + while (true) + { + Thread.Sleep(100); + + try + { + File.Copy(sourceFilePath, destinationFilePath, true); + + break; + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + + Console.WriteLine($"{sourceFilePath} copied to {destinationFilePath}"); + } + } + } +} diff --git a/Common/Common.Services.LaserImport/Properties/AssemblyInfo.cs b/Common/Common.Services.LaserImport/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..9caeb8af --- /dev/null +++ b/Common/Common.Services.LaserImport/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Common.Services.LaserImport")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Common.Services.LaserImport")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("6746517c-be89-4637-a283-0a932a50497a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Common/Common.sln b/Common/Common.sln index 624b454b..c3ba97fe 100644 --- a/Common/Common.sln +++ b/Common/Common.sln @@ -374,6 +374,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FM2014Config", "Hardware\Wa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FM2014Core", "Hardware\WaterMeter\MechanicalMeter\FM2014\FM2014Core\FM2014Core.csproj", "{0B205BE7-90CD-4C3A-8EBD-1E414E39528A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Services.LaserImport", "Common.Services.LaserImport\Common.Services.LaserImport.csproj", "{6746517C-BE89-4637-A283-0A932A50497A}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution Utils\DateTimeServerShared\DateTimeServerShared.projitems*{4806d89a-fbfb-41bc-aaa7-2242444bf55a}*SharedItemsImports = 4 @@ -6508,6 +6510,78 @@ Global {0B205BE7-90CD-4C3A-8EBD-1E414E39528A}.XP32bit|x64.Build.0 = XP32bit|x64 {0B205BE7-90CD-4C3A-8EBD-1E414E39528A}.XP32bit|x86.ActiveCfg = XP32bit|x86 {0B205BE7-90CD-4C3A-8EBD-1E414E39528A}.XP32bit|x86.Build.0 = XP32bit|x86 + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}._MANUAL_CONTROL|x86.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.COM|x86.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|x64.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|x64.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|x86.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Debug|x86.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.GenesisDisplayTool_V01|x86.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.PerformTest|x86.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.Release|x86.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.ReleaseTest|x86.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|Any CPU.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|x64.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|x64.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|x86.ActiveCfg = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.VPN_Debug|x86.Build.0 = Debug|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|Any CPU.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|Any CPU.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|Mixed Platforms.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|Mixed Platforms.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|x64.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|x64.Build.0 = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|x86.ActiveCfg = Release|Any CPU + {6746517C-BE89-4637-A283-0A932A50497A}.XP32bit|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -6661,6 +6735,7 @@ Global {5DFED68B-2113-4E5A-98ED-9DC07D3D39C8} = {AABD04D6-E911-4B1A-9D0B-9D0DD7E4DDC5} {3862D89C-E32D-4182-BB58-38777D43EDD9} = {5DFED68B-2113-4E5A-98ED-9DC07D3D39C8} {0B205BE7-90CD-4C3A-8EBD-1E414E39528A} = {5DFED68B-2113-4E5A-98ED-9DC07D3D39C8} + {6746517C-BE89-4637-A283-0A932A50497A} = {696A94BE-7237-4AE2-9E36-6059DE519971} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4BCB7B69-696C-436A-86F7-C91EA5588164} diff --git a/Common/CommonConsole/Program.cs b/Common/CommonConsole/Program.cs index 9786f4ec..2171b8e7 100644 --- a/Common/CommonConsole/Program.cs +++ b/Common/CommonConsole/Program.cs @@ -8,31 +8,31 @@ { static void Main() { - SIRTLogger.Message += Console.WriteLine; - var broadcaster = new SIRTBroadcaster("COM6"); - broadcaster.Open(); + //SIRTLogger.Message += Console.WriteLine; + //var broadcaster = new SIRTBroadcaster("COM6"); + //broadcaster.Open(); - if (broadcaster.IsOpen) - { - var task = new WritePamTask - { - Frequency = 868, - WakeUpCmd = true, - WakeUpModul = true, - RequestAddress = 4291377829, - IsEncrypted = true, - EncryptionKey = "E6C88800DEB868C0D6A84880CE982840".GetEncryptionKey() - }; + //if (broadcaster.IsOpen) + //{ + // var task = new WritePamTask + // { + // Frequency = 868, + // WakeUpCmd = true, + // WakeUpModul = true, + // RequestAddress = 4291377829, + // IsEncrypted = true, + // EncryptionKey = "E6C88800DEB868C0D6A84880CE982840".GetEncryptionKey() + // }; - while (task.State != SIRTTaskState.Completed) - { - broadcaster.Start(task); - task.Wait(); - } - } + // while (task.State != SIRTTaskState.Completed) + // { + // broadcaster.Start(task); + // task.Wait(); + // } + //} - Console.ReadKey(); - broadcaster.Close(); + //Console.ReadKey(); + //broadcaster.Close(); } static void Main2435() diff --git a/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj b/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj index 997b6d67..00d9d18a 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj +++ b/Common/Hardware/Common.Hardware.SIRT/Common.Hardware.SIRT.csproj @@ -64,7 +64,6 @@ - diff --git a/Common/Hardware/Common.Hardware.SIRT/SensusRF/SirtCom.cs b/Common/Hardware/Common.Hardware.SIRT/SensusRF/SirtCom.cs deleted file mode 100644 index 1261afd6..00000000 --- a/Common/Hardware/Common.Hardware.SIRT/SensusRF/SirtCom.cs +++ /dev/null @@ -1,89 +0,0 @@ -namespace Common.Hardware.SIRT.SensusRF -{ - using System; - using System.Collections.Generic; - using System.IO.Ports; - - internal class SirtCom - { - private readonly SerialPort serialPort; - - public SirtCom(string portName) - => this.serialPort = new SerialPort - { - BaudRate = 115200, - DataBits = 8, - Parity = Parity.None, - PortName = portName, - StopBits = StopBits.One - }; - - public bool Close() - { - try - { - this.serialPort.Close(); - - return this.serialPort.IsOpen; - } - catch - { - return false; - } - } - - public bool Open() - { - this.Close(); - - try - { - this.serialPort.Open(); - - return this.serialPort.IsOpen; - } - catch - { - return false; - } - } - - public IEnumerable ReadBytes() - { - var buffer = default(byte[]); - var length = default(int); - - while (true) - { - buffer = new byte[this.serialPort.ReadBufferSize]; - - try - { - length = this.serialPort.Read(buffer, 0, buffer.Length); - - Array.Resize(ref buffer, length); - } - catch - { - buffer = Array.Empty(); - } - - yield return buffer; - } - } - - public bool WriteBytes(params byte[] bytes) - { - try - { - this.serialPort.Write(bytes, 0, bytes.Length); - - return true; - } - catch - { - return false; - } - } - } -} diff --git a/Common/Hardware/Common.Hardware.SIRT/Tasks/WritePamTask.cs b/Common/Hardware/Common.Hardware.SIRT/Tasks/WritePamTask.cs index 709c9a71..4dd3deae 100644 --- a/Common/Hardware/Common.Hardware.SIRT/Tasks/WritePamTask.cs +++ b/Common/Hardware/Common.Hardware.SIRT/Tasks/WritePamTask.cs @@ -94,8 +94,6 @@ public override void Receive(SIRTMessage response) { - this.AnyTelegramReceived = true; - if (response.Command == SIRTConstants.ACKN_ANSW) { this.DecriptResponse(response); @@ -103,7 +101,7 @@ } else if (response.Command == SIRTConstants.FROM_AIR) { - var payload = response.Payload; + var payload = response?.Payload; if (this.UseEncryption(response)) { @@ -116,20 +114,24 @@ if (type == SIRTConstants.BUP) { + this.AnyTelegramReceived = true; this.BUPReceived?.Invoke(response); } else if (type == SIRTConstants.LAT) { this.latReceived = true; + this.AnyTelegramReceived = true; this.LATReceived?.Invoke(response); } else if (type == SIRTConstants.DEBUG) { this.debugReceived = true; + this.AnyTelegramReceived = true; this.DEBUGReceived?.Invoke(response); } else if (type == SIRTConstants.SEMI) { + this.AnyTelegramReceived = true; this.SEMIReceived?.Invoke(response); } else @@ -165,9 +167,9 @@ Frequency = this.Frequency, SirtId = this.SirtId, }; - - this.SetRunning(); + this.MessageSent?.Invoke(this.request); + this.SetRunning(); return message.GetBytes(); } @@ -219,11 +221,31 @@ } - protected virtual bool UseEncryption(SIRTMessage response) - => response != null - && response.Payload != null - && response.Payload.Length > 2 - && response.Payload.GetCrc() != 0; + protected virtual bool UseEncryption(SIRTMessage response) + { + if (response is null) + { + return false; + } + + var payload = response.Payload; + + if (payload is null) + { + return false; + } + + var payloadLength = payload.Length; + + if (payloadLength == 0) + { + return false; + } + + this.IsEncrypted = payload.GetCrc() != 0; + + return this.IsEncrypted; + } private byte[] EncryptRequest() { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs index 3f253645..b1f95bc2 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/Eregister.cs @@ -18,9 +18,9 @@ { private readonly ConcurrentQueue runningTasks; private readonly EregisterProgrammingParameters parameters; - private readonly SIRTHub sirtHub; private readonly EregisterHistory history; private readonly EregisterState state; + private readonly SIRTHub sirtHub; private string executionType; @@ -260,23 +260,22 @@ var frequency = this.parameters.Frequency; - if (this.executionType == nameof(this.LoadInspectionInitializationTasks)) + this.runningTasks.Enqueue(new EregisterTask(frequency) { - this.runningTasks.Enqueue(new EregisterTask(frequency) - { - Name = "WUP", - SlotNr = features.SlotNr, - PoNr = features.PoNr, - SerialNr = features.SerialNr, - RequestAddress = features.RequestAddress, - ResponseAddress = features.ResponseAddress, - EncryptionKey = features.EncryptionKey, - Data = new ChangeWakeUp(WakeUpMode.StayAwake) + Name = "WUP", + WakeUpCmd = true, + WakeUpModul = true, + SlotNr = features.SlotNr, + PoNr = features.PoNr, + SerialNr = features.SerialNr, + RequestAddress = features.RequestAddress, + ResponseAddress = features.ResponseAddress, + EncryptionKey = features.EncryptionKey, + Data = new ChangeWakeUp(WakeUpMode.StayAwake) .Append(new ChangeNumberOfLatWindows(this.parameters.LatWindowsInitialization)) .Append(new ChangeTransmissionInterval(this.parameters.TransmissionIntervalInitialization)) .Append(new ProvidePin(AuthLevel.II)), - }); - } + }); this.runningTasks.Enqueue(new EregisterCheckInitializationTask(this.parameters, frequency) { diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs index d463b3b6..15a495c2 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterCheckFinalizationTask.cs @@ -77,12 +77,12 @@ + $"eingebaute E-Register mit Funkadressen: {this.RequestAddress} | {this.ResponseAddress}, " + $"sind folgenden Fehler aufgetreten:{Environment.NewLine}{Environment.NewLine}{errors}"; - this.Name = "Final Check ✘"; - this.ErrorMessage = new ErrorMessage - { - Title = "Fehler bei der Prüfungsabschluss", - Text = errors - }; + //this.Name = "Final Check ✘"; + //this.ErrorMessage = new ErrorMessage + //{ + // Title = "Fehler bei der Prüfungsabschluss", + // Text = errors + //}; } } } diff --git a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs index 7b2eb766..63f30424 100644 --- a/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs +++ b/Common/Hardware/WaterMeter/eRegister/Common.Hardware.WaterMeter.eRegister/EregisterTask.cs @@ -78,6 +78,8 @@ this.DEBUGMessage = default(DEBUG); this.SEMIMessage = default(SEMI); this.AnyTelegramReceived = false; + this.debugReceived = false; + this.latReceived = false; if (this.FactoryState == FactoryState.Shipment) { @@ -178,17 +180,18 @@ } else if (this.SEMIMessage.PAMStatus != PAMStatus.OK) { - this.Label = "!OK"; - this.countFailures++; - if (this.countFailures >= 2) { + this.Label = "!OK"; this.SetCancelled(); } else { + this.Label = this.SEMIMessage.PAMStatus.ToString(); this.SetPending(); } + + this.countFailures++; } else { @@ -203,13 +206,32 @@ this.SetPending(); } - protected override Boolean UseEncryption(SIRTMessage response) + protected override bool UseEncryption(SIRTMessage response) { - var payloadLength = response.Payload.Length; - - return (payloadLength == 13 && base.UseEncryption(response)) - || payloadLength == 54 - || payloadLength == 93; + if (response is null) + { + return false; + } + + var payload = response.Payload; + + if (payload is null) + { + return false; + } + + var payloadLength = payload.Length; + + if (payloadLength == 0) + { + return false; + } + + this.IsEncrypted = (payloadLength == 13 && payload.GetCrc() != 0) // is bup encrypted + || response.Payload.Length == 54 // is debug encrypted + || response.Payload.Length == 93; // is semi encrypted + + return this.IsEncrypted; } } } \ No newline at end of file diff --git a/Common/Ui/Common.UI/App.config b/Common/Ui/Common.UI/App.config index c63681ec..a06537ef 100644 --- a/Common/Ui/Common.UI/App.config +++ b/Common/Ui/Common.UI/App.config @@ -8,7 +8,7 @@ - + diff --git a/Common/Ui/Common.UI/Models/AuftragDbContext.cs b/Common/Ui/Common.UI/Models/AuftragDbContext.cs index ae9e4e8d..fc80c860 100644 --- a/Common/Ui/Common.UI/Models/AuftragDbContext.cs +++ b/Common/Ui/Common.UI/Models/AuftragDbContext.cs @@ -101,8 +101,8 @@ SELECT CAST((SELECT DISTINCT * FROM VieweRegisterProgrammingParameters WHERE SharedId = @{nameof(sharedId)} - AND Completed = @{nameof(completed)} - AND SlotNr > 0 + -- AND Completed = @{nameof(completed)} + -- AND SlotNr > 0 FOR XML PATH('{nameof(EregisterProgrammingParameters)}') , ROOT('{nameof(EregisterProgrammingParametersList)}')) AS XML)")