diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs index c9223e9b..5a366cbe 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisConfigReader.cs @@ -103,6 +103,7 @@ var builds = sectionKVP.Value.Builds; var emeaBuilds = builds["emea"]; var naBuilds = builds["na"]; + InterfaceInfo.SupportedFwVersions = new List(); foreach (var build in emeaBuilds) { InterfaceInfo.SupportedFwVersions.Add(build.FW); @@ -111,12 +112,6 @@ { InterfaceInfo.SupportedFwVersions.Add(build.FW); } - //ConfigApplicationDefinitions.Add(new ApplicationDefinition - //{ - // AppId = appId, - // AppName = appName, - // AppVersion = appVersion - //}); InterfaceInfo.InterfaceVersion = GenesisMeter.BuildFwVersionStringFromDec(appVersion); continue; } diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs index 5752b88b..b5ddf531 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/GenesisMeter.cs @@ -191,7 +191,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore } /// - public List MeterAppListVersion { protected set; get; } = new List(); + public List MeterAppListVersion + { + protected set; get; + + } = new List(); /// public Int32? CoreRevision @@ -199,6 +203,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore protected set; get; } + /// + public InterfaceInfo InterfaceInfo + { + get; internal set; + } + /// public String StrCoreRevision { @@ -229,20 +239,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore protected set; get; } - /// - public String InterfaceVersion - { - protected set; - get; - } = "?"; - - /// - public List InterfaceMaxFwVersions - { - protected set; - get; - } - /// public Boolean InterfaceSupportsFwVersion { @@ -393,14 +389,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore get; set; } - /// - /// Interface information - /// - public InterfaceInfo InterfaceInfo - { - get; set; - } - /// /// Response received after request for record /// @@ -670,9 +658,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore //and application definitions var registerReader = new GenesisConfigurationReader(configFilePath); - InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion; - InterfaceInfo.SupportedFwVersions = new List(); + InterfaceInfo = new InterfaceInfo + { + SupportedFwVersions = new List() + }; InterfaceInfo.SupportedFwVersions.AddRange(registerReader.InterfaceInfo.SupportedFwVersions); + InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion; SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions); SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions); @@ -1743,7 +1734,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore /// the interface (configuration.json) version. /// /// - /// - Handle the interface compatibility FW version with short string like "1421". + /// - Handle the interface compatibility FW version with short string like "1421" and discrete FW versions. /// protected virtual void ReadMeterFirmwareAndAssignRegisters() { @@ -1765,14 +1756,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore // Get all existing applications from meter register dictionary foreach (var meterApp in ConfigApplications.OrderBy(o => o.AppId)) { - //// The "OPTICALINTERFACE" isn't a real application as it identifies exclusively the configuration.json - //if (meterApp.AppName.Equals("OPTICALINTERFACE")) - //{ - // // Build the interface id for information of compatibility from FW to configuration.json - // InterfaceVersion = BuildFwVersionStringFromDec(meterApp.AppVersion); - // continue; - //} - UInt32 readFwVersion = 0; UInt16 readFwCrc = 0; @@ -1903,7 +1886,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore Logger.Info($"Slot:{Slot} - Meter size: {MeterSize}"); Logger.Info($"Slot:{Slot} - Upgrade permission: {MetrologyUpgradePermission:X2}"); - Logger.Info($"Slot:{Slot} - Interface (configuration.json) version: {InterfaceVersion}"); + Logger.Info($"Slot:{Slot} - Interface (configuration.json) version: {InterfaceInfo.InterfaceVersion}"); if (InterfaceInfo.SupportedFwVersions.Any( strFwVersion => strFwVersion.Contains(strShortFwVersion))) { diff --git a/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs b/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs index 45525de3..310c6e4b 100644 --- a/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs +++ b/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs @@ -24,18 +24,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore { get; } - /// - /// This is the version of the interface "configuration.json". - /// - String InterfaceVersion - { - get; - } /// - /// This is the list of all supported firmware versions of the interface "configuration.json". + /// Interface information /// - List InterfaceMaxFwVersions + InterfaceInfo InterfaceInfo { get; } diff --git a/Common/Hardware/WaterMeter/Genesis/MockGenesis/MockGenesis.cs b/Common/Hardware/WaterMeter/Genesis/MockGenesis/MockGenesis.cs index 901e2294..2087dfb7 100644 --- a/Common/Hardware/WaterMeter/Genesis/MockGenesis/MockGenesis.cs +++ b/Common/Hardware/WaterMeter/Genesis/MockGenesis/MockGenesis.cs @@ -108,7 +108,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis base.PcbId = value; ClearPassword(); } - get => base.PcbId; } /// @@ -117,7 +116,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis public new String LutCrc { set => base.LutCrc = value; - get => base.LutCrc; } /// @@ -126,7 +124,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis public new String StrCoreRevision { set => base.StrCoreRevision = value; - get => base.StrCoreRevision; } /// @@ -144,7 +141,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis public new Int32? RadioFrequencyMhz { set => base.RadioFrequencyMhz = value; - get => base.RadioFrequencyMhz; } /// @@ -153,7 +149,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis public new UInt32? InstalledFwVersion { set => base.InstalledFwVersion = value; - get => base.InstalledFwVersion; } /// @@ -203,7 +198,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis /// /// Mock object can overwrite login status for test purposes /// - public new Boolean IsLoggedOn + private new Boolean IsLoggedOn { set => base.IsLoggedOn = value; get => base.IsLoggedOn; @@ -451,6 +446,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis /// /// - Check interface compatibility. /// + /// + /// - Handle the interface compatibility FW version with short string like "1421" and discrete FW versions. + /// protected override void ReadMeterFirmwareAndAssignRegisters() { // Avoid overwriting of list if this already exits @@ -474,27 +472,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis return; } - //UInt32 interfaceMaxEmeaVersion = 0; - //UInt32 interfaceMaxNaVersion = 0; - //var strInterfaceMaxEmeaVersion = ""; - //var strInterfaceMaxNaVersion = ""; - var strShortFwVersion = ""; //Get all existing applications from meter register dictionary foreach (var meterApp in ConfigApplications.OrderBy(o => o.AppId)) { - //if (meterApp.AppName.Equals("OPTICALINTERFACE")) - //{ - // // Build the interface id for information of compatibility from FW to configuration.json - // InterfaceVersion = BuildFwVersionStringFromDec(meterApp.AppVersion); - // // Build the max supported versions for EMEA and NA to check the supported FW - // strInterfaceMaxEmeaVersion = BuildFlexnetFwVersion(out interfaceMaxEmeaVersion, - // meterApp.InterfaceMaxEmeaVersion); - // strInterfaceMaxNaVersion = BuildFlexnetFwVersion(out interfaceMaxNaVersion, - // meterApp.InterfaceMaxNaVersion); - // continue; - //} - // Take all listed config apps even if not installed var app = new MeterApplications { @@ -565,28 +546,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis InterfaceSupportsFwVersion = false; Logger.Warn($"Slot:{Slot} - Interface does not support this FW version: {FwVersion}"); } - - //// Assign the max supported FW version of the interface depending on the region - //if (Region.Equals("EMEA")) - // InterfaceMaxFwVersion = strInterfaceMaxEmeaVersion; - //if (Region.Equals("NA")) - // InterfaceMaxFwVersion = strInterfaceMaxNaVersion; - - //// Check if the interface supports the FW - //if (InstalledFwVersion != null && - // ((Region.Equals("EMEA") && interfaceMaxEmeaVersion >= InstalledFwVersion) || - // (Region.Equals("NA") && interfaceMaxNaVersion >= InstalledFwVersion))) - //{ - // InterfaceSupportsFwVersion = true; - // Logger.Info($"Slot:{Slot} - Interface supports FW version: {FwVersion}"); - //} - //else - //{ - // InterfaceSupportsFwVersion = false; - // Logger.Warn($"Slot:{Slot} - Interface does not support FW version! Installed FW version: {FwVersion}, " + - // $"Interface supports max FW version: {InterfaceMaxFwVersion}"); - //} - } catch (Exception ex) { diff --git a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs index 4caa2fb6..07ad034c 100644 --- a/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs +++ b/Common/Production/ProductionUiCordonel/ProductionProcesses/GenericProcesses/ConnectCordonel.cs @@ -66,15 +66,13 @@ namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Gener if (!Meter.InterfaceSupportsFwVersion) { ErrorMsgDispatcher($"{Resources.StrErrorMsg}: " + - $"{Resources.StrMsgInterfaceVersion} {Meter.InterfaceVersion} - " + - // $"{Resources.StrMsgInterfaceSupportedMaxFwVersion} {Meter.InterfaceMaxFwVersion} - " + + $"{Resources.StrMsgInterfaceVersion} {Meter.InterfaceInfo.InterfaceVersion} - " + $"{Resources.StrMsgInstalledFwVersion} {Meter.FwVersion}"); return StatusReturn.Failed; } SuccessMsgDispatcher($"{Resources.StrSuccessMsg}: " + - $"{Resources.StrMsgInterfaceVersion} {Meter.InterfaceVersion} - " + - // $"{Resources.StrMsgInterfaceSupportedMaxFwVersion} {Meter.InterfaceMaxFwVersion} - " + + $"{Resources.StrMsgInterfaceVersion} {Meter.InterfaceInfo.InterfaceVersion} - " + $"{Resources.StrMsgInstalledFwVersion} {Meter.FwVersion}"); return StatusReturn.Okay; } diff --git a/Common/Production/ProductionUiCordonel/ProductionWindow.xaml.cs b/Common/Production/ProductionUiCordonel/ProductionWindow.xaml.cs index aeb4a0f3..d2a01868 100644 --- a/Common/Production/ProductionUiCordonel/ProductionWindow.xaml.cs +++ b/Common/Production/ProductionUiCordonel/ProductionWindow.xaml.cs @@ -849,7 +849,8 @@ namespace Xylem.Common.Production.ProductionUiCordonel genesisMeter.MeterLength + " mm" : "?"); UpdateContentControl(lblInterfaceVersionValue, - !string.IsNullOrEmpty(genesisMeter.InterfaceVersion) ? genesisMeter.InterfaceVersion : "?"); + !string.IsNullOrEmpty(genesisMeter.InterfaceInfo.InterfaceVersion) ? + genesisMeter.InterfaceInfo.InterfaceVersion : "?"); UpdateContentControl(lblLutValue, !string.IsNullOrEmpty(genesisMeter.LutCrc) ? genesisMeter.LutCrc : "?"); diff --git a/Common/Ui/GenesisToolBox/FrmFwUpdate.cs b/Common/Ui/GenesisToolBox/FrmFwUpdate.cs index 449d09d4..86d0259c 100644 --- a/Common/Ui/GenesisToolBox/FrmFwUpdate.cs +++ b/Common/Ui/GenesisToolBox/FrmFwUpdate.cs @@ -676,7 +676,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { lblConnectPcb.Text = StrPartPcbConnected + _currentGenesis.PcbId; lblCoreRevision.Text = StrCoreRevision + _currentGenesis.StrCoreRevision; - lblConfigVersion.Text = @"Configuration Version: " + _currentGenesis.InterfaceVersion; + lblConfigVersion.Text = @"Configuration Version: " + _currentGenesis.InterfaceInfo.InterfaceVersion; lblConfigVersion.ForeColor = _currentGenesis.InterfaceSupportsFwVersion ? Color.Green: Color.Red; @@ -688,7 +688,8 @@ namespace Xylem.Common.Ui.GenesisToolBox if (!_currentGenesis.InterfaceSupportsFwVersion) { var text = "CONFIGURATION OUTDATED!\n\n" + - $"The loaded \"configuration.json\" version: {_currentGenesis.InterfaceVersion}\n" + + "The loaded \"configuration.json\" " + + $"version: {_currentGenesis.InterfaceInfo.InterfaceVersion}\n" + $"does NOT support the Cordonel FW version: {_currentGenesis.FwVersion}!"; MessageBoxShow(text, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); } diff --git a/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs b/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs index c4f3b426..004c2f22 100644 --- a/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs +++ b/Common/Ui/GenesisToolBox/FrmLowLevelTools.cs @@ -346,7 +346,7 @@ namespace Xylem.Common.Ui.GenesisToolBox { sb.AppendLine(@"Unable to build password file [E0]!"); } - else + else if (_currentGenesis.Region.Equals("NA")) { var url = ServiceUrls.GetExportDataServiceUrl(); var retStr = LocalWebRequest.GetRequestWithError(url + _currentGenesis.PcbId, out var errorCode, 30000); @@ -425,15 +425,16 @@ namespace Xylem.Common.Ui.GenesisToolBox } LogText(""); - LogText("'Configuration.json' version: " + _currentGenesis.InterfaceVersion); - lblConfigVersion.Text = @"Interface Version: " + _currentGenesis.InterfaceVersion; + LogText("'Configuration.json' version: " + _currentGenesis.InterfaceInfo.InterfaceVersion); + lblConfigVersion.Text = @"Interface Version: " + _currentGenesis.InterfaceInfo.InterfaceVersion; lblConfigVersion.ForeColor = _currentGenesis.InterfaceSupportsFwVersion ? Color.Green : Color.Red; if (!_currentGenesis.InterfaceSupportsFwVersion) { var text = "INTERFACE VERSION OUTDATED!\n" + - $"The loaded \'configuration.json\' version: {_currentGenesis.InterfaceVersion}\n" + + "The loaded \'configuration.json\' " + + $"version: {_currentGenesis.InterfaceInfo.InterfaceVersion}\n" + $"does NOT support the Cordonel FW version: {_currentGenesis.FwVersion}!"; MessageBox.Show(text, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); LogText(text); diff --git a/Common/Ui/GenesisToolBox/FrmLutUpdate.cs b/Common/Ui/GenesisToolBox/FrmLutUpdate.cs index 83210aef..becc5746 100644 --- a/Common/Ui/GenesisToolBox/FrmLutUpdate.cs +++ b/Common/Ui/GenesisToolBox/FrmLutUpdate.cs @@ -254,15 +254,16 @@ namespace Xylem.Common.Ui.GenesisToolBox tbxRadio.Text = $@"{_currentGenesis.RadioFrequencyMhz}"; LogText($"Meter Radio Frequency [MHz]: {_currentGenesis.RadioFrequencyMhz}"); } - LogText("Configuration.json version: " + _currentGenesis.InterfaceVersion); - lblConfigVersion.Text = @"Configuration Version: " + _currentGenesis.InterfaceVersion; + LogText("Configuration.json version: " + _currentGenesis.InterfaceInfo.InterfaceVersion); + lblConfigVersion.Text = @"Configuration Version: " + _currentGenesis.InterfaceInfo.InterfaceVersion; lblConfigVersion.ForeColor = _currentGenesis.InterfaceSupportsFwVersion ? Color.Green: Color.Red; if (!_currentGenesis.InterfaceSupportsFwVersion) { var text = "CONFIGURATION OUTDATED!\n" + - $"The loaded \"configuration.json\" version: {_currentGenesis.InterfaceVersion}\n" + + "The loaded \"configuration.json\" " + + $"version: {_currentGenesis.InterfaceInfo.InterfaceVersion}\n" + $"does NOT support the Cordonel FW version: {_currentGenesis.FwVersion}!"; MessageBox.Show(text, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); LogText(text); diff --git a/Common/Ui/GenesisToolBox/frmRegisterStore.cs b/Common/Ui/GenesisToolBox/frmRegisterStore.cs index 62bf1c56..4ae5b02e 100644 --- a/Common/Ui/GenesisToolBox/frmRegisterStore.cs +++ b/Common/Ui/GenesisToolBox/frmRegisterStore.cs @@ -185,15 +185,17 @@ namespace Xylem.Common.Ui.GenesisToolBox if (loggedinMeters == _meterBatch.ListOfMeters.Count) { lblState.ForeColor = Color.Green; - lblState.Text = $"Connected to PCB {_currentPcbId}"; - lblConfigVersion.Text = @"Configuration Version: " + _currentGenesis.InterfaceVersion; + lblState.Text = $@"Connected to PCB {_currentPcbId}"; + lblConfigVersion.Text = @"Configuration Version: " + + _currentGenesis.InterfaceInfo.InterfaceVersion; lblConfigVersion.ForeColor = _currentGenesis.InterfaceSupportsFwVersion ? Color.Green: Color.Red; if (!_currentGenesis.InterfaceSupportsFwVersion) { var text = "CONFIGURATION OUTDATED!\n\n" + - $"The loaded \"configuration.json\" version: {_currentGenesis.InterfaceVersion}\n" + + "The loaded \"configuration.json\" " + + $"version: {_currentGenesis.InterfaceInfo.InterfaceVersion}\n" + $"does NOT support the Cordonel FW version: {_currentGenesis.FwVersion}!"; MessageBox.Show(text, @"FAILED", MessageBoxButtons.OK, MessageBoxIcon.Error); }