CUST: - FwUpdateSw: - start implementation of power correction - 1
This commit is contained in:
@@ -23,87 +23,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
private const Int32 MeterPwrCorrFileCrcSize= 2;
|
||||
private const Int32 MeterPwrCorrFileDataIndex = MeterPwrCorrFileCrcIndex + MeterPwrCorrFileCrcSize;
|
||||
|
||||
private List<Byte>_meterBinData = new List<Byte>();
|
||||
private List<Byte>_meterBinData = new List<Byte>{0x5A};
|
||||
|
||||
/// <summary>
|
||||
/// Detected FW version before maintenance
|
||||
/// Power correction data.
|
||||
/// </summary>
|
||||
public UInt32 ActualFwVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date time UTC at time of maintenance
|
||||
/// </summary>
|
||||
public DateTime? ActualDateTimeUtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total used seconds before maintenance
|
||||
/// </summary>
|
||||
public UInt32 ActualTotalUsedSeconds_s { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total used charge of batteries before maintenance
|
||||
/// </summary>
|
||||
public UInt64 ActualTotalUsedCharge_uAs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Actual detected radio system state at maintenance
|
||||
/// </summary>
|
||||
public Byte? ActualRadioSystemState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Detection of pulse adapter installation
|
||||
/// </summary>
|
||||
public Boolean ActualPulseAdapterIsInstalled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pulse mode during maintenance
|
||||
/// </summary>
|
||||
public Byte ActualPulseMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pulse distribution during maintenance
|
||||
/// </summary>
|
||||
public Boolean ActualPulseEvenDistribution { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// FW version for the update
|
||||
/// </summary>
|
||||
public UInt32 RequiredFwVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Calculated pulse report length
|
||||
/// </summary>
|
||||
public UInt32 PulseReportLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total used seconds after EOL and before maintenance
|
||||
/// </summary>
|
||||
public UInt32 AfterProductionTotalUsedSeconds_s { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Overestimated total used charge before maintenance
|
||||
/// </summary>
|
||||
public UInt64 OverestimatedTotalUsedCharge_uAs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lowest threshold for total used charge calculated during maintenance
|
||||
/// </summary>
|
||||
public UInt64 MinimumTotalUsedCharge_uAs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Corrected total used charge during maintenance
|
||||
/// </summary>
|
||||
public UInt64 CorrectedTotalUsedCharge_uAs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of power correction file
|
||||
/// </summary>
|
||||
public UInt32 MeterPowerCorrectionFileSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CRC of power correction file
|
||||
/// </summary>
|
||||
public UInt32 MeterPowerCorrectionCRC { get; set; }
|
||||
public PowerCorrection PowerCorrectionData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ctor
|
||||
@@ -130,13 +55,40 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
||||
if (_currentGenesis == null || _meterFile == null)
|
||||
return false;
|
||||
|
||||
var loginReminder = _currentGenesis.IsLoggedOn;
|
||||
var retVal = _currentGenesis.ReLogin();
|
||||
if (retVal)
|
||||
{
|
||||
retVal = _meterFile.ReadMeterFile(StrMeterPowCorrFileName, out _meterBinData);
|
||||
}
|
||||
|
||||
if (!loginReminder) _currentGenesis.Logout();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the meter power correction file.
|
||||
/// </summary>
|
||||
/// <returns>true successfully written </returns>
|
||||
/// <remarks date="2024-May-08" author="Thomas Wiedebusch">
|
||||
/// - Initial.
|
||||
/// </remarks>
|
||||
public Boolean WritePowCorrMeterFile()
|
||||
{
|
||||
if (_currentGenesis == null || _meterFile == null)
|
||||
return false;
|
||||
|
||||
var loginReminder = _currentGenesis.IsLoggedOn;
|
||||
var retVal = _currentGenesis.ReLogin();
|
||||
if (retVal)
|
||||
{
|
||||
_meterFile.UnlockEraseWriteMeterFile(StrMeterPowCorrFileName);
|
||||
retVal = _meterFile.WriteMeterFile(StrMeterPowCorrFileName, _meterBinData.ToArray());
|
||||
}
|
||||
|
||||
if (!loginReminder) _currentGenesis.Logout();
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1426,6 +1426,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
// read the powCorrFile
|
||||
powCorrFile.ReadPowCorrMeterFile();
|
||||
LogPowCorrContent(powCorrFile);
|
||||
InfoProcessSuccess(null, Resources.StrPowerCorrectionNotNeeded);
|
||||
_processState = successExitState;
|
||||
return;
|
||||
}
|
||||
@@ -1462,9 +1463,10 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
// fill all infos to meter power correction file
|
||||
_fwUpdatePowerCorrection.ActualFwVersion = _currentGenesis.InstalledFwVersion;
|
||||
_fwUpdatePowerCorrection.RequiredFwVersion = (UInt32?)_cordonelFirmwarePackage.FwPackageInfo.Version;
|
||||
|
||||
powCorrFile.PowerCorrectionData = _fwUpdatePowerCorrection;
|
||||
|
||||
// store results to "1\\powcorr" in the meter
|
||||
powCorrFile.WritePowCorrMeterFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1096,6 +1096,42 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Power correction:.
|
||||
/// </summary>
|
||||
internal static string StrPowerCorrection {
|
||||
get {
|
||||
return ResourceManager.GetString("StrPowerCorrection", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Power correction failed!.
|
||||
/// </summary>
|
||||
internal static string StrPowerCorrectionFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("StrPowerCorrectionFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Power correction not needed..
|
||||
/// </summary>
|
||||
internal static string StrPowerCorrectionNotNeeded {
|
||||
get {
|
||||
return ResourceManager.GetString("StrPowerCorrectionNotNeeded", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Power correction succeeded..
|
||||
/// </summary>
|
||||
internal static string StrPowerCorrectionSucceeded {
|
||||
get {
|
||||
return ResourceManager.GetString("StrPowerCorrectionSucceeded", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Process state connect.
|
||||
/// </summary>
|
||||
|
||||
@@ -694,4 +694,16 @@
|
||||
<data name="StrFwUpdateFailed" xml:space="preserve">
|
||||
<value>ERROR: Firmware update failed!</value>
|
||||
</data>
|
||||
<data name="StrPowerCorrection" xml:space="preserve">
|
||||
<value>Power correction:</value>
|
||||
</data>
|
||||
<data name="StrPowerCorrectionFailed" xml:space="preserve">
|
||||
<value>ERROR: Power correction failed!</value>
|
||||
</data>
|
||||
<data name="StrPowerCorrectionNotNeeded" xml:space="preserve">
|
||||
<value>Power correction not needed.</value>
|
||||
</data>
|
||||
<data name="StrPowerCorrectionSucceeded" xml:space="preserve">
|
||||
<value>Power correction succeeded.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user