GenesisMeter: - communication error marks application as undetected to avoid accidentally FW update
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consts/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Consts/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonel/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonel/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonels/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Cordonels/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=CUST/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=dispached/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=dispached/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=DNMAX/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=DNMAX/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Drabesch/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Drabesch/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
|||||||
@@ -63,6 +63,14 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Unknown,
|
Unknown,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Meter application detected but not checked
|
||||||
|
/// </summary>
|
||||||
|
MeterAppInstalledUnchecked,
|
||||||
|
/// <summary>
|
||||||
|
/// Meter application is not required
|
||||||
|
/// </summary>
|
||||||
|
MeterAppNotRequired,
|
||||||
|
/// <summary>
|
||||||
/// Delimiter for list
|
/// Delimiter for list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MeterAppStateListDelimiter
|
MeterAppStateListDelimiter
|
||||||
|
|||||||
@@ -20,47 +20,54 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Const
|
|||||||
public MeterAppStateInfo()
|
public MeterAppStateInfo()
|
||||||
{
|
{
|
||||||
_stateInfos = new MeterAppStateText[(Int32)MeterAppState.MeterAppStateListDelimiter];
|
_stateInfos = new MeterAppStateText[(Int32)MeterAppState.MeterAppStateListDelimiter];
|
||||||
_stateInfos[0].State = MeterAppState.MeterAppNotInstalled;
|
|
||||||
_stateInfos[0].Message = Resources.StrMeterAppNotInstalled;
|
_stateInfos[(Int32)MeterAppState.MeterAppNotInstalled].State = MeterAppState.MeterAppNotInstalled;
|
||||||
|
_stateInfos[(Int32)MeterAppState.MeterAppNotInstalled].Message = Resources.StrMeterAppNotInstalled;
|
||||||
|
|
||||||
_stateInfos[1].State = MeterAppState.MeterAppUpToDate;
|
_stateInfos[(Int32)MeterAppState.MeterAppNotRequired].State = MeterAppState.MeterAppNotRequired;
|
||||||
_stateInfos[1].Message = Resources.StrMeterAppUpToDate;
|
_stateInfos[(Int32)MeterAppState.MeterAppNotRequired].Message = Resources.StrMeterAppNotRequired;
|
||||||
|
|
||||||
_stateInfos[2].State = MeterAppState.MeterAppInstallationRequired;
|
_stateInfos[(Int32)MeterAppState.MeterAppUpToDate].State = MeterAppState.MeterAppUpToDate;
|
||||||
_stateInfos[2].Message = Resources.StrMeterAppInstallationRequired;
|
_stateInfos[(Int32)MeterAppState.MeterAppUpToDate].Message = Resources.StrMeterAppUpToDate;
|
||||||
|
|
||||||
_stateInfos[3].State = MeterAppState.MeterAppVersionOutdated;
|
_stateInfos[(Int32)MeterAppState.MeterAppInstallationRequired].State = MeterAppState.MeterAppInstallationRequired;
|
||||||
_stateInfos[3].Message = Resources.StrMeterAppVersionOutdated;
|
_stateInfos[(Int32)MeterAppState.MeterAppInstallationRequired].Message = Resources.StrMeterAppInstallationRequired;
|
||||||
|
|
||||||
_stateInfos[4].State = MeterAppState.InvalidCrc;
|
_stateInfos[(Int32)MeterAppState.MeterAppVersionOutdated].State = MeterAppState.MeterAppVersionOutdated;
|
||||||
_stateInfos[4].Message = Resources.StrInvalidCrc;
|
_stateInfos[(Int32)MeterAppState.MeterAppVersionOutdated].Message = Resources.StrMeterAppVersionOutdated;
|
||||||
|
|
||||||
_stateInfos[5].State = MeterAppState.MeterAppErasureRequired;
|
_stateInfos[(Int32)MeterAppState.InvalidCrc].State = MeterAppState.InvalidCrc;
|
||||||
_stateInfos[5].Message = Resources.StrMeterAppErasureRequired;
|
_stateInfos[(Int32)MeterAppState.InvalidCrc].Message = Resources.StrInvalidCrc;
|
||||||
|
|
||||||
_stateInfos[6].State = MeterAppState.MeterAppDownloadSucceeded;
|
_stateInfos[(Int32)MeterAppState.MeterAppErasureRequired].State = MeterAppState.MeterAppErasureRequired;
|
||||||
_stateInfos[6].Message = Resources.StrMeterAppDownloadSucceeded;
|
_stateInfos[(Int32)MeterAppState.MeterAppErasureRequired].Message = Resources.StrMeterAppErasureRequired;
|
||||||
|
|
||||||
_stateInfos[7].State = MeterAppState.MeterAppDownloadSuspicious;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadSucceeded].State = MeterAppState.MeterAppDownloadSucceeded;
|
||||||
_stateInfos[7].Message = Resources.StrMeterAppDownloadSuspicious;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadSucceeded].Message = Resources.StrMeterAppDownloadSucceeded;
|
||||||
|
|
||||||
_stateInfos[8].State = MeterAppState.MeterAppSuccessfulErased;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadSuspicious].State = MeterAppState.MeterAppDownloadSuspicious;
|
||||||
_stateInfos[8].Message = Resources.StrMeterAppSuccessfulErased;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadSuspicious].Message = Resources.StrMeterAppDownloadSuspicious;
|
||||||
|
|
||||||
_stateInfos[9].State = MeterAppState.MeterAppSuccessfulUpdated;
|
_stateInfos[(Int32)MeterAppState.MeterAppSuccessfulErased].State = MeterAppState.MeterAppSuccessfulErased;
|
||||||
_stateInfos[9].Message = Resources.StrMeterAppSuccessfulUpdated;
|
_stateInfos[(Int32)MeterAppState.MeterAppSuccessfulErased].Message = Resources.StrMeterAppSuccessfulErased;
|
||||||
|
|
||||||
_stateInfos[10].State = MeterAppState.MeterAppDownloadFailed;
|
_stateInfos[(Int32)MeterAppState.MeterAppSuccessfulUpdated].State = MeterAppState.MeterAppSuccessfulUpdated;
|
||||||
_stateInfos[10].Message = Resources.StrMeterAppDownloadFailed;
|
_stateInfos[(Int32)MeterAppState.MeterAppSuccessfulUpdated].Message = Resources.StrMeterAppSuccessfulUpdated;
|
||||||
|
|
||||||
_stateInfos[11].State = MeterAppState.MeterAppDownloadActive;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadFailed].State = MeterAppState.MeterAppDownloadFailed;
|
||||||
_stateInfos[11].Message = Resources.StrMeterAppDownloadActive;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadFailed].Message = Resources.StrMeterAppDownloadFailed;
|
||||||
|
|
||||||
_stateInfos[12].State = MeterAppState.FileAppInvalid;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadActive].State = MeterAppState.MeterAppDownloadActive;
|
||||||
_stateInfos[12].Message = Resources.StrFileAppInvalid;
|
_stateInfos[(Int32)MeterAppState.MeterAppDownloadActive].Message = Resources.StrMeterAppDownloadActive;
|
||||||
|
|
||||||
_stateInfos[13].State = MeterAppState.Unknown;
|
_stateInfos[(Int32)MeterAppState.FileAppInvalid].State = MeterAppState.FileAppInvalid;
|
||||||
_stateInfos[13].Message = "";
|
_stateInfos[(Int32)MeterAppState.FileAppInvalid].Message = Resources.StrFileAppInvalid;
|
||||||
|
|
||||||
|
_stateInfos[(Int32)MeterAppState.Unknown].State = MeterAppState.Unknown;
|
||||||
|
_stateInfos[(Int32)MeterAppState.Unknown].Message = Resources.StrMeterAppStateUnknown;
|
||||||
|
|
||||||
|
_stateInfos[(Int32)MeterAppState.MeterAppInstalledUnchecked].State = MeterAppState.MeterAppInstalledUnchecked;
|
||||||
|
_stateInfos[(Int32)MeterAppState.MeterAppInstalledUnchecked].Message = Resources.StrMeterAppDetected;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+29
-2
@@ -78,6 +78,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Installed.
|
||||||
|
/// </summary>
|
||||||
|
public static string StrMeterAppDetected {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("StrMeterAppDetected", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to DOWNLOAD....
|
/// Looks up a localized string similar to DOWNLOAD....
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -133,7 +142,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Application not required.
|
/// Looks up a localized string similar to Not installed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string StrMeterAppNotInstalled {
|
public static string StrMeterAppNotInstalled {
|
||||||
get {
|
get {
|
||||||
@@ -141,6 +150,24 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Not required.
|
||||||
|
/// </summary>
|
||||||
|
public static string StrMeterAppNotRequired {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("StrMeterAppNotRequired", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Installation state unknown.
|
||||||
|
/// </summary>
|
||||||
|
public static string StrMeterAppStateUnknown {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("StrMeterAppStateUnknown", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Erasure succeeded.
|
/// Looks up a localized string similar to Erasure succeeded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -160,7 +187,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Up To Date.
|
/// Looks up a localized string similar to Okay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string StrMeterAppUpToDate {
|
public static string StrMeterAppUpToDate {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -118,16 +118,16 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="StrMeterAppNotInstalled" xml:space="preserve">
|
<data name="StrMeterAppNotInstalled" xml:space="preserve">
|
||||||
<value>Anwendung nicht erforderlich</value>
|
<value>Nicht installiert</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrMeterAppUpToDate" xml:space="preserve">
|
<data name="StrMeterAppUpToDate" xml:space="preserve">
|
||||||
<value>Version ist aktuell</value>
|
<value>Okay</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrMeterAppInstallationRequired" xml:space="preserve">
|
<data name="StrMeterAppInstallationRequired" xml:space="preserve">
|
||||||
<value>Installation notwendig</value>
|
<value>Installation notwendig</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrMeterAppVersionOutdated" xml:space="preserve">
|
<data name="StrMeterAppVersionOutdated" xml:space="preserve">
|
||||||
<value>Version ist unterschiedlich</value>
|
<value>Update erforderlich</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrInvalidCrc" xml:space="preserve">
|
<data name="StrInvalidCrc" xml:space="preserve">
|
||||||
<value>Prüfsummenfehler (CRC)</value>
|
<value>Prüfsummenfehler (CRC)</value>
|
||||||
@@ -156,4 +156,13 @@
|
|||||||
<data name="StrFileAppInvalid" xml:space="preserve">
|
<data name="StrFileAppInvalid" xml:space="preserve">
|
||||||
<value>Ungültige Aktualisierungsdatei</value>
|
<value>Ungültige Aktualisierungsdatei</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StrMeterAppDetected" xml:space="preserve">
|
||||||
|
<value>Installiert</value>
|
||||||
|
</data>
|
||||||
|
<data name="StrMeterAppStateUnknown" xml:space="preserve">
|
||||||
|
<value>Installationszustand unbekannt</value>
|
||||||
|
</data>
|
||||||
|
<data name="StrMeterAppNotRequired" xml:space="preserve">
|
||||||
|
<value>Nicht eforderlich</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -118,10 +118,10 @@
|
|||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="StrMeterAppNotInstalled" xml:space="preserve">
|
<data name="StrMeterAppNotInstalled" xml:space="preserve">
|
||||||
<value>Application not required</value>
|
<value>Not installed</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrMeterAppUpToDate" xml:space="preserve">
|
<data name="StrMeterAppUpToDate" xml:space="preserve">
|
||||||
<value>Up To Date</value>
|
<value>Okay</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrMeterAppInstallationRequired" xml:space="preserve">
|
<data name="StrMeterAppInstallationRequired" xml:space="preserve">
|
||||||
<value>Installation required</value>
|
<value>Installation required</value>
|
||||||
@@ -156,4 +156,13 @@
|
|||||||
<data name="StrFileAppInvalid" xml:space="preserve">
|
<data name="StrFileAppInvalid" xml:space="preserve">
|
||||||
<value>INVALID UPDATE FILE</value>
|
<value>INVALID UPDATE FILE</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StrMeterAppDetected" xml:space="preserve">
|
||||||
|
<value>Installed</value>
|
||||||
|
</data>
|
||||||
|
<data name="StrMeterAppStateUnknown" xml:space="preserve">
|
||||||
|
<value>Installation state unknown</value>
|
||||||
|
</data>
|
||||||
|
<data name="StrMeterAppNotRequired" xml:space="preserve">
|
||||||
|
<value>Not required</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -176,6 +176,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private String _password;
|
private String _password;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// reminder for last communication acknowledge code to detect communication errors
|
||||||
|
/// </summary>
|
||||||
|
private RequestAcknowledgeState _acknowledgeCode;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// default false only enabled by <see cref="EnableAutoLogon"/>
|
/// default false only enabled by <see cref="EnableAutoLogon"/>
|
||||||
/// when it is true, the meter will enforce the login when session is gone or access is denied
|
/// when it is true, the meter will enforce the login when session is gone or access is denied
|
||||||
@@ -1401,6 +1406,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
/// <remarks date="2024-Feb-22" author="Thomas Wiedebusch">
|
/// <remarks date="2024-Feb-22" author="Thomas Wiedebusch">
|
||||||
/// - Build dictionary for debug to observe if configuration.json contains overlapping versions.
|
/// - Build dictionary for debug to observe if configuration.json contains overlapping versions.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-23" author="Thomas Wiedebusch">
|
||||||
|
/// - On missing answer mark as communication error being able to compare against not-installed. This issue
|
||||||
|
/// was responsible to start a FW update process in the CUST as it assumes the installation was incomplete
|
||||||
|
/// but it couldn't detect those applications due to communication issues.
|
||||||
|
/// </remarks>
|
||||||
private void ReadMeterFirmwareAndAssignRegisters()
|
private void ReadMeterFirmwareAndAssignRegisters()
|
||||||
{
|
{
|
||||||
// Avoid overwriting of list if this already exits
|
// Avoid overwriting of list if this already exits
|
||||||
@@ -1414,13 +1424,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
InstalledFwVersion = 0;
|
InstalledFwVersion = 0;
|
||||||
|
|
||||||
//Get all existing applications from meter register dictionary
|
//Get all existing applications from meter register dictionary
|
||||||
foreach (var appVersionToRead in _configApplications.OrderBy(o => o.AppId))
|
foreach (var meterApp in _configApplications.OrderBy(o => o.AppId))
|
||||||
{
|
{
|
||||||
UInt32 readFwVersion = 0;
|
UInt32 readFwVersion = 0;
|
||||||
UInt16 readFwCrc = 0;
|
UInt16 readFwCrc = 0;
|
||||||
var isInstalled = false;
|
var isInstalled = false;
|
||||||
|
var installationStatus = MeterAppState.MeterAppNotInstalled;
|
||||||
var versionString = "";
|
var versionString = "";
|
||||||
if (WriteRegister(Register.System.CheckFwPresence, appVersionToRead.AppId))
|
if (WriteRegister(Register.System.CheckFwPresence, meterApp.AppId))
|
||||||
{
|
{
|
||||||
//read version, skip retries on SYSTEM 0x04-> FW nor present is a valid feedback
|
//read version, skip retries on SYSTEM 0x04-> FW nor present is a valid feedback
|
||||||
var readFwVersionBytes = ReadRegister(Register.System.CheckFwPresence, 4);
|
var readFwVersionBytes = ReadRegister(Register.System.CheckFwPresence, 4);
|
||||||
@@ -1435,7 +1446,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
//build the version string, because e.g. FLEXNETVERSION is one application which does not
|
//build the version string, because e.g. FLEXNETVERSION is one application which does not
|
||||||
//follow the same rule. After the upper conversion, the hexadecimal outline will be lost
|
//follow the same rule. After the upper conversion, the hexadecimal outline will be lost
|
||||||
versionString = BuildFwVersionString(readFwVersionBytes[1], readFwVersionBytes[0]);
|
versionString = BuildFwVersionString(readFwVersionBytes[1], readFwVersionBytes[0]);
|
||||||
if (appVersionToRead.AppName == "FLEXNETVERSION")
|
if (meterApp.AppName == "FLEXNETVERSION")
|
||||||
{
|
{
|
||||||
FwVersion = versionString;
|
FwVersion = versionString;
|
||||||
InstalledFwVersion = readFwVersion;
|
InstalledFwVersion = readFwVersion;
|
||||||
@@ -1444,24 +1455,35 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
if (readFwVersion != 0)
|
if (readFwVersion != 0)
|
||||||
{
|
{
|
||||||
isInstalled = true;
|
isInstalled = true;
|
||||||
|
installationStatus = MeterAppState.MeterAppInstalledUnchecked;
|
||||||
//write application Id to CRC register
|
//write application Id to CRC register
|
||||||
if (WriteRegister(Register.System.CheckFwCrc, appVersionToRead.AppId))
|
if (WriteRegister(Register.System.CheckFwCrc, meterApp.AppId))
|
||||||
{
|
{
|
||||||
readFwCrc = RegisterConverter.ByteArrayToValue<UInt16>(ReadRegister(Register.System.CheckFwCrc));
|
readFwCrc = RegisterConverter.ByteArrayToValue<UInt16>(ReadRegister(Register.System.CheckFwCrc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// missing answer
|
||||||
|
else if (RequestAcknowledgeState.NoResponse == _acknowledgeCode)
|
||||||
|
{
|
||||||
|
installationStatus = MeterAppState.Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// missing answer
|
||||||
|
else if (RequestAcknowledgeState.NoResponse == _acknowledgeCode)
|
||||||
|
{
|
||||||
|
installationStatus = MeterAppState.Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
//add application always, even if this is not installed. This will be used for FW updates
|
//add application always, even if this is not installed. This will be used for FW updates
|
||||||
MeterAppListVersion.Add(new MeterApplications
|
MeterAppListVersion.Add(new MeterApplications
|
||||||
{
|
{
|
||||||
AppId = appVersionToRead.AppId,
|
AppId = meterApp.AppId,
|
||||||
Version = readFwVersion,
|
Version = readFwVersion,
|
||||||
StrVersion = versionString,
|
StrVersion = versionString,
|
||||||
AppName = appVersionToRead.AppName,
|
AppName = meterApp.AppName,
|
||||||
Crc = readFwCrc,
|
Crc = readFwCrc,
|
||||||
Status = isInstalled ? MeterAppState.Unknown : MeterAppState.MeterAppNotInstalled,
|
Status = installationStatus,
|
||||||
IsInstalled = isInstalled,
|
IsInstalled = isInstalled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1509,6 +1531,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
{
|
{
|
||||||
var versionString = fm.IsInstalled
|
var versionString = fm.IsInstalled
|
||||||
? $"V: {fm.StrVersion} - CRC: 0x{fm.Crc:X4}" : "Not installed";
|
? $"V: {fm.StrVersion} - CRC: 0x{fm.Crc:X4}" : "Not installed";
|
||||||
|
if (fm.Status == MeterAppState.Unknown)
|
||||||
|
versionString = "Communication error";
|
||||||
|
|
||||||
_logger.Info($"Slot:{Slot} - AppId: 0x{fm.AppId:X2} - {versionString} - AppName: {fm.AppName}");
|
_logger.Info($"Slot:{Slot} - AppId: 0x{fm.AppId:X2} - {versionString} - AppName: {fm.AppName}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2008,13 +2033,20 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Execute request protocol and acts on response code.
|
||||||
|
/// </summary>
|
||||||
/// <remarks date="2020-Dec-19" author="Thomas Wiedebusch">
|
/// <remarks date="2020-Dec-19" author="Thomas Wiedebusch">
|
||||||
/// - Removed throw because the throw always kicks in to
|
/// - Removed throw because the throw always kicks in to
|
||||||
/// the FW-Update process causing an unpredictable stop!
|
/// the FW-Update process causing an unpredictable stop!
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-22" author="Thomas Wiedebusch">
|
||||||
|
/// - Remind last communication acknowledge code.
|
||||||
|
/// </remarks>
|
||||||
private void RequestProtocolProcess()
|
private void RequestProtocolProcess()
|
||||||
{
|
{
|
||||||
switch (RequestProtocol.ProcessRecordList())
|
_acknowledgeCode = RequestProtocol.ProcessRecordList();
|
||||||
|
switch (_acknowledgeCode)
|
||||||
{
|
{
|
||||||
case RequestAcknowledgeState.AuthorizationRequired:
|
case RequestAcknowledgeState.AuthorizationRequired:
|
||||||
|
|
||||||
@@ -2411,14 +2443,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var valuestring = "NULL";
|
var valueString = "NULL";
|
||||||
|
|
||||||
if (value != null)
|
if (value != null)
|
||||||
{
|
{
|
||||||
valuestring = BitConverter.ToString(value);
|
valueString = BitConverter.ToString(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = $"{Configuration.RegisterWatchServiceUrl}RegisterWrite?PcbID={PcbId}&Address={BitConverter.ToString(reg.RegisterAddress)}&value={valuestring}";
|
var url = $"{Configuration.RegisterWatchServiceUrl}RegisterWrite?PcbID={PcbId}&Address={BitConverter.ToString(reg.RegisterAddress)}&value={valueString}";
|
||||||
|
|
||||||
var result = LocalWebRequest.PostRequestAsync(url, 1500, string.Empty);
|
var result = LocalWebRequest.PostRequestAsync(url, 1500, string.Empty);
|
||||||
|
|
||||||
|
|||||||
@@ -345,6 +345,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
/// <remarks date="2019-Jul-02" author="Thomas Wiedebusch">
|
/// <remarks date="2019-Jul-02" author="Thomas Wiedebusch">
|
||||||
/// - Removed genesis meter has to be logged in
|
/// - Removed genesis meter has to be logged in
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-23" author="Thomas Wiedebusch">
|
||||||
|
/// - Removed MeterAppState.Unknown.
|
||||||
|
/// </remarks>
|
||||||
public void CompareAllMeterAndFileApps()
|
public void CompareAllMeterAndFileApps()
|
||||||
{
|
{
|
||||||
if (_genesisMeter == null || FileApps == null)
|
if (_genesisMeter == null || FileApps == null)
|
||||||
@@ -362,7 +365,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
//set display code to up to date if not needed to be installed or up to date
|
//set display code to up to date if not needed to be installed or up to date
|
||||||
_genesisMeter.SetProcessState(_genesisMeter.MeterAppListVersion.All(
|
_genesisMeter.SetProcessState(_genesisMeter.MeterAppListVersion.All(
|
||||||
f => f.Status == MeterAppState.MeterAppUpToDate ||
|
f => f.Status == MeterAppState.MeterAppUpToDate ||
|
||||||
f.Status == MeterAppState.MeterAppNotInstalled || f.Status == MeterAppState.Unknown)
|
f.Status == MeterAppState.MeterAppNotRequired )
|
||||||
? DisplayCodes.FwUpToDate
|
? DisplayCodes.FwUpToDate
|
||||||
: DisplayCodes.FwUpdateFailed, false);
|
: DisplayCodes.FwUpdateFailed, false);
|
||||||
_genesisMeter.Logout();
|
_genesisMeter.Logout();
|
||||||
@@ -372,7 +375,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
//set display code to up to date if not needed to be installed or up to date
|
//set display code to up to date if not needed to be installed or up to date
|
||||||
_genesisMeter.SetProcessState(_genesisMeter.MeterAppListVersion.All(
|
_genesisMeter.SetProcessState(_genesisMeter.MeterAppListVersion.All(
|
||||||
f => f.Status == MeterAppState.MeterAppUpToDate ||
|
f => f.Status == MeterAppState.MeterAppUpToDate ||
|
||||||
f.Status == MeterAppState.MeterAppNotInstalled || f.Status == MeterAppState.Unknown)
|
f.Status == MeterAppState.MeterAppNotRequired )
|
||||||
? DisplayCodes.FwUpToDate
|
? DisplayCodes.FwUpToDate
|
||||||
: DisplayCodes.FwUpdateFailed, false);
|
: DisplayCodes.FwUpdateFailed, false);
|
||||||
}
|
}
|
||||||
@@ -396,25 +399,35 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
/// <remarks date="2020-Dec-01" author="Thomas Wiedebusch">
|
/// <remarks date="2020-Dec-01" author="Thomas Wiedebusch">
|
||||||
/// - Meter state unknown if file apps not loaded
|
/// - Meter state unknown if file apps not loaded
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-23" author="Thomas Wiedebusch">
|
||||||
|
/// - Return if communication error without change of status
|
||||||
|
/// </remarks>
|
||||||
public void CompareMeterAppWithFileApp(MeterApplications meterApp)
|
public void CompareMeterAppWithFileApp(MeterApplications meterApp)
|
||||||
{
|
{
|
||||||
meterApp.Update = false;
|
meterApp.Update = false;
|
||||||
meterApp.Erase = false;
|
meterApp.Erase = false;
|
||||||
|
|
||||||
//CASE -1: meter application is installed but files are not loaded
|
//CASE -3: file apps not loaded, no comparison possible, leave everything as is
|
||||||
if (meterApp.IsInstalled && FileApps.Count == 0)
|
if (FileApps.Count == 0)
|
||||||
{
|
{
|
||||||
meterApp.Status = MeterAppState.Unknown;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CASE 0: meter application is not installed and update files are not loaded
|
//CASE -2: meter application could not be read due to communication error
|
||||||
if (!meterApp.IsInstalled && FileApps.Count == 0)
|
if (meterApp.Status == MeterAppState.Unknown)
|
||||||
{
|
{
|
||||||
meterApp.Status = MeterAppState.MeterAppNotInstalled;
|
//CASE -2.1 Installation is required but installed app is not detected due to communication error
|
||||||
|
if (FileApps.Any(x => x.AppId == meterApp.AppId))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//CASE -2.2 Installation not required as app is NOT in the fileApp list
|
||||||
|
meterApp.Status = MeterAppState.MeterAppNotRequired;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//compare file apps with meter apps and change meterApp.Status
|
||||||
foreach (var fileApp in FileApps)
|
foreach (var fileApp in FileApps)
|
||||||
{
|
{
|
||||||
if (meterApp.AppId != fileApp.AppId)
|
if (meterApp.AppId != fileApp.AppId)
|
||||||
@@ -495,7 +508,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
//CASE 4.2: update file application not found and meter application is not installed
|
//CASE 4.2: update file application not found and meter application is not installed
|
||||||
meterApp.Status = MeterAppState.Unknown;
|
meterApp.Status = MeterAppState.MeterAppNotRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+2
-2
@@ -10,9 +10,9 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
CommandNotAssigned,
|
CommandNotAssigned,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Acknowledge code not set, will be used initially
|
/// Will be used initially as the record is not sent
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NotDecoded,
|
Unsent,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Response missing
|
/// Response missing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -173,6 +173,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
/// <remarks date="2022-Nov-07" author="T.Wiedebusch">
|
/// <remarks date="2022-Nov-07" author="T.Wiedebusch">
|
||||||
/// - Command not assigned response for recordInProcess == null.
|
/// - Command not assigned response for recordInProcess == null.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
/// <remarks date="2024-Apr-22" author="T.Wiedebusch">
|
||||||
|
/// - Initial request acknowledge state changed from NotDecoded to NoResponse.
|
||||||
|
/// </remarks>
|
||||||
public RequestAcknowledgeState ProcessRecordList()
|
public RequestAcknowledgeState ProcessRecordList()
|
||||||
{
|
{
|
||||||
_logger.Trace($"{_ident} Entry to ProcessRecordList, FIFO contains ({_recordsSendFifo.Count}) records");
|
_logger.Trace($"{_ident} Entry to ProcessRecordList, FIFO contains ({_recordsSendFifo.Count}) records");
|
||||||
@@ -195,10 +198,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
if (_recordInProcess == null)
|
if (_recordInProcess == null)
|
||||||
return RequestAcknowledgeState.CommandNotAssigned;
|
return RequestAcknowledgeState.CommandNotAssigned;
|
||||||
|
|
||||||
//mark record as answer outstanding
|
|
||||||
_recordInProcess.Acknowledge = RequestAcknowledgeState.NotDecoded;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
//mark record as answer outstanding
|
||||||
|
_recordInProcess.Acknowledge = RequestAcknowledgeState.NoResponse;
|
||||||
|
|
||||||
_logger.Trace($"{_ident} Record({loopCounter}) - Processing");
|
_logger.Trace($"{_ident} Record({loopCounter}) - Processing");
|
||||||
//log retries
|
//log retries
|
||||||
if (_recordInProcess.RetryCtr > 0)
|
if (_recordInProcess.RetryCtr > 0)
|
||||||
@@ -637,10 +641,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
|
|
||||||
return cRecord;
|
return cRecord;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return cRecord;
|
||||||
return cRecord;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Command acknowledged
|
/// Command acknowledged
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RequestAcknowledgeState Acknowledge = RequestAcknowledgeState.NoResponse;
|
public RequestAcknowledgeState Acknowledge = RequestAcknowledgeState.Unsent;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retry counter
|
/// Retry counter
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
|
|
||||||
private readonly DataGridViewCellStyle _styleInstalled = new DataGridViewCellStyle();
|
private readonly DataGridViewCellStyle _styleInstalled = new DataGridViewCellStyle();
|
||||||
private readonly DataGridViewCellStyle _styleNotInstalled = new DataGridViewCellStyle();
|
private readonly DataGridViewCellStyle _styleNotInstalled = new DataGridViewCellStyle();
|
||||||
private readonly DataGridViewCellStyle _styleInvalidMeterCrc = new DataGridViewCellStyle();
|
private readonly DataGridViewCellStyle _styleMeterCommError = new DataGridViewCellStyle();
|
||||||
private readonly DataGridViewCellStyle _styleUpdateRequired = new DataGridViewCellStyle();
|
private readonly DataGridViewCellStyle _styleUpdateRequired = new DataGridViewCellStyle();
|
||||||
private readonly DataGridViewCellStyle _styleDownloadSucceeded = new DataGridViewCellStyle();
|
private readonly DataGridViewCellStyle _styleDownloadSucceeded = new DataGridViewCellStyle();
|
||||||
private readonly DataGridViewCellStyle _styleDownloadFailed = new DataGridViewCellStyle();
|
private readonly DataGridViewCellStyle _styleDownloadFailed = new DataGridViewCellStyle();
|
||||||
@@ -186,8 +186,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
_styleNotInstalled.BackColor = Color.LightGray;
|
_styleNotInstalled.BackColor = Color.LightGray;
|
||||||
_styleNotInstalled.ForeColor = Color.Black;
|
_styleNotInstalled.ForeColor = Color.Black;
|
||||||
|
|
||||||
_styleInvalidMeterCrc.BackColor = Color.White;
|
_styleMeterCommError.BackColor = Color.White;
|
||||||
_styleInvalidMeterCrc.ForeColor = Color.Purple;
|
_styleMeterCommError.ForeColor = Color.Purple;
|
||||||
|
|
||||||
_styleUpdateRequired.BackColor = Color.White;
|
_styleUpdateRequired.BackColor = Color.White;
|
||||||
_styleUpdateRequired.ForeColor = Color.Red;
|
_styleUpdateRequired.ForeColor = Color.Red;
|
||||||
@@ -357,16 +357,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
foreach (DataGridViewRow dataGridRow in gridViewApplic.Rows)
|
foreach (DataGridViewRow dataGridRow in gridViewApplic.Rows)
|
||||||
{
|
{
|
||||||
var testString = dataGridRow.Cells[StrStatus].Value.ToString();
|
var testString = dataGridRow.Cells[StrStatus].Value.ToString();
|
||||||
//var meterAppState = MeterAppState.MeterAppNotInstalled;
|
|
||||||
var meterAppStateInfo = new MeterAppStateInfo();
|
var meterAppStateInfo = new MeterAppStateInfo();
|
||||||
//if (testString == "" && dataGridRow.Cells[StrMeterVersion].Value.ToString() == "")
|
|
||||||
//{
|
|
||||||
// //dataGridRow.Cells[StrStatus].Value = meterAppStateInfo.GetTextFromState(meterAppState);
|
|
||||||
// //dataGridRow.Cells[StrStatus].Value = MeterAppStateInfo.GetTextFromState(meterAppState);
|
|
||||||
//}
|
|
||||||
|
|
||||||
var meterAppState = meterAppStateInfo.GetStateFromText(testString);
|
var meterAppState = meterAppStateInfo.GetStateFromText(testString);
|
||||||
//meterAppState = MeterAppStateInfo.GetStateFromText(testString);
|
|
||||||
|
|
||||||
switch (meterAppState)
|
switch (meterAppState)
|
||||||
{
|
{
|
||||||
@@ -382,11 +374,17 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
case MeterAppState.MeterAppVersionOutdated:
|
case MeterAppState.MeterAppVersionOutdated:
|
||||||
dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
||||||
break;
|
break;
|
||||||
|
case MeterAppState.Unknown:
|
||||||
|
dataGridRow.DefaultCellStyle = _styleMeterCommError;
|
||||||
|
break;
|
||||||
case MeterAppState.MeterAppNotInstalled:
|
case MeterAppState.MeterAppNotInstalled:
|
||||||
dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
||||||
break;
|
break;
|
||||||
|
case MeterAppState.MeterAppNotRequired:
|
||||||
|
dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
||||||
|
break;
|
||||||
case MeterAppState.InvalidCrc:
|
case MeterAppState.InvalidCrc:
|
||||||
dataGridRow.DefaultCellStyle = _styleInvalidMeterCrc;
|
dataGridRow.DefaultCellStyle = _styleMeterCommError;
|
||||||
break;
|
break;
|
||||||
case MeterAppState.MeterAppErasureRequired:
|
case MeterAppState.MeterAppErasureRequired:
|
||||||
dataGridRow.DefaultCellStyle = _styleEraseRequired;
|
dataGridRow.DefaultCellStyle = _styleEraseRequired;
|
||||||
@@ -414,62 +412,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//foreach (DataGridViewRow dataGridRow in gridViewApplic.Rows)
|
}
|
||||||
//{
|
|
||||||
// var testString = dataGridRow.Cells[StrStatus].Value.ToString();
|
|
||||||
// if (testString == "" && dataGridRow.Cells[StrMeterVersion].Value.ToString() == "")
|
|
||||||
// {
|
|
||||||
// dataGridRow.Cells[StrStatus].Value = MeterFwUpdate.StrMeterAppNotInstalled;
|
|
||||||
// testString = MeterFwUpdate.StrMeterAppNotInstalled;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// switch (testString)
|
|
||||||
// {
|
|
||||||
// case MeterFwUpdate.StrMeterAppUpToDate:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleValidated;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppInstallationRequired:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrFileAppInvalid:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleDownloadOngoing;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppVersionOutdated:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppNotInstalled:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrInvalidCrc:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleInvalidMeterCrc;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppErasureRequired:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleEraseRequired;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppDownloadSucceeded:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleDownloadSucceeded;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppDownloadSuspicious:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleVerificationRequired;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppSuccessfulErased:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleDownloadSucceeded;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppSuccessfulUpdated:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleDownloadSucceeded;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppDownloadFailed:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleDownloadFailed;
|
|
||||||
// break;
|
|
||||||
// case MeterFwUpdate.StrMeterAppDownloadActive:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleDownloadOngoing;
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// dataGridRow.DefaultCellStyle = _styleInstalled;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// After changing the grid view cell and data row cell contents, the meter application lists
|
/// After changing the grid view cell and data row cell contents, the meter application lists
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Const;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisStatus;
|
||||||
@@ -525,6 +526,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
{
|
{
|
||||||
var versionString =
|
var versionString =
|
||||||
app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" : "App NOT Installed";
|
app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" : "App NOT Installed";
|
||||||
|
|
||||||
|
if (app.Status == MeterAppState.Unknown)
|
||||||
|
versionString = "COMMUNICATION ERROR";
|
||||||
LogText($"AppId: 0x{app.AppId:X2} - {versionString} - " + $"AppName: {app.AppName}");
|
LogText($"AppId: 0x{app.AppId:X2} - {versionString} - " + $"AppName: {app.AppName}");
|
||||||
|
|
||||||
if (app.IsInstalled)
|
if (app.IsInstalled)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Logic.ProductionToProductMapper.Cordonel;
|
using Logic.ProductionToProductMapper.Cordonel;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Applications.Const;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
|
||||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile;
|
||||||
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
|
||||||
@@ -398,6 +399,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
|
|||||||
{
|
{
|
||||||
var versionString = app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" :
|
var versionString = app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" :
|
||||||
"App NOT Installed";
|
"App NOT Installed";
|
||||||
|
if (app.Status == MeterAppState.Unknown)
|
||||||
|
versionString = "COMMUNICATION ERROR";
|
||||||
|
|
||||||
LogText($"AppId: 0x{app.AppId:X2} - {versionString} - " + $"AppName: {app.AppName}");
|
LogText($"AppId: 0x{app.AppId:X2} - {versionString} - " + $"AppName: {app.AppName}");
|
||||||
|
|
||||||
if (app.IsInstalled)
|
if (app.IsInstalled)
|
||||||
|
|||||||
@@ -538,6 +538,8 @@ namespace Xylem.Common.Ui.MagFluxToolBox
|
|||||||
//{
|
//{
|
||||||
// var versionString = app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" :
|
// var versionString = app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" :
|
||||||
// "App NOT Installed";
|
// "App NOT Installed";
|
||||||
|
// if (app.Status == MeterAppState.Unknown)
|
||||||
|
// versionString = "COMMUNICATION ERROR";
|
||||||
// LogText($"AppId: 0x{app.AppId:X2} - {versionString} - " + $"AppName: {app.AppName}");
|
// LogText($"AppId: 0x{app.AppId:X2} - {versionString} - " + $"AppName: {app.AppName}");
|
||||||
|
|
||||||
// if (app.IsInstalled)
|
// if (app.IsInstalled)
|
||||||
|
|||||||
@@ -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>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to ERROR: Cordonel detection failed.
|
/// Looks up a localized string similar to ERROR: Cordonel detection failed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -269,7 +278,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
internal static string StrDataContainerUnknown {
|
internal static string StrDataContainerUnknown {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -227,7 +227,7 @@
|
|||||||
<value>Update capability.</value>
|
<value>Update capability.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrDataContainerUnknown" xml:space="preserve">
|
<data name="StrDataContainerUnknown" xml:space="preserve">
|
||||||
<value>ERROR: Unknown data container received</value>
|
<value>ERROR: Unknown data container received!</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StrFailedToUpdateApp" xml:space="preserve">
|
<data name="StrFailedToUpdateApp" xml:space="preserve">
|
||||||
<value>ERROR: Failed to update application:</value>
|
<value>ERROR: Failed to update application:</value>
|
||||||
@@ -688,4 +688,7 @@
|
|||||||
<data name="StrRegisterRecoveryWarning" xml:space="preserve">
|
<data name="StrRegisterRecoveryWarning" xml:space="preserve">
|
||||||
<value>WARNING: Configuration partially skipped!</value>
|
<value>WARNING: Configuration partially skipped!</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StrCordonelCommunicationFailed" xml:space="preserve">
|
||||||
|
<value>ERROR: Communication problems!</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -142,6 +142,11 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw.Const
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
CheckUpdateCapability,
|
CheckUpdateCapability,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks for communication issues to avoid update on bad communication.
|
||||||
|
/// </summary>
|
||||||
|
CheckCommunication,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks the update files.
|
/// Checks the update files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1063,6 +1063,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
case MeterAppState.MeterAppVersionOutdated:
|
case MeterAppState.MeterAppVersionOutdated:
|
||||||
dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
dataGridRow.DefaultCellStyle = _styleUpdateRequired;
|
||||||
break;
|
break;
|
||||||
|
case MeterAppState.Unknown:
|
||||||
|
dataGridRow.DefaultCellStyle = _styleDownloadFailed;
|
||||||
|
break;
|
||||||
case MeterAppState.MeterAppNotInstalled:
|
case MeterAppState.MeterAppNotInstalled:
|
||||||
dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
dataGridRow.DefaultCellStyle = _styleNotInstalled;
|
||||||
break;
|
break;
|
||||||
@@ -1249,6 +1252,9 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
/// - Exported CheckPackageFileAndFileApps to CheckUpdateRequest to separate capability check from
|
/// - Exported CheckPackageFileAndFileApps to CheckUpdateRequest to separate capability check from
|
||||||
/// applications are up-to-date.
|
/// applications are up-to-date.
|
||||||
/// </remarks>
|
/// </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,
|
private void CheckUpdateCapability(ProcessState successExitState,
|
||||||
ProcessState errorExitState = ProcessState.Error)
|
ProcessState errorExitState = ProcessState.Error)
|
||||||
{
|
{
|
||||||
@@ -1259,6 +1265,13 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
|
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
|
||||||
Thread.CurrentThread.CurrentCulture = _cultureInfo;
|
Thread.CurrentThread.CurrentCulture = _cultureInfo;
|
||||||
|
if (!AllAppsDetected())
|
||||||
|
{
|
||||||
|
_processState = errorExitState;
|
||||||
|
// overwrite the invoker state to create a message
|
||||||
|
_invokerProcessState = ProcessState.CheckCommunication;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!CoreRevisionValid())
|
if (!CoreRevisionValid())
|
||||||
{
|
{
|
||||||
_processState = errorExitState;
|
_processState = errorExitState;
|
||||||
@@ -1293,6 +1306,7 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
InfoProcessSuccess(lblCordonelUpdateCapability, Resources.StrCordonelUpdateCapabilitySucceeded);
|
InfoProcessSuccess(lblCordonelUpdateCapability, Resources.StrCordonelUpdateCapabilitySucceeded);
|
||||||
_processState = successExitState;
|
_processState = successExitState;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
SetControlDownloadEnable();
|
SetControlDownloadEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1447,6 +1461,28 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check that during detection every request returns a valid communication to avoid unpredictable information
|
||||||
|
/// of installed applications, on missing communication the installation status is undefined!
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>true if during app detection every message returns a response</returns>
|
||||||
|
/// <remarks date="2024-Apr-23" author="Thomas Wiedebusch">
|
||||||
|
/// - Initial.
|
||||||
|
/// </remarks>
|
||||||
|
private Boolean AllAppsDetected()
|
||||||
|
{
|
||||||
|
Thread.CurrentThread.CurrentUICulture = _cultureInfo;
|
||||||
|
Thread.CurrentThread.CurrentCulture = _cultureInfo;
|
||||||
|
|
||||||
|
// check the update capability
|
||||||
|
if (_currentGenesis.MeterAppListVersion.All(f => f.Status != MeterAppState.Unknown))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
InfoProcessFailed(lblCordonelUpdateCapability, Resources.StrCordonelCommunicationFailed);
|
||||||
|
_processState = ProcessState.Error;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Region and radio update capability check:
|
/// Region and radio update capability check:
|
||||||
/// - Region (NA, EMEA, China),
|
/// - Region (NA, EMEA, China),
|
||||||
@@ -2268,6 +2304,10 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
{
|
{
|
||||||
var versionString = app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" :
|
var versionString = app.IsInstalled ? $"V: {app.StrVersion} - CRC: 0x{app.Crc:X4}" :
|
||||||
Resources.StrMessageAppNotInstalled;
|
Resources.StrMessageAppNotInstalled;
|
||||||
|
if (app.Status == MeterAppState.Unknown)
|
||||||
|
versionString = Resources.StrCordonelCommunicationFailed;
|
||||||
|
|
||||||
|
|
||||||
LogText($"{Resources.StrTableAppId}: 0x{app.AppId:X2} - {versionString} - " +
|
LogText($"{Resources.StrTableAppId}: 0x{app.AppId:X2} - {versionString} - " +
|
||||||
$"{Resources.StrTableAppName}: {app.AppName}");
|
$"{Resources.StrTableAppName}: {app.AppName}");
|
||||||
|
|
||||||
@@ -2849,6 +2889,11 @@ namespace Xylem.ServiceFwUpdate.Ui.ServiceFwUpdateSw
|
|||||||
// This state will never return with error as the following "Check.." states will be forced
|
// This state will never return with error as the following "Check.." states will be forced
|
||||||
// by the individual update capability checks
|
// by the individual update capability checks
|
||||||
break;
|
break;
|
||||||
|
case ProcessState.CheckCommunication:
|
||||||
|
msg = Resources.StrCordonelCommunicationFailed;
|
||||||
|
ErrorProcessCommon(msg);
|
||||||
|
_processState = ProcessState.PrepareMeterRelease;
|
||||||
|
break;
|
||||||
case ProcessState.CheckCoreRevision:
|
case ProcessState.CheckCoreRevision:
|
||||||
msg = Resources.StrCordonelUpdateCapabilityCoreFailed;
|
msg = Resources.StrCordonelUpdateCapabilityCoreFailed;
|
||||||
ErrorProcessCommon(msg);
|
ErrorProcessCommon(msg);
|
||||||
|
|||||||
@@ -688,4 +688,7 @@
|
|||||||
<data name="StrRegisterRecoveryWarning" xml:space="preserve">
|
<data name="StrRegisterRecoveryWarning" xml:space="preserve">
|
||||||
<value>WARNUNG: Konfiguration unvollständig!</value>
|
<value>WARNUNG: Konfiguration unvollständig!</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StrCordonelCommunicationFailed" xml:space="preserve">
|
||||||
|
<value>FEHLER: Kommunikationsprobleme!</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Reference in New Issue
Block a user