GenesisMeter: - check of interface compatibility

This commit is contained in:
Thomas Wiedebusch 2025-09-30 16:22:04 +02:00
parent c99dd00849
commit 53002737fa
10 changed files with 46 additions and 112 deletions

View File

@ -103,6 +103,7 @@
var builds = sectionKVP.Value.Builds;
var emeaBuilds = builds["emea"];
var naBuilds = builds["na"];
InterfaceInfo.SupportedFwVersions = new List<String>();
foreach (var build in emeaBuilds)
{
InterfaceInfo.SupportedFwVersions.Add(build.FW);
@ -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;
}

View File

@ -191,7 +191,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public List<MeterApplications> MeterAppListVersion { protected set; get; } = new List<MeterApplications>();
public List<MeterApplications> MeterAppListVersion
{
protected set; get;
} = new List<MeterApplications>();
/// <inheritdoc />
public Int32? CoreRevision
@ -199,6 +203,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
protected set; get;
}
/// <inheritdoc />
public InterfaceInfo InterfaceInfo
{
get; internal set;
}
/// <inheritdoc />
public String StrCoreRevision
{
@ -229,20 +239,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
protected set; get;
}
/// <inheritdoc />
public String InterfaceVersion
{
protected set;
get;
} = "?";
/// <inheritdoc />
public List<String> InterfaceMaxFwVersions
{
protected set;
get;
}
/// <inheritdoc />
public Boolean InterfaceSupportsFwVersion
{
@ -393,14 +389,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
get; set;
}
/// <summary>
/// Interface information
/// </summary>
public InterfaceInfo InterfaceInfo
{
get; set;
}
/// <summary>
/// Response received after request for record
/// </summary>
@ -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<String>();
InterfaceInfo = new InterfaceInfo
{
SupportedFwVersions = new List<String>()
};
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.
/// </remarks>
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - 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.
/// </remarks>
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)))
{

View File

@ -24,18 +24,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
get;
}
/// <summary>
/// This is the version of the interface "configuration.json".
/// </summary>
String InterfaceVersion
{
get;
}
/// <summary>
/// This is the list of all supported firmware versions of the interface "configuration.json".
/// Interface information
/// </summary>
List<String> InterfaceMaxFwVersions
InterfaceInfo InterfaceInfo
{
get;
}

View File

@ -108,7 +108,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis
base.PcbId = value;
ClearPassword();
}
get => base.PcbId;
}
/// <summary>
@ -117,7 +116,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis
public new String LutCrc
{
set => base.LutCrc = value;
get => base.LutCrc;
}
/// <summary>
@ -126,7 +124,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis
public new String StrCoreRevision
{
set => base.StrCoreRevision = value;
get => base.StrCoreRevision;
}
/// <summary>
@ -144,7 +141,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis
public new Int32? RadioFrequencyMhz
{
set => base.RadioFrequencyMhz = value;
get => base.RadioFrequencyMhz;
}
/// <summary>
@ -153,7 +149,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis
public new UInt32? InstalledFwVersion
{
set => base.InstalledFwVersion = value;
get => base.InstalledFwVersion;
}
/// <summary>
@ -203,7 +198,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.MockGenesis
/// <summary>
/// Mock object can overwrite login status for test purposes
/// </summary>
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
/// <remarks date="2025-Aug-07" author="Thomas Wiedebusch">
/// - Check interface compatibility.
/// </remarks>
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - Handle the interface compatibility FW version with short string like "1421" and discrete FW versions.
/// </remarks>
protected 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)
{

View File

@ -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;
}

View File

@ -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 : "?");

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}