GenesisMeter: - app versions as decimal version, - FLEXNETSERIAL as hexadecimal
This commit is contained in:
@@ -155,7 +155,7 @@
|
||||
</site>
|
||||
<site name="MeterProcessState" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\SZLATEV\source\repos\laa_production\Common\Service\MeterProcessState" />
|
||||
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\LAA_PRODUCTION\Common\Service\MeterProcessState" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:56011:localhost" />
|
||||
|
||||
@@ -1225,7 +1225,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Building the FW Version string out of 2 bytes of data.
|
||||
/// Building the FW Version string out of 2 bytes of data and a decimal version.
|
||||
/// </summary>
|
||||
/// <param name="fwVersion">firmware version as hex</param>
|
||||
/// <param name="msb">most significant byte</param>
|
||||
@@ -1233,14 +1233,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
/// <returns>converted "msb.lsb" as string e.g. "2.34" or "2.0C" </returns>
|
||||
public static String BuildFwVersion(out UInt32 fwVersion, Byte msb, Byte lsb)
|
||||
{
|
||||
fwVersion = (UInt32)((msb << 8) + lsb);
|
||||
fwVersion = (UInt32)(((msb & 0xF0) >> 4) * 10 +
|
||||
(msb & 0x0F)) * 100;
|
||||
fwVersion += (UInt32)(((lsb & 0xF0) >> 4) * 10 + (lsb & 0x0F));
|
||||
//skip leading 0
|
||||
var msbPartString = (msb & 0xF0) > 0 ? $"{(msb & 0xF0) >> 4:X0}." : "";
|
||||
return msbPartString + $"{msb & 0x0F:X0}" + "." + $"{(lsb & 0xF0) >> 4:X1}" + $"{lsb & 0x0F:X1}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Building the FW Version string out of UInt32 as hexadecimal input.
|
||||
/// Building the FW Version string out of UInt32 as hexadecimal input like 0x1107 (meaning 1.1.07).
|
||||
/// </summary>
|
||||
/// <param name="fwVersion">firmware version as hex</param>
|
||||
/// <returns>converted "to "2.34" or "2.0C" </returns>
|
||||
@@ -1258,9 +1260,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
/// <returns>converted to "2.34" or "2.01" </returns>
|
||||
public static String BuildFwVersionStringFromDec(Int32? fwVersion)
|
||||
{
|
||||
if (fwVersion == 0)
|
||||
return "0.00";
|
||||
return $"{fwVersion / 100}.{fwVersion % 100:D2}";
|
||||
return fwVersion == null ? "0.00" : $"{fwVersion / 100}.{fwVersion % 100:D2}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1269,9 +1269,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
public List<MeterApplications> MeterAppListVersion = new List<MeterApplications>();
|
||||
|
||||
/// <summary>
|
||||
/// Core revision of boot code as hex number.
|
||||
/// Core revision of boot code.
|
||||
/// </summary>
|
||||
public UInt32 CoreRevision;
|
||||
//public String CoreRevision;
|
||||
public Int32? CoreRevision;
|
||||
|
||||
/// <summary>
|
||||
/// Core revision of boot code as string.
|
||||
@@ -1576,7 +1577,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
|
||||
//read core revision
|
||||
var coreRegisterRead = RegisterConverter.ByteArrayToValue<String>(ReadRegister(Register.System.CoreRevision, 16));
|
||||
CoreRevision = 0;
|
||||
CoreRevision = null;
|
||||
StrCoreRevision = "";
|
||||
|
||||
if (!string.IsNullOrEmpty(coreRegisterRead))
|
||||
@@ -1585,9 +1586,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
// remove Cordonel sub-string and the blanks
|
||||
var coreRevisionSubString = $"{coreRevisionStrings[0].ToLower().Replace("cordonel ", "")}";
|
||||
var strResult = Regex.Replace(coreRevisionSubString, "[^0-9,A-F,a-f]", "");
|
||||
if (UInt32.TryParse(strResult, NumberStyles.HexNumber, new CultureInfo("en"), out CoreRevision))
|
||||
if (Int32.TryParse(strResult, out var coreRevision))
|
||||
{
|
||||
StrCoreRevision = BuildFwVersionStringFromHex(CoreRevision);
|
||||
CoreRevision = coreRevision;
|
||||
StrCoreRevision = BuildFwVersionStringFromDec(CoreRevision);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1672,6 +1674,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user