GenesisCore/Registers: - default registers added

This commit is contained in:
Thomas Wiedebusch
2023-03-17 09:45:50 +01:00
parent 62253933ac
commit e47e429ba0
4 changed files with 49 additions and 17 deletions
@@ -277,7 +277,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
} }
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "METROLOGYASST" && f.IsInstalled)) if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "METROLOGYASST" && f.IsInstalled))
{ {
_registersBeforeUpdate.Add(Register.Mertrologyasst.PulseMode, new Byte[] { 0 }); _registersBeforeUpdate.Add(Register.Metrologyasst.PulseMode, new Byte[] { 0 });
} }
//deny access if NA product, because this does not have the radio app installed //deny access if NA product, because this does not have the radio app installed
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "SENSUSRADIO" && f.IsInstalled)) if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "SENSUSRADIO" && f.IsInstalled))
@@ -178,7 +178,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
_registersBeforeUpdate.Add(Register.Genesisflow.SampleRate, new Byte[] { 1 }); _registersBeforeUpdate.Add(Register.Genesisflow.SampleRate, new Byte[] { 1 });
} }
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "METROLOGYASST" && f.IsInstalled)) if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "METROLOGYASST" && f.IsInstalled))
_registersBeforeUpdate.Add(Register.Mertrologyasst.PulseMode, new Byte[] { 0 }); _registersBeforeUpdate.Add(Register.Metrologyasst.PulseMode, new Byte[] { 0 });
//deny access if NA product, because this does not have the radio app installed //deny access if NA product, because this does not have the radio app installed
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "SENSUSRADIO" && f.IsInstalled)) if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "SENSUSRADIO" && f.IsInstalled))
_registersBeforeUpdate.Add(Register.Sensusradio.WakeupInterval, new Byte[] { 6 }); _registersBeforeUpdate.Add(Register.Sensusradio.WakeupInterval, new Byte[] { 6 });
@@ -79,7 +79,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
public static readonly String FirstHitLvlUp2 = "GENESISFLOW_FirstHitLvlUp2"; public static readonly String FirstHitLvlUp2 = "GENESISFLOW_FirstHitLvlUp2";
public static readonly String FirstHitLvlUp3 = "GENESISFLOW_FirstHitLvlUp3"; public static readonly String FirstHitLvlUp3 = "GENESISFLOW_FirstHitLvlUp3";
public static readonly String StartHit = "GENESISFLOW_StartHit"; public static readonly String StartHit = "GENESISFLOW_StartHit";
public static readonly String NumFirePulses = "GENESISFLOW_NumFirePulses"; public static readonly String NumFirePulses = "GENESISFLOW_NumFirePulses";
public static readonly String LookupFileCrc = "GENESISFLOW_LookupFileCrc"; public static readonly String LookupFileCrc = "GENESISFLOW_LookupFileCrc";
@@ -92,6 +91,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
public static readonly String BatteryDrainedLoad = "POWERMON_TotalUsedCharge"; public static readonly String BatteryDrainedLoad = "POWERMON_TotalUsedCharge";
public static readonly String BatteryInitialLoad = "POWERMON_BatteryMilliAHrRating"; public static readonly String BatteryInitialLoad = "POWERMON_BatteryMilliAHrRating";
public static readonly String BatteryExceededSeconds = "POWERMON_TotalUsedSeconds"; public static readonly String BatteryExceededSeconds = "POWERMON_TotalUsedSeconds";
public static readonly String StoreConfiguration = "POWERMON_StoreConfiguration";
} }
@@ -100,9 +100,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
public static readonly String FrequencyIndicator = "SENSUSRADIO_FrequencyIndicator"; public static readonly String FrequencyIndicator = "SENSUSRADIO_FrequencyIndicator";
public static readonly String WakeupInterval = "SENSUSRADIO_WakeupInterval"; public static readonly String WakeupInterval = "SENSUSRADIO_WakeupInterval";
public static readonly String SystemState = "SENSUSRADIO_SystemState"; public static readonly String SystemState = "SENSUSRADIO_SystemState";
public static readonly String StoreConfiguration = "SENSUSRADIO_StoreConfiguration";
} }
public static class Mertrologyasst public static class Metrologyasst
{ {
public static readonly String PulseMode = "METROLOGYASST_PulseMode"; public static readonly String PulseMode = "METROLOGYASST_PulseMode";
public static readonly String StoreConfiguration = "METROLOGYASST_StoreConfiguration"; public static readonly String StoreConfiguration = "METROLOGYASST_StoreConfiguration";
@@ -112,6 +113,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
{ {
public static readonly String StoreConfiguration = "IRDA_StoreConfiguration"; public static readonly String StoreConfiguration = "IRDA_StoreConfiguration";
} }
public static class Logger
{
public static readonly String StoreConfiguration = "LOGGER_StoreConfiguration";
}
@@ -119,6 +124,24 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
{ {
return new List<String>() return new List<String>()
{ {
System.CheckFwPresence,
System.CheckFwCrc,
System.TriggerFwUpgrade,
System.CoreRevision,
System.MonotonicSeconds,
System.MetrologyUpgradePermission,
Customer.AlarmStatus0,
Customer.AlarmStatus1,
Customer.TriggerAlarmCancel,
Customer.AlarmStatus2,
Customer.AlarmStatus3,
Customer.AlarmStatus4,
Customer.AlarmStatus5,
Customer.AlarmStatus6,
Customer.AlarmStatus7,
Customer.StoreConfiguration,
Configexchange.Privilege, Configexchange.Privilege,
Configexchange.Password, Configexchange.Password,
Configexchange.PcbSerialNumber, Configexchange.PcbSerialNumber,
@@ -131,13 +154,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
Configexchange.SetFilePointerOffset, Configexchange.SetFilePointerOffset,
Configexchange.FileRemove, Configexchange.FileRemove,
System.CheckFwPresence,
System.CheckFwCrc,
System.TriggerFwUpgrade,
System.CoreRevision,
System.MonotonicSeconds,
System.MetrologyUpgradePermission,
Genesisflow.TriggerActive, Genesisflow.TriggerActive,
Genesisflow.TriggerIdle, Genesisflow.TriggerIdle,
Genesisflow.LedMode, Genesisflow.LedMode,
@@ -145,10 +161,26 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
Genesisflow.MeterSize, Genesisflow.MeterSize,
Genesisflow.LookupFileCrc, Genesisflow.LookupFileCrc,
Genesisflow.StoreCalibration, Genesisflow.StoreCalibration,
Genesisflow.StoreConfiguration,
Powermon.BatteryVoltage,
Powermon.BatteryQuantity,
Powermon.BatteryDrainedLoad,
Powermon.BatteryInitialLoad,
Powermon.BatteryExceededSeconds,
Powermon.StoreConfiguration,
Sensusradio.WakeupInterval, Sensusradio.WakeupInterval,
Sensusradio.FrequencyIndicator, Sensusradio.FrequencyIndicator,
Sensusradio.SystemState Sensusradio.SystemState,
Sensusradio.StoreConfiguration,
Metrologyasst.PulseMode,
Metrologyasst.StoreConfiguration,
Irda.StoreConfiguration,
Logger.StoreConfiguration
}; };
@@ -1624,7 +1624,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
$"{_currentGenesis.PcbId}_" + FwUpdateConfig.RestoreSettingsFileName); $"{_currentGenesis.PcbId}_" + FwUpdateConfig.RestoreSettingsFileName);
var pulseMode = var pulseMode =
RegisterConverter.ConvertTo<Byte>(_currentGenesis.ReadRegister(Register.Mertrologyasst.PulseMode)); RegisterConverter.ConvertTo<Byte>(_currentGenesis.ReadRegister(Register.Metrologyasst.PulseMode));
// if pulse mode is already set to 0 (OFF) this could be initial setup or a indication of a crashed update // if pulse mode is already set to 0 (OFF) this could be initial setup or a indication of a crashed update
if (pulseMode == 0) if (pulseMode == 0)
{ {
@@ -1642,14 +1642,14 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
if (!retVal) if (!retVal)
{ {
// safe the pulse setting // safe the pulse setting
_pulseModeRegistersRestore.Add(Register.Mertrologyasst.PulseMode, new[] { pulseMode }); _pulseModeRegistersRestore.Add(Register.Metrologyasst.PulseMode, new[] { pulseMode });
// Create new file as for report only one version is allowed // Create new file as for report only one version is allowed
var serializedData = JsonConvert.SerializeObject(_pulseModeRegistersRestore); var serializedData = JsonConvert.SerializeObject(_pulseModeRegistersRestore);
var asciiStream = Encoding.UTF8.GetBytes(serializedData); var asciiStream = Encoding.UTF8.GetBytes(serializedData);
File.WriteAllBytes(_pathNameCordonelRegisterRestoreSettingsFile, asciiStream); File.WriteAllBytes(_pathNameCordonelRegisterRestoreSettingsFile, asciiStream);
// write pulse mode temporary to 0 (OFF) and wait for result // write pulse mode temporary to 0 (OFF) and wait for result
retVal = _currentGenesis.WriteRegister(Register.Mertrologyasst.PulseMode, 0); retVal = _currentGenesis.WriteRegister(Register.Metrologyasst.PulseMode, 0);
LogText(Resources.StrPulseModeTemporaryDeactivated); LogText(Resources.StrPulseModeTemporaryDeactivated);
} }
} }
@@ -1680,8 +1680,8 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
retVal &= _currentGenesis.WriteRegister(item.Key, item.Value); retVal &= _currentGenesis.WriteRegister(item.Key, item.Value);
} }
retVal &= _currentGenesis.WriteRegister(Register.Mertrologyasst.StoreConfiguration, 1); retVal &= _currentGenesis.WriteRegister(Register.Metrologyasst.StoreConfiguration, 1);
if (retVal && _pulseModeRegistersRestore.Any(x => x.Key == Register.Mertrologyasst.PulseMode)) if (retVal && _pulseModeRegistersRestore.Any(x => x.Key == Register.Metrologyasst.PulseMode))
LogText(Resources.StrPulseModeRestored); LogText(Resources.StrPulseModeRestored);
} }
catch (Exception ) catch (Exception )