CUST: - FwUpdateSw: - state machine adapted to communication error - unfinished
This commit is contained in:
@@ -1414,7 +1414,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
private void ReadMeterFirmwareAndAssignRegisters()
|
||||
{
|
||||
// Avoid overwriting of list if this already exits
|
||||
if (MeterAppListVersion.Any())
|
||||
if (MeterAppListVersion.Any() && MeterAppListVersion.All(f => f.Status != MeterAppState.Unknown))
|
||||
{
|
||||
_logger.Warn($"Slot:{Slot} - Trying to override meter dictionary. Skip read out FW");
|
||||
return;
|
||||
@@ -1422,6 +1422,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
||||
|
||||
// On new readout reset the installed version
|
||||
InstalledFwVersion = 0;
|
||||
MeterAppListVersion.Clear();
|
||||
|
||||
//Get all existing applications from meter register dictionary
|
||||
foreach (var meterApp in _configApplications.OrderBy(o => o.AppId))
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
89102b0142e574de38a9f47d370f3334e5e6c268
|
||||
8fbe991b217e7692af4817ad205b768685aa5a72
|
||||
|
||||
@@ -133,6 +133,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
private readonly DataGridViewCellStyle _styleValidated = new DataGridViewCellStyle();
|
||||
private readonly DataGridViewCellStyle _styleVerificationRequired = new DataGridViewCellStyle();
|
||||
private readonly DataGridViewCellStyle _styleEraseRequired = new DataGridViewCellStyle();
|
||||
private readonly DataGridViewCellStyle _styleCommunicationError = new DataGridViewCellStyle();
|
||||
|
||||
// update information
|
||||
private Boolean _binaryPackageLoaded;
|
||||
@@ -491,7 +492,8 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
|
||||
case ProcessState.CheckFwUpdateSuccess:
|
||||
// If the update request returns false, the FW is up to date,
|
||||
// if true it needs an update (update did not succeed) release meter to normal operation
|
||||
// if true it needs an update (update did not succeed) release meter to normal operation to
|
||||
// leave this to the user
|
||||
CheckUpdateRequest(ProcessState.ReleaseMeterToNormalOperation, ProcessState.FwUpdateSuccess);
|
||||
break;
|
||||
|
||||
@@ -880,6 +882,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
_styleDownloadFailed.BackColor = Color.LightPink;
|
||||
_styleDownloadFailed.ForeColor = Color.Red;
|
||||
|
||||
_styleCommunicationError.BackColor = Color.LightPink;
|
||||
_styleCommunicationError.ForeColor = Color.Red;
|
||||
|
||||
_styleVerificationRequired.BackColor = Color.LightGoldenrodYellow;
|
||||
_styleVerificationRequired.ForeColor = Color.Green;
|
||||
|
||||
@@ -1064,7 +1069,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
||||
break;
|
||||
case MeterAppState.Unknown:
|
||||
dataGridRow.DefaultCellStyle = _styleDownloadFailed;
|
||||
dataGridRow.DefaultCellStyle = _styleCommunicationError;
|
||||
break;
|
||||
case MeterAppState.MeterAppNotInstalled:
|
||||
dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
||||
@@ -1252,9 +1257,6 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
/// - Exported CheckPackageFileAndFileApps to CheckUpdateRequest to separate capability check from
|
||||
/// applications are up-to-date.
|
||||
/// </remarks>
|
||||
/// <remarks date="2024-Apr-23" author="Thomas Wiedebusch">
|
||||
/// - Check for communication issues to avoid wrong information on installed apps.
|
||||
/// </remarks>
|
||||
private void CheckUpdateCapability(ProcessState successExitState,
|
||||
ProcessState errorExitState = ProcessState.Error)
|
||||
{
|
||||
@@ -1265,13 +1267,6 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
{
|
||||
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
|
||||
Thread.CurrentThread.CurrentCulture = _cultureInfo;
|
||||
if (!AllAppsDetected())
|
||||
{
|
||||
_processState = errorExitState;
|
||||
// overwrite the invoker state to create a message
|
||||
_invokerProcessState = ProcessState.CheckCommunication;
|
||||
return;
|
||||
}
|
||||
if (!CoreRevisionValid())
|
||||
{
|
||||
_processState = errorExitState;
|
||||
@@ -1319,6 +1314,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
/// <remarks date="2020-Dec-21" author="Thomas Wiedebusch">
|
||||
/// - Initial based on previous implementation of CheckUpdateEnabled().
|
||||
/// </remarks>
|
||||
/// <remarks date="2024-Apr-23" author="Thomas Wiedebusch">
|
||||
/// - Check for communication issues to avoid wrong information on installed apps.
|
||||
/// </remarks>
|
||||
private void CheckUpdateRequest(ProcessState successExitState, ProcessState breakExitState,
|
||||
ProcessState errorExitState = ProcessState.Error)
|
||||
{
|
||||
@@ -1331,26 +1329,46 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
{
|
||||
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
|
||||
Thread.CurrentThread.CurrentCulture = _cultureInfo;
|
||||
if (!CheckPackageFileAndFileApps())
|
||||
if (_invokerProcessState == ProcessState.CheckUpdateRequest)
|
||||
{
|
||||
_processState = errorExitState;
|
||||
// overwrite the invoker state to create a message
|
||||
_invokerProcessState = ProcessState.CheckUpdateFiles;
|
||||
return;
|
||||
if (!CheckPackageFileAndFileApps())
|
||||
{
|
||||
_processState = errorExitState;
|
||||
// overwrite the invoker state to create a message
|
||||
_invokerProcessState = ProcessState.CheckUpdateFiles;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AllAppsDetected())
|
||||
{
|
||||
_processState = errorExitState;
|
||||
// overwrite the invoker state to create a message
|
||||
_invokerProcessState = ProcessState.CheckCommunication;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FillDataGridWithAllInfos();
|
||||
// this check has been placed here to force display update
|
||||
if (_currentGenesis.MeterAppListVersion.Any(f => f.Update) ||
|
||||
_currentGenesis.MeterAppListVersion.Any(f => f.Erase))
|
||||
|
||||
var allAppsDetected = AllAppsDetected();
|
||||
if (allAppsDetected &&
|
||||
!_currentGenesis.MeterAppListVersion.Any(f => f.Update) &&
|
||||
!_currentGenesis.MeterAppListVersion.Any(f => f.Erase))
|
||||
{
|
||||
// Nothing has to be updated, the latest FW is installed from program handler
|
||||
// it stops operation with break for FW-Update
|
||||
_processState = breakExitState;
|
||||
}
|
||||
else if (_currentGenesis.MeterAppListVersion.Any(f => f.Update) ||
|
||||
_currentGenesis.MeterAppListVersion.Any(f => f.Erase))
|
||||
{
|
||||
// an update needs to be executed
|
||||
_processState = successExitState;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nothing has to be updated, the latest FW is installed from program handler
|
||||
// it stops operation with break for FW-Update
|
||||
_processState = breakExitState;
|
||||
// Communication error and therefore unknown installation state
|
||||
_processState = errorExitState;
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -1479,7 +1497,6 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
return true;
|
||||
|
||||
InfoProcessFailed(lblCordonelUpdateCapability, Resources.StrCordonelCommunicationFailed);
|
||||
_processState = ProcessState.Error;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2885,14 +2902,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
break;
|
||||
|
||||
// This is the check sequence for update capability
|
||||
case ProcessState.CheckUpdateCapability:
|
||||
// This state will never return with error as the following "Check.." states will be forced
|
||||
// by the individual update capability checks
|
||||
break;
|
||||
case ProcessState.CheckCommunication:
|
||||
msg = Resources.StrCordonelCommunicationFailed;
|
||||
case ProcessState.CheckUpdateRequest:
|
||||
msg = Resources.StrFirmwareUpdateFailed;
|
||||
ErrorProcessCommon(msg);
|
||||
_processState = ProcessState.PrepareMeterRelease;
|
||||
break;
|
||||
case ProcessState.CheckCoreRevision:
|
||||
msg = Resources.StrCordonelUpdateCapabilityCoreFailed;
|
||||
@@ -2919,6 +2931,11 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
||||
ErrorProcessCommon(msg);
|
||||
_processState = ProcessState.PrepareMeterRelease;
|
||||
break;
|
||||
case ProcessState.CheckCommunication:
|
||||
msg = Resources.StrCordonelCommunicationFailed;
|
||||
ErrorProcessCommon(msg);
|
||||
_processState = ProcessState.PrepareMeterRelease;
|
||||
break;
|
||||
|
||||
// This is the FW-Update process
|
||||
case ProcessState.FirmwareUpdate:
|
||||
|
||||
@@ -115,6 +115,15 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Communication problems!.
|
||||
/// </summary>
|
||||
internal static string StrCordonelCommunicationFailed {
|
||||
get {
|
||||
return ResourceManager.GetString("StrCordonelCommunicationFailed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Cordonel detection failed.
|
||||
/// </summary>
|
||||
@@ -269,7 +278,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ERROR: Unknown data container received.
|
||||
/// Looks up a localized string similar to ERROR: Unknown data container received!.
|
||||
/// </summary>
|
||||
internal static string StrDataContainerUnknown {
|
||||
get {
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
<value>Update capability.</value>
|
||||
</data>
|
||||
<data name="StrDataContainerUnknown" xml:space="preserve">
|
||||
<value>ERROR: Unknown data container received</value>
|
||||
<value>ERROR: Unknown data container received!</value>
|
||||
</data>
|
||||
<data name="StrFailedToUpdateApp" xml:space="preserve">
|
||||
<value>ERROR: Failed to update application:</value>
|
||||
@@ -688,4 +688,7 @@
|
||||
<data name="StrRegisterRecoveryWarning" xml:space="preserve">
|
||||
<value>WARNING: Configuration partially skipped!</value>
|
||||
</data>
|
||||
<data name="StrCordonelCommunicationFailed" xml:space="preserve">
|
||||
<value>ERROR: Communication problems!</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -154,16 +154,6 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Resources.de.Designer.cs">
|
||||
<DependentUpon>Resources.de.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.de1.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.de.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
Reference in New Issue
Block a user