GenesisMeter: - support configuration check for 'B' labeled FW

This commit is contained in:
Thomas Wiedebusch
2025-09-30 12:06:43 +02:00
parent cdffeb10a7
commit f2d8f0f0cc
@@ -1,5 +1,6 @@
using Logic.ProductionToProductMapper.Cordonel;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -14,7 +15,6 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Timers;
using NLog;
using Xylem.Common.CommonCore.Configuration;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.CommonCore.ThreadWatcher;
@@ -49,6 +49,7 @@ using Xylem.Common.Metrology.Measurements;
using Xylem.Common.Metrology.Measurements.Consts;
using Xylem.Common.Utils.Logging;
using Access = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Access;
using Register = Xylem.Common.Hardware.WaterMeter.Genesis.Registers.Register;
using Timer = System.Timers.Timer;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
@@ -1384,9 +1385,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2023-Mar-08" author="Thomas Wiedebusch">
/// - Removed the optional leading "B" or "R" on strVersion input to create the fwVersion.
/// </remarks>
/// <remarks date="2025-Sep-29" author="Thomas Wiedebusch">
/// - Masked out the marker for "B" in msb input to create the fwVersion.
/// </remarks>
public static String BuildFlexnetFwVersion(out UInt32 fwVersion, String strVersion, Byte? msb = null,
Byte? lsb = null)
{
@@ -1406,8 +1404,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
minor = (Int32)(msb & 0x0F);
builtMajor = (Int32)((lsb & 0xF0) >> 4);
builtMinor = (Int32)(lsb & 0x0F);
// mask out the "B" marker 0111 1111
fwVersion = (UInt32)(((msb & 0x7F) << 8) + lsb);
fwVersion = (UInt32)(((msb & 0xFF) << 8) + lsb);
}
else if (!string.IsNullOrEmpty(strVersion))
{
@@ -1720,6 +1717,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - Mask out the 'B' marker (0x8000) as 'configuration.json' states only the 'R' version.
/// </remarks>
protected virtual void ReadMeterFirmwareAndAssignRegisters()
{
// Avoid overwriting of list if this already exits
@@ -1749,11 +1749,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
InterfaceVersion = BuildFwVersionStringFromDec(meterApp.AppVersion);
// Build the max supported versions for EMEA and NA to check the supported FW
if (Region.Equals("EMEA"))
InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxEmeaVersion,
{
InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxEmeaVersion,
meterApp.InterfaceMaxEmeaVersion);
}
if (Region.Equals("NA"))
InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxNaVersion,
{
InterfaceMaxFwVersion = BuildFlexnetFwVersion(out interfaceMaxNaVersion,
meterApp.InterfaceMaxNaVersion);
}
continue;
}
@@ -1778,7 +1782,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
FwVersion = BuildFlexnetFwVersion(out readFwVersion, null, readFwVersionBytes[1],
readFwVersionBytes[0]);
versionString = FwVersion;
InstalledFwVersion = readFwVersion;
// Mask out the 'B' marker (0x8000) as 'configuration.json' states only the 'R' version
InstalledFwVersion = readFwVersion & 0x7FFF;
}
else
{