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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user