GenesisMeter: - Quick Login removed

FwUpdateSw: - Check radio NOT in production mode
This commit is contained in:
Thomas Wiedebusch
2023-02-20 18:53:49 +01:00
parent a0eff86d6f
commit 94d9b1f02e
7 changed files with 46 additions and 47 deletions
@@ -1036,20 +1036,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
return Login(_password);
}
/// <remarks date="2018JAN08" author="drabesch">
/// Get password from server
/// </remarks>
public Boolean QuickLogin()
{
if (string.IsNullOrEmpty(_password) || string.IsNullOrEmpty(PcbId))
{
var password = GetPassword();
return !string.IsNullOrEmpty(password) && Login(password, true, true);
}
return Login(_password, true, true);
}
/// <summary>
/// Login with identical password as last time
/// </summary>
@@ -1087,7 +1073,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
/// <summary>
/// Starting a timer to keep session active,
/// starting the <see cref="KeepSessionThreadLoop"/>.
@@ -1095,7 +1080,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <param name="password">password string to login</param>
/// <param name="runImmediately"> true = process command; false = add command to list. call
/// <see cref="RequestProtocolProcess()"></see> to process login command </param>
/// <param name="quickLogin"></param>
/// <returns></returns>
/// <remarks date="2019JAN01" author="drabesch">
/// pass runImmediately for auto login
@@ -1103,7 +1087,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2021-Feb-02" author="Thomas Wiedebusch">
/// - Avoid retries during login, a retry will lock the Genesis for 2s, 4s, 8s, 16s and so on.
/// </remarks>
public Boolean Login(String password, Boolean runImmediately = true, Boolean quickLogin = false)
/// <remarks date="2023-Feb-20" author="Thomas Wiedebusch">
/// - Quick login removed.
/// </remarks>
public Boolean Login(String password, Boolean runImmediately = true)
{
var backupRetries = CommunicationConfig.RequestRetries;
@@ -1128,17 +1115,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
_logger.Info($"Slot:{Slot} - Successful logged in to meter");
StartKeepSession();
if (quickLogin)
{
WriteRegister(Register.Mertrologyasst.PulseMode, 0, true, true);
//avoid access if radio app is not installed
if (RadioFrequencyMhz != null)
{
WriteRegister(Register.Sensusradio.WakeupInterval, 6, true, true);
WriteRegister("SENSUSRADIO_SystemState", 1, true, true);
}
}
if (Configuration != null && !Configuration.ProductionMode)
{
IsDevelopmentUsage = true;
@@ -121,8 +121,7 @@ namespace Xylem.Common.Hardware.WaterMeter.WaterMeterCore
/// </summary>
/// <param name="password">password for login</param>
/// <param name="runImmediately">execute immediately</param>
/// <param name="quickLogin">speed up login</param>
Boolean Login(String password, Boolean runImmediately = true, Boolean quickLogin = false);
Boolean Login(String password, Boolean runImmediately = true);
/// <summary>
/// set up measurement parameter and set meter into test-mode
@@ -335,7 +335,7 @@ namespace ProductionUiCordonel
CurrentProcess = "Cordonel verbunden";
CurrentGenesisMeter.QuickLogin();
CurrentGenesisMeter.ReLogin();
}
else
@@ -729,13 +729,13 @@ namespace Xylem.Common.Service.MeterProcessState.Controllers
var file = new RecoverySettings { PcbId = pcbId, RadioFrequencyMhz = radioFrq, Region = region, Release = flexnetVersion,
RecoveryRegisters = new List<RecoveryRegisterItem>
{
new RecoveryRegisterItem() { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 },
new RecoveryRegisterItem { RegisterIdent = "GENESISFLOW_SealDisplay", WriteValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 },
IsCritical = true, ReadBackValue = new Byte[] { 0x00, 0x00, 0x00, 0x00 } }
}
};
var csdRet = OrderProgrammingParameters.GetProgrammingParameters(pcbId.ToString(), GlobalConfig.connectionString.Value);
var csdRet = OrderProgrammingParameters.GetProgrammingParameters(pcbId, GlobalConfig.connectionString.Value);
foreach (var item in csdRet.Where(w => w.Source == Logic.ProductionOrderCore.ProgrammingSource.Vako))
@@ -21,7 +21,9 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=GENESISFLOW/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hannover/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Irda/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Joerg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Laatzen/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Lachenmayer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Ludwigshafen/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Metrology/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Savarda/@EntryIndexedValue">True</s:Boolean>
@@ -3030,14 +3030,22 @@ namespace Xylem.ServiceFwUpdate.Ui.FwUpdateBuilder
Int32.TryParse(version, out requiredCoreVersion);
}
var requiredMetrologyVersion = 0;
if (cbxFwPackageSearchMetrology.Text != Constants.StrWildcard)
{
var version = cbxFwPackageSearchMetrology.Text;
version = version.Replace(".", "");
Int32.TryParse(version, out requiredMetrologyVersion);
}
if ((fw.Region != cbxFwPackageRegionMask.Text && cbxFwPackageRegionMask.Text != Constants.StrWildcard) ||
(fw.RadioFrequencyMhz.ToString() != cbxFwPackageRadioMask.Text && cbxFwPackageRadioMask.Text != Constants.StrWildcard) ||
(fw.MeterSize != cbxFwPackageSizeMask.Text && cbxFwPackageSizeMask.Text != Constants.StrWildcard) ||
(((fw.CoreRevisionMin != null && fw.CoreRevisionMin > requiredCoreVersion) ||
(fw.CoreRevisionMax != null && requiredCoreVersion > fw.CoreRevisionMax)) &&
cbxFwPackageSearchCore.Text != Constants.StrWildcard) ||
(fw.MetrologyVersion.ToString() != cbxFwPackageSearchMetrology.Text &&
cbxFwPackageSearchMetrology.Text != Constants.StrWildcard))
(fw.MetrologyVersion != requiredMetrologyVersion &&
cbxFwPackageSearchMetrology.Text != Constants.StrWildcard))
continue;
var row = _dataTableFwPackages.NewRow();
@@ -1295,9 +1295,12 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
// meter size
if (!string.IsNullOrEmpty(meterSize))
{
// check the update capability for meter size, on undefined meter size accept update
// check the update capability for meter size,
// if fw package supports all meter sizes or the meter size is unknown
// or the meter size of the Cordonel is not logged to DB
if (_currentGenesis.MeterSize == meterSize
|| Constants.StrUnknown == meterSize
|| Constants.StrWildcard == meterSize
|| Constants.StrUnknown == _currentGenesis.MeterSize)
{
InfoProcessSuccess(null, Resources.StrCordonelUpdateCapabilityMeterSizeSucceeded);
@@ -1313,12 +1316,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
}
}
// radio frequency
// if radio frequency is null the region is "NA" or the fw package serves all frequencies
if (radioFrequencyMhz == null) return retVal;
// if the radio frequency is required, it has to be verified against the preset value in the Cordonel
if (radioFrequencyMhz == _currentGenesis.RadioFrequencyMhz)
if (radioFrequencyMhz == null || radioFrequencyMhz == _currentGenesis.RadioFrequencyMhz)
{
InfoProcessSuccess(null, Resources.StrCordonelUpdateCapabilityRadioSucceeded);
}
@@ -1488,11 +1488,18 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
#region ------------------------------------------ Tools ------------------------------------------------------
/// <summary>
/// Activate the radio with logging of success or failed.
/// Activate the radio in customer mode with logging of success or failed.
/// </summary>
/// <remarks date="2023-Feb-18" author="Thomas Wiedebusch">
/// - Initial.
/// </remarks>
/// <remarks date="2023-Feb-20" author="Thomas Wiedebusch">
/// - Reworked with new information from Joerg Lachenmayer:
/// 1. Write 0xff,
/// 2. logout,
/// 3. login
/// 4. read if not 0x01.
/// </remarks>
private Boolean ActivateRadio()
{
if (_currentGenesis == null)
@@ -1501,19 +1508,26 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
Boolean retVal;
try
{
// read initially if radio is already active in customer mode 2
if ( 2 == RegisterConverter.ConvertTo<Int32>(_currentGenesis.ReadRegister(Register.Sensusradio.SystemState)))
// read initially if radio is NOT in production mode (0x01), where it sends unencrypted radio telegrams
if ( 0x01 != RegisterConverter.ConvertTo<Int32>(_currentGenesis.ReadRegister(Register.Sensusradio.SystemState)))
{
LogSuccessText(Resources.StrRadioAlreadyActive);
retVal = true;
}
else // switch radio active
else // switch radio active to customer mode with encrypted communication
{
// write register to 0xFF means radio activation with programmed radio key to customer mode
// write register to 0xFF means radio activation with programmed radio key to customer mode,
// SENSUSRADIO needs to store all information to CONFIGEXCHANGE, therefore a logout has to be forced
_currentGenesis.WriteRegister(Register.Sensusradio.SystemState, 0xFF);
_currentGenesis.Logout();
// give the radio app the time to store and restart in customer mode
Thread.Sleep(5000);
// read back if radio is active in customer mode 2
if (2 == RegisterConverter.ConvertTo<Int32>(_currentGenesis.ReadRegister(Register.Sensusradio.SystemState)))
// login for read back of new mode which shouldn't be 0x01
_currentGenesis.ReLogin();
// read back if radio is no longer in production mode
if (0x01 != RegisterConverter.ConvertTo<Int32>(_currentGenesis.ReadRegister(Register.Sensusradio.SystemState)))
{
LogSuccessText(Resources.StrRadioActivationSuccess);
retVal = true;