GTB 2.2.2:

FwUpdate can upload entire 0\\config file
This commit is contained in:
Thomas Wiedebusch
2022-04-26 16:32:15 +02:00
parent 7a197a6793
commit e8ec68dee1
18 changed files with 487 additions and 202 deletions
+2 -2
View File
@@ -14,5 +14,5 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.2.1.*")]
[assembly: AssemblyFileVersion("2.2.1.0")]
[assembly: AssemblyVersion("2.2.2.*")]
[assembly: AssemblyFileVersion("2.2.2.0")]
+1
View File
@@ -21,6 +21,7 @@
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="D:\Projekte\SENSUS_tfs_workspaces\WorkBenchV2\Main\Common\Ui\IrdaFunctionalTestApp\bin\Debug\Xylem.Common.Hardware.WaterMeter.Genesis.DataPackages.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String>
<s:String x:Key="/Default/Environment/Hierarchy/Build/SolBuilderDuo/UseMsbuildSolutionBuilder/@EntryValue">NewVersion</s:String>
<s:Boolean x:Key="/Default/Environment/Hierarchy/EntityFrameworkOptions/IsAlreadyNotifiedAboutEntityFramework/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=a44a776d_002Dd671_002D4675_002Dac7b_002Db6775ec7f289/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
&lt;Solution /&gt;&#xD;
@@ -2061,6 +2061,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// - Corrected logic to enter write and read loop,
/// - Removed SENSUSRADIO from read check as it returns NULL on read of StoreConfiguration.
/// </remarks>
/// <remarks date="2022-Apr-26" author="Thomas Wiedebusch">
/// - After write store configuration extended sleep.
/// </remarks>
public Boolean StoreAllConfigurations()
{
var overallResult = true;
@@ -2074,6 +2077,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
while (retryLeft > 0 && !done)
{
Thread.Sleep(100);
var result = WriteRegister(a.Key.GetIdent(), 1);
if (!result)
{
@@ -2085,7 +2089,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
continue;
}
Thread.Sleep(100);
// Wait for storing
Thread.Sleep(500);
if (a.Key.AppName == "SENSUSRADIO")
{
done = true;
@@ -2105,8 +2110,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
done = true;
Thread.Sleep(100);
}
}
@@ -8,58 +8,66 @@
/// <summary>
/// FW Update State Idle
/// </summary>
Idle = 0,
Idle,
/// <summary>
/// FW update single step failed
/// </summary>
StepFailed = 1,
StepFailed,
/// <summary>
/// FW update entire process failed
/// </summary>
UpdateFailed = 2,
UpdateFailed,
/// <summary>
/// Start initial FW update
/// </summary>
StartInitial = 3,
StartInitial,
/// <summary>
/// Repeat FW update
/// </summary>
RepeatFwUpdate = 4,
RepeatFwUpdate,
/// <summary>
/// Upload (partial-) update files
/// </summary>
UploadFileApps = 5,
UploadFileApps,
/// <summary>
/// Download (partial-) update files
/// </summary>
DownloadFileApps = 6,
DownloadFileApps,
/// <summary>
/// Compare (partial-) update files
/// </summary>
CompareFileApps = 7,
CompareFileApps,
/// <summary>
/// Download upgrade control file
/// </summary>
DownloadUpgradeControlFile = 8,
DownloadUpgradeControlFile,
/// <summary>
/// Build upgrade control file
/// </summary>
BuildUpgradeControlFile = 9,
BuildUpgradeControlFile,
/// <summary>
/// Build Update Files
/// </summary>
BuildFileApps = 10,
BuildFileApps,
/// <summary>
/// Trigger Upgrade
/// </summary>
TriggerUpgrade = 11,
TriggerUpgrade,
/// <summary>
/// Erase update file
/// </summary>
EraseUpdateFile = 12,
EraseUpdateFile,
/// <summary>
/// Prepare update, read registers for restorer and store configuration
/// </summary>
PrepareUpdate,
/// <summary>
/// Read configuration file from meter
/// </summary>
UploadConfigFile,
/// <summary>
/// Delimiter for list
/// </summary>
FwUpdateStateListDelimiter = 13
FwUpdateStateListDelimiter
}
}
@@ -20,44 +20,50 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts
static FwUpdateStateInfo()
{
StateInfos = new FwUpdateStateText[(Int32)FwUpdateState.FwUpdateStateListDelimiter];
StateInfos[0].State = FwUpdateState.Idle;
StateInfos[0].Message = Resources.StrFwUpdateStateIdle;
StateInfos[(Int32)FwUpdateState.Idle].State = FwUpdateState.Idle;
StateInfos[(Int32)FwUpdateState.Idle].Message = Resources.StrFwUpdateStateIdle;
StateInfos[1].State = FwUpdateState.StepFailed;
StateInfos[1].Message = Resources.StrFwUpdateStateStepFailed;
StateInfos[(Int32)FwUpdateState.StepFailed].State = FwUpdateState.StepFailed;
StateInfos[(Int32)FwUpdateState.StepFailed].Message = Resources.StrFwUpdateStateStepFailed;
StateInfos[2].State = FwUpdateState.UpdateFailed;
StateInfos[2].Message = Resources.StrFwUpdateStateUpdateFailed;
StateInfos[(Int32)FwUpdateState.UpdateFailed].State = FwUpdateState.UpdateFailed;
StateInfos[(Int32)FwUpdateState.UpdateFailed].Message = Resources.StrFwUpdateStateUpdateFailed;
StateInfos[3].State = FwUpdateState.StartInitial;
StateInfos[3].Message = Resources.StrFwUpdateStateStartInitial;
StateInfos[(Int32)FwUpdateState.StartInitial].State = FwUpdateState.StartInitial;
StateInfos[(Int32)FwUpdateState.StartInitial].Message = Resources.StrFwUpdateStateStartInitial;
StateInfos[4].State = FwUpdateState.RepeatFwUpdate;
StateInfos[4].Message = Resources.StrFwUpdateStateRepeatFwUpdate;
StateInfos[(Int32)FwUpdateState.RepeatFwUpdate].State = FwUpdateState.RepeatFwUpdate;
StateInfos[(Int32)FwUpdateState.RepeatFwUpdate].Message = Resources.StrFwUpdateStateRepeatFwUpdate;
StateInfos[5].State = FwUpdateState.UploadFileApps;
StateInfos[5].Message = Resources.StrFwUpdateStateUploadFileApps;
StateInfos[(Int32)FwUpdateState.UploadFileApps].State = FwUpdateState.UploadFileApps;
StateInfos[(Int32)FwUpdateState.UploadFileApps].Message = Resources.StrFwUpdateStateUploadFileApps;
StateInfos[6].State = FwUpdateState.DownloadFileApps;
StateInfos[6].Message = Resources.StrFwUpdateStateDownloadFileApps;
StateInfos[(Int32)FwUpdateState.DownloadFileApps].State = FwUpdateState.DownloadFileApps;
StateInfos[(Int32)FwUpdateState.DownloadFileApps].Message = Resources.StrFwUpdateStateDownloadFileApps;
StateInfos[7].State = FwUpdateState.CompareFileApps;
StateInfos[7].Message = Resources.StrFwUpdateStateCompareFileApps;
StateInfos[(Int32)FwUpdateState.CompareFileApps].State = FwUpdateState.CompareFileApps;
StateInfos[(Int32)FwUpdateState.CompareFileApps].Message = Resources.StrFwUpdateStateCompareFileApps;
StateInfos[8].State = FwUpdateState.DownloadUpgradeControlFile;
StateInfos[8].Message = Resources.StrFwUpdateStateDownloadUpgradeControlFile;
StateInfos[(Int32)FwUpdateState.DownloadUpgradeControlFile].State = FwUpdateState.DownloadUpgradeControlFile;
StateInfos[(Int32)FwUpdateState.DownloadUpgradeControlFile].Message = Resources.StrFwUpdateStateDownloadUpgradeControlFile;
StateInfos[9].State = FwUpdateState.BuildUpgradeControlFile;
StateInfos[9].Message = Resources.StrFwUpdateStateBuildUpgradeControlFile;
StateInfos[(Int32)FwUpdateState.BuildUpgradeControlFile].State = FwUpdateState.BuildUpgradeControlFile;
StateInfos[(Int32)FwUpdateState.BuildUpgradeControlFile].Message = Resources.StrFwUpdateStateBuildUpgradeControlFile;
StateInfos[10].State = FwUpdateState.BuildFileApps;
StateInfos[10].Message = Resources.StrFwUpdateStateBuildFileApps;
StateInfos[(Int32)FwUpdateState.BuildFileApps].State = FwUpdateState.BuildFileApps;
StateInfos[(Int32)FwUpdateState.BuildFileApps].Message = Resources.StrFwUpdateStateBuildFileApps;
StateInfos[11].State = FwUpdateState.TriggerUpgrade;
StateInfos[11].Message = Resources.StrFwUpdateStateTriggerUpgrade;
StateInfos[(Int32)FwUpdateState.TriggerUpgrade].State = FwUpdateState.TriggerUpgrade;
StateInfos[(Int32)FwUpdateState.TriggerUpgrade].Message = Resources.StrFwUpdateStateTriggerUpgrade;
StateInfos[12].State = FwUpdateState.EraseUpdateFile;
StateInfos[12].Message = Resources.StrFwUpdateStateEraseUpdateFile;
StateInfos[(Int32)FwUpdateState.EraseUpdateFile].State = FwUpdateState.EraseUpdateFile;
StateInfos[(Int32)FwUpdateState.EraseUpdateFile].Message = Resources.StrFwUpdateStateEraseUpdateFile;
StateInfos[(Int32)FwUpdateState.PrepareUpdate].State = FwUpdateState.PrepareUpdate;
StateInfos[(Int32)FwUpdateState.PrepareUpdate].Message = Resources.StrFwUpdateStatePrepareUpdate;
StateInfos[(Int32)FwUpdateState.UploadConfigFile].State = FwUpdateState.UploadConfigFile;
StateInfos[(Int32)FwUpdateState.UploadConfigFile].Message = Resources.StrUploadConfigFile;
}
/// <summary>
@@ -67,7 +73,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts
public static String GetTextFromState(FwUpdateState state)
{
return (from stateInfo in StateInfos
where stateInfo.State == state select stateInfo.Message).FirstOrDefault();
where stateInfo.State == state
select stateInfo.Message).FirstOrDefault();
}
/// <summary>
/// Get the state of the text
@@ -76,7 +83,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts
public static FwUpdateState GetStateFromText(String text)
{
return (from stateInfo in StateInfos
where stateInfo.Message == text select stateInfo.State).FirstOrDefault();
where stateInfo.Message == text
select stateInfo.State).FirstOrDefault();
}
}
}
@@ -102,6 +102,7 @@
<Compile Include="Consts\FwUpdateState.cs" />
<Compile Include="Consts\FwUpdateStateInfo.cs" />
<Compile Include="Consts\FwUpdateStateText.cs" />
<Compile Include="MeterConfigFile.cs" />
<Compile Include="MeterLutFile.cs" />
<Compile Include="MeterFileRestore.cs" />
<Compile Include="MeterFilesEraseRestore.cs" />
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using Logic.ProductionToProductMapper.Cordonel;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
/// <summary>
/// File for meter configuration
/// </summary>
public class MeterConfigFile
{
/// <summary>
/// Data length
/// </summary>
public UInt32 DataLength;
/// <summary>
/// Binary file content
/// </summary>
public List<Byte> BinData = new List<Byte>();
}
}
@@ -25,11 +25,17 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
#region Variables
// Look up table file
public MeterConfigFile ConfigFile;
/// <summary>
/// Port scan result event for message dispatcher to caller
/// </summary>
public event EventHandler<ProcessExecEventArgs> OnProcessUpdate;
//disk and name of config file
private const String StrConfigMeterFileName = "0\\config";
//name for upgrade control file
private const String StrUpgradeCtrlFileName = "1\\upgrade";
@@ -94,11 +100,17 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <summary>
/// Core revision minimum as double for comparison
/// </summary>
public Double? CoreRevisionMinimum { get; private set; }
public Double? CoreRevisionMinimum
{
get; private set;
}
/// <summary>
/// Core revision maximum as double for comparison
/// </summary>
public Double? CoreRevisionMaximum { get; private set; }
public Double? CoreRevisionMaximum
{
get; private set;
}
//reminder for the core minimum requirement as string
private String _strCoreRevisionMinimum;
@@ -161,6 +173,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// </summary>
public Boolean SingleFilePartsRetryEnable = true;
/// <summary>
/// Store configuration in advance to the update
/// </summary>
public Boolean StoreConfigEnable = true;
/// <summary>
/// Enable partial file writes from first failed part to the end
/// </summary>
@@ -701,6 +718,59 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
}
}
/// <summary>
/// Upload the config file from meter
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Apr-26" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean UploadConfigFile()
{
//counters for actual process information
var retryCtr = 0;
ConfigFile = new MeterConfigFile();
_processedBytesCtr = 0;
_overallBytesCtr = 6;
_meterFile = new MeterFile(_genesisMeter);
if (_meterFile != null)
{
_meterFile.OnProcessUpdate += ProcessUpdate_Event;
}
_genesisMeter?.ReLogin();
_genesisMeter?.SetProcessState(DisplayCodes.FwUpdateActive, false);
if (_genesisMeter == null || !_genesisMeter.IsLoggedOn || _meterFile == null)
return false;
var returnValue = true;
//write LUT files and retry if not successful
do
{
_actualOperation = Resources.StrUploadConfigFile;
// logout and re-login to clear all ongoing processes and clear the Genesis buffers
ReestablishMeterFileSystem();
if (!_meterFile.ReadMeterFile(StrConfigMeterFileName, out ConfigFile.BinData, 5000))
{
returnValue = false;
}
if (!returnValue)
{
ReestablishMeterFileSystem();
}
} while (!returnValue && retryCtr++ < FileWriteRetries && !StopUpdateProcess);
_meterFile.OnProcessUpdate -= ProcessUpdate_Event;
return !StopUpdateProcess && returnValue;
}
/// <summary>
/// Update meter firmware
/// </summary>
@@ -960,10 +1030,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Apr-21" author="Thomas Wiedebusch">
/// - Store all configurations before the update.
/// </remarks>
/// <remarks date="2022-Apr-26" author="Thomas Wiedebusch">
/// - Message for actual operation,
/// - PrepareUpdate state introduced.
/// </remarks>
public Boolean UpdatePreparation()
{
_actualOperation = "";
_fwUpdateState = FwUpdateState.Idle;
_actualOperation = Resources.StrFwUpdateStatePrepareUpdate;
_fwUpdateState = FwUpdateState.PrepareUpdate;
_processedBytesCtr = 0;
_overallBytesCtr = 6;
_meterFile = new MeterFile(_genesisMeter);
if (_meterFile != null)
@@ -990,10 +1066,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
var writeBackValue = _genesisMeter.ReadRegister(item.Key);
_registersAfterUpdate.Add(item.Key, writeBackValue);
_genesisMeter.WriteRegister(item.Key, item.Value);
_processedBytesCtr++;
}
if (StoreConfigEnable)
{
//store all configuration parameters
if (!_genesisMeter.StoreAllConfigurations()) return false;
_actualOperation = Resources.StrStoreConfigurations;
if (!_genesisMeter.StoreAllConfigurations())
return false;
}
//remove the update stop action
StopUpdateProcess = false;
@@ -1075,6 +1157,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
/// - Introduced lock for repeated execution of state machine
/// </remarks>
/// <remarks date="2022-Apr-26" author="Thomas Wiedebusch">
/// - Prepare update added,
/// - Upload config file added.
/// </remarks>
private void FwUpdateStateMachine()
{
if (_fwBackupUpdateState == _fwUpdateState)
@@ -1090,6 +1176,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
case FwUpdateState.Idle:
break;
case FwUpdateState.UploadConfigFile:
_fwUpdateState = UploadConfigFile()
? FwUpdateState.Idle
: FwUpdateState.StepFailed;
break;
case FwUpdateState.StartInitial:
_updateProcedureRetryCtr = 0;
_fwUpdateState = FwUpdateState.BuildFileApps;
@@ -1164,6 +1256,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
case FwUpdateState.UploadFileApps:
break;
case FwUpdateState.PrepareUpdate:
break;
case FwUpdateState.CompareFileApps:
break;
@@ -901,7 +901,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
_genesisMeter.TransmitProtocol.SetResponseTimeout(1000);
var returnValue = true;
//write LUT files and retry if not successful
//verify LUT files and retry if not successful
do
{
var filesToUpload = new[] { StrLutMeterFileName, StrLutBackupMeterFileName };
@@ -123,6 +123,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Prepare update.
/// </summary>
public static string StrFwUpdateStatePrepareUpdate {
get {
return ResourceManager.GetString("StrFwUpdateStatePrepareUpdate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Repeat FW Update.
/// </summary>
@@ -222,6 +231,24 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Store configurations.
/// </summary>
public static string StrStoreConfigurations {
get {
return ResourceManager.GetString("StrStoreConfigurations", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Upload configuration file.
/// </summary>
public static string StrUploadConfigFile {
get {
return ResourceManager.GetString("StrUploadConfigFile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Waiting.....
/// </summary>
@@ -174,4 +174,13 @@
<data name="StrProcessDownload" xml:space="preserve">
<value>Einspielen </value>
</data>
<data name="StrFwUpdateStatePrepareUpdate" xml:space="preserve">
<value>Update Vorbereitung</value>
</data>
<data name="StrStoreConfigurations" xml:space="preserve">
<value>Sichere Einstellungen</value>
</data>
<data name="StrUploadConfigFile" xml:space="preserve">
<value>Lade Einstellungen</value>
</data>
</root>
@@ -174,4 +174,13 @@
<data name="StrProcessDownload" xml:space="preserve">
<value>Download</value>
</data>
<data name="StrFwUpdateStatePrepareUpdate" xml:space="preserve">
<value>Prepare update</value>
</data>
<data name="StrStoreConfigurations" xml:space="preserve">
<value>Store configurations</value>
</data>
<data name="StrUploadConfigFile" xml:space="preserve">
<value>Upload configuration file</value>
</data>
</root>
-23
View File
@@ -21,29 +21,6 @@
<appSettings>
<add key="AdminName" value="My Name" />
<add key="AdminEMail" value="MyEMailAddress" />
<add key="GenesisGetOrderNumberServiceUrl" value="http://sla12iis01/MeterProcessState/api/Password/ordernumber?PcbId=" />
<add key="GenesisGetRadioAdressServiceUrl" value="http://sla12iis01/MeterProcessState/api/Password/radioadress?PcbId=" />
<add key="GenesisGetKeySetIdServiceUrl" value="http://sla12iis01/MeterProcessState/api/Password/getkeysetid?PcbId=" />
<add key="GenesisGetPasswordServiceUrl" value="http://sla12iis01/MeterProcessState/api/Password/GetPassword?PcbId=" />
<add key="GenesisSetPasswordServiceUrl" value="http://sla12iis01/MeterProcessState/api/Password/setpassword?PcbId=" />
<add key="GenesisPasswordContainerServiceUrl" value="http://sla12iis01/MeterProcessState/api/Password/GetPasswordHashFileContent?PcbId=" />
<add key="MarriageServiceUrl" value="http://sla12iis01/MeterProcessState/api/Marriage/" />
<add key="MeterProcessStateUrl" value="http://sla12iis01/MeterProcessState/api/ProccesState/" />
<add key="GenesisFinalCheckServiceUrl" value="http://sla12iis01/MeterProcessState/api/FinalCheck/" />
<add key="GenesisRadioCheckServiceUrl" value="http://sla12iis01/MeterProcessState/api/RadioCheck/" />
<add key="GetSoftwareStartUpAccessUrl" value="http://sla12iis01/MeterProcessState/api/SoftwareAccess/GetVersionIsValid" />
<!--<add key="GenesisGetOrderNumberServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Password/ordernumber?PcbId=" />
<add key="GenesisGetRadioAdressServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Password/radioadress?PcbId=" />
<add key="GenesisGetKeySetIdServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Password/getkeysetid?PcbId=" />
<add key="GenesisGetPasswordServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Password/GetPassword?PcbId=" />
<add key="GenesisSetPasswordServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Password/setpassword?PcbId=" />
<add key="GenesisPasswordContainerServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Password/GetPasswordHashFileContent?PcbId=" />
<add key="MarriageServiceUrl" value="http://10.49.40.25/MeterProcessState/api/Marriage/" />
<add key="MeterProcessStateUrl" value="http://10.49.40.25/MeterProcessState/api/ProccesState/" />
<add key="GenesisFinalCheckServiceUrl" value="http://10.49.40.25/MeterProcessState/api/FinalCheck/" />
<add key="GenesisRadioCheckServiceUrl" value="http://10.49.40.25/MeterProcessState/api/RadioCheck/" />
<add key="GetSoftwareStartUpAccessUrl" value="http://10.49.40.25/MeterProcessState/api/SoftwareAccess/GetVersionIsValid" />-->
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+75 -32
View File
@@ -37,8 +37,10 @@
this.label2 = new System.Windows.Forms.Label();
this.cbComSlot = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.btnUploadConfig = new System.Windows.Forms.Button();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.btnClearDisplay = new System.Windows.Forms.Button();
this.lblUpdateTime = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.lblWaitingForMeterResponse = new System.Windows.Forms.Label();
@@ -63,6 +65,7 @@
this.lblActualProcess = new System.Windows.Forms.Label();
this.barOverallProgressUpdate = new System.Windows.Forms.ProgressBar();
this.gridViewApplic = new System.Windows.Forms.DataGridView();
this.cbxStoreConfigEnable = new System.Windows.Forms.CheckBox();
this.gbxSetup = new System.Windows.Forms.GroupBox();
this.cbxConsecutiveFilePartsRetryEnable = new System.Windows.Forms.CheckBox();
this.label6 = new System.Windows.Forms.Label();
@@ -76,7 +79,6 @@
this.lblFwUpdateInfo = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.tabFwSources = new System.Windows.Forms.TabControl();
this.tabLocalFile = new System.Windows.Forms.TabPage();
this.groupBox1 = new System.Windows.Forms.GroupBox();
@@ -106,8 +108,10 @@
this.label11 = new System.Windows.Forms.Label();
this.cbxFilterFWType = new System.Windows.Forms.ComboBox();
this.chbFilterIsDeveloper = new System.Windows.Forms.CheckBox();
this.saveConfigFile = new System.Windows.Forms.SaveFileDialog();
this.grpSetup.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox4.SuspendLayout();
this.gbxManualTimingControl.SuspendLayout();
this.gbxManualTriggerControl.SuspendLayout();
@@ -220,6 +224,7 @@
//
// groupBox2
//
this.groupBox2.Controls.Add(this.groupBox5);
this.groupBox2.Controls.Add(this.groupBox4);
this.groupBox2.Controls.Add(this.lblUpdateTime);
this.groupBox2.Controls.Add(this.label9);
@@ -243,25 +248,45 @@
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Applications ";
//
// groupBox5
//
this.groupBox5.Controls.Add(this.btnUploadConfig);
this.groupBox5.Location = new System.Drawing.Point(944, 308);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(128, 50);
this.groupBox5.TabIndex = 22;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Configuration File";
//
// btnUploadConfig
//
this.btnUploadConfig.Location = new System.Drawing.Point(6, 19);
this.btnUploadConfig.Name = "btnUploadConfig";
this.btnUploadConfig.Size = new System.Drawing.Size(116, 25);
this.btnUploadConfig.TabIndex = 11;
this.btnUploadConfig.Text = "Upload Config";
this.btnUploadConfig.UseVisualStyleBackColor = true;
this.btnUploadConfig.Click += new System.EventHandler(this.btnUploadConfig_Click);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.button1);
this.groupBox4.Location = new System.Drawing.Point(950, 414);
this.groupBox4.Controls.Add(this.btnClearDisplay);
this.groupBox4.Location = new System.Drawing.Point(946, 413);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(126, 49);
this.groupBox4.TabIndex = 21;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Display";
//
// button1
// btnClearDisplay
//
this.button1.Location = new System.Drawing.Point(5, 19);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(116, 25);
this.button1.TabIndex = 0;
this.button1.Text = "Clear Display";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.btnClearDisplay.Location = new System.Drawing.Point(5, 19);
this.btnClearDisplay.Name = "btnClearDisplay";
this.btnClearDisplay.Size = new System.Drawing.Size(116, 25);
this.btnClearDisplay.TabIndex = 0;
this.btnClearDisplay.Text = "Clear Display";
this.btnClearDisplay.UseVisualStyleBackColor = true;
this.btnClearDisplay.Click += new System.EventHandler(this.btnClearDisplay_Click);
//
// lblUpdateTime
//
@@ -296,7 +321,7 @@
this.gbxManualTimingControl.Controls.Add(this.label8);
this.gbxManualTimingControl.Controls.Add(this.cbAddRetryTimeout);
this.gbxManualTimingControl.Controls.Add(this.label7);
this.gbxManualTimingControl.Location = new System.Drawing.Point(944, 238);
this.gbxManualTimingControl.Location = new System.Drawing.Point(944, 235);
this.gbxManualTimingControl.Name = "gbxManualTimingControl";
this.gbxManualTimingControl.Size = new System.Drawing.Size(128, 69);
this.gbxManualTimingControl.TabIndex = 17;
@@ -365,7 +390,7 @@
//
this.gbxManualTriggerControl.Controls.Add(this.btnTriggerUpdate);
this.gbxManualTriggerControl.Controls.Add(this.btnPrepareTrigger);
this.gbxManualTriggerControl.Location = new System.Drawing.Point(944, 150);
this.gbxManualTriggerControl.Location = new System.Drawing.Point(944, 147);
this.gbxManualTriggerControl.Name = "gbxManualTriggerControl";
this.gbxManualTriggerControl.Size = new System.Drawing.Size(128, 88);
this.gbxManualTriggerControl.TabIndex = 16;
@@ -395,7 +420,7 @@
// gbxManualUploadAndVerification
//
this.gbxManualUploadAndVerification.Controls.Add(this.btnVerifyFiles);
this.gbxManualUploadAndVerification.Location = new System.Drawing.Point(944, 100);
this.gbxManualUploadAndVerification.Location = new System.Drawing.Point(944, 95);
this.gbxManualUploadAndVerification.Name = "gbxManualUploadAndVerification";
this.gbxManualUploadAndVerification.Size = new System.Drawing.Size(128, 50);
this.gbxManualUploadAndVerification.TabIndex = 15;
@@ -416,7 +441,7 @@
//
this.gbxManualDownload.Controls.Add(this.btnRetryFileParts);
this.gbxManualDownload.Controls.Add(this.btnDownloadFiles);
this.gbxManualDownload.Location = new System.Drawing.Point(944, 19);
this.gbxManualDownload.Location = new System.Drawing.Point(944, 13);
this.gbxManualDownload.Name = "gbxManualDownload";
this.gbxManualDownload.Size = new System.Drawing.Size(128, 81);
this.gbxManualDownload.TabIndex = 13;
@@ -446,7 +471,7 @@
// groupBox3
//
this.groupBox3.Controls.Add(this.btnUpdateFw);
this.groupBox3.Location = new System.Drawing.Point(949, 358);
this.groupBox3.Location = new System.Drawing.Point(945, 358);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(126, 49);
this.groupBox3.TabIndex = 12;
@@ -513,17 +538,31 @@
this.gridViewApplic.TabIndex = 2;
this.gridViewApplic.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.gridViewApplic_CellClick);
//
// cbxStoreConfigEnable
//
this.cbxStoreConfigEnable.AutoSize = true;
this.cbxStoreConfigEnable.Checked = true;
this.cbxStoreConfigEnable.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbxStoreConfigEnable.Location = new System.Drawing.Point(6, 22);
this.cbxStoreConfigEnable.Name = "cbxStoreConfigEnable";
this.cbxStoreConfigEnable.Size = new System.Drawing.Size(121, 17);
this.cbxStoreConfigEnable.TabIndex = 22;
this.cbxStoreConfigEnable.Text = "Store Configurations";
this.cbxStoreConfigEnable.UseVisualStyleBackColor = true;
this.cbxStoreConfigEnable.CheckedChanged += new System.EventHandler(this.cbxStoreConfigEnable_CheckedChanged);
//
// gbxSetup
//
this.gbxSetup.Controls.Add(this.cbxStoreConfigEnable);
this.gbxSetup.Controls.Add(this.cbxConsecutiveFilePartsRetryEnable);
this.gbxSetup.Controls.Add(this.label6);
this.gbxSetup.Controls.Add(this.label5);
this.gbxSetup.Controls.Add(this.cbFilePartSize);
this.gbxSetup.Controls.Add(this.cbxSingleFilePartsRetryEnable);
this.gbxSetup.Controls.Add(this.cbxManualControl);
this.gbxSetup.Location = new System.Drawing.Point(915, 90);
this.gbxSetup.Location = new System.Drawing.Point(924, 59);
this.gbxSetup.Name = "gbxSetup";
this.gbxSetup.Size = new System.Drawing.Size(165, 119);
this.gbxSetup.Size = new System.Drawing.Size(165, 150);
this.gbxSetup.TabIndex = 20;
this.gbxSetup.TabStop = false;
this.gbxSetup.Text = "Setup";
@@ -531,7 +570,7 @@
// cbxConsecutiveFilePartsRetryEnable
//
this.cbxConsecutiveFilePartsRetryEnable.AutoSize = true;
this.cbxConsecutiveFilePartsRetryEnable.Location = new System.Drawing.Point(6, 69);
this.cbxConsecutiveFilePartsRetryEnable.Location = new System.Drawing.Point(6, 97);
this.cbxConsecutiveFilePartsRetryEnable.Name = "cbxConsecutiveFilePartsRetryEnable";
this.cbxConsecutiveFilePartsRetryEnable.Size = new System.Drawing.Size(159, 17);
this.cbxConsecutiveFilePartsRetryEnable.TabIndex = 23;
@@ -542,7 +581,7 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(127, 93);
this.label6.Location = new System.Drawing.Point(127, 121);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(26, 13);
this.label6.TabIndex = 22;
@@ -551,7 +590,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(3, 95);
this.label5.Location = new System.Drawing.Point(3, 123);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(73, 13);
this.label5.TabIndex = 21;
@@ -568,7 +607,7 @@
"16",
"32",
"64"});
this.cbFilePartSize.Location = new System.Drawing.Point(82, 91);
this.cbFilePartSize.Location = new System.Drawing.Point(82, 119);
this.cbFilePartSize.Name = "cbFilePartSize";
this.cbFilePartSize.Size = new System.Drawing.Size(44, 21);
this.cbFilePartSize.TabIndex = 20;
@@ -579,7 +618,7 @@
this.cbxSingleFilePartsRetryEnable.AutoSize = true;
this.cbxSingleFilePartsRetryEnable.Checked = true;
this.cbxSingleFilePartsRetryEnable.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbxSingleFilePartsRetryEnable.Location = new System.Drawing.Point(6, 44);
this.cbxSingleFilePartsRetryEnable.Location = new System.Drawing.Point(6, 72);
this.cbxSingleFilePartsRetryEnable.Name = "cbxSingleFilePartsRetryEnable";
this.cbxSingleFilePartsRetryEnable.Size = new System.Drawing.Size(129, 17);
this.cbxSingleFilePartsRetryEnable.TabIndex = 19;
@@ -590,7 +629,7 @@
// cbxManualControl
//
this.cbxManualControl.AutoSize = true;
this.cbxManualControl.Location = new System.Drawing.Point(6, 19);
this.cbxManualControl.Location = new System.Drawing.Point(6, 47);
this.cbxManualControl.Name = "cbxManualControl";
this.cbxManualControl.Size = new System.Drawing.Size(135, 17);
this.cbxManualControl.TabIndex = 18;
@@ -630,16 +669,12 @@
// pictureBox1
//
this.pictureBox1.Image = global::Xylem.Common.Ui.GenesisToolBox.Properties.Resources.SensusLogoXylem;
this.pictureBox1.Location = new System.Drawing.Point(978, 30);
this.pictureBox1.Location = new System.Drawing.Point(986, 4);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(102, 54);
this.pictureBox1.TabIndex = 29;
this.pictureBox1.TabStop = false;
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// tabFwSources
//
this.tabFwSources.Controls.Add(this.tabLocalFile);
@@ -940,6 +975,10 @@
this.chbFilterIsDeveloper.Text = "For Developer";
this.chbFilterIsDeveloper.UseVisualStyleBackColor = true;
//
// saveConfigFile
//
this.saveConfigFile.Filter = "configuration file (*.hex)|*.hex";
//
// FrmFwUpdate
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Sound;
@@ -961,6 +1000,7 @@
this.grpSetup.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox5.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.gbxManualTimingControl.ResumeLayout(false);
this.gbxManualTimingControl.PerformLayout();
@@ -1028,7 +1068,6 @@
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox cbAddRetryTimeout;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Label lblWaitingForMeterResponse;
private System.Windows.Forms.Label lblCoreRevision;
private System.Windows.Forms.Label lblUpdateTime;
@@ -1062,8 +1101,12 @@
private System.Windows.Forms.Label label12;
private System.Windows.Forms.DataGridView dgvFiles;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnClearDisplay;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Button btnFixBat;
private System.Windows.Forms.CheckBox cbxStoreConfigEnable;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.Button btnUploadConfig;
private System.Windows.Forms.SaveFileDialog saveConfigFile;
}
}
+148 -66
View File
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
@@ -76,9 +77,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
private DateTimeOffset _startTime;
private Boolean _resetTimeMeasurement;
private static String DefaultBinaryPath
{
get => Settings.Default.InitialBinaryPath;
@@ -119,13 +117,16 @@ namespace Xylem.Common.Ui.GenesisToolBox
"This is a stepwise update, proceed until update is completed!\n";
private const String StrUpdateErrorMessage =
"FW UPDATE FAILED!\n\n";
private FwSource _fwSource = FwSource.File;
private enum FwSource
{
File,
// Production,
// Production,
Db
}
private FwSource _fwSource = FwSource.File;
#endregion
#region FormControls
/// <summary>
@@ -154,14 +155,18 @@ namespace Xylem.Common.Ui.GenesisToolBox
btnStopFwUpdate.ForeColor = Color.Red;
SetControlDownloadsLocked();
btnStopFwUpdate.Enabled = false;
btnOpenUpdateDirectory.Enabled = true;
btnOpenPackageControlFile.Enabled = true;
btnOpenUpdateDirectory.Enabled = false;
btnOpenPackageControlFile.Enabled = false;
btnFixBat.Enabled = false;
btnUploadConfig.Enabled = false;
btnClearDisplay.Enabled = false;
cbFilePartSize.Enabled = true;
CheckManualControl();
if (_meterFwUpdate != null)
{
_meterFwUpdate.SingleFilePartsRetryEnable = cbxSingleFilePartsRetryEnable.Checked;
_meterFwUpdate.ConsecutiveFilePartsRetryEnable = cbxConsecutiveFilePartsRetryEnable.Checked;
_meterFwUpdate.StoreConfigEnable = cbxStoreConfigEnable.Checked;
}
_dataTable.Rows.Clear();
@@ -342,7 +347,8 @@ namespace Xylem.Common.Ui.GenesisToolBox
/// </summary>
private void UpdateInformationStyleSet()
{
if (_meterFwUpdate == null) return;
if (_meterFwUpdate == null)
return;
foreach (DataGridViewRow dataGridRow in gridViewApplic.Rows)
{
var testString = dataGridRow.Cells[StrStatus].Value.ToString();
@@ -560,6 +566,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
btnPrepareTrigger.Enabled = true;
btnTriggerUpdate.Enabled = true;
btnFixBat.Enabled = true;
btnClearDisplay.Enabled = true;
btnUploadConfig.Enabled = true;
}
private void SetControlDownloadsLocked()
@@ -594,6 +603,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
btnPrepareTrigger.Enabled = false;
btnTriggerUpdate.Enabled = false;
btnFixBat.Enabled = false;
btnClearDisplay.Enabled = false;
btnUploadConfig.Enabled = false;
}
private void SetControlsDownloadIsFinished()
@@ -618,6 +630,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
btnPrepareTrigger.Enabled = true;
btnTriggerUpdate.Enabled = true;
btnFixBat.Enabled = true;
btnClearDisplay.Enabled = true;
btnUploadConfig.Enabled = true;
}
#endregion
#region BoardControls
@@ -660,10 +675,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
try
{
Init();
Int32 slotNr;
if (string.IsNullOrEmpty(cbComSlot.SelectedItem.ToString()) ||
!int.TryParse(cbComSlot.SelectedItem.ToString(), out slotNr))
!int.TryParse(cbComSlot.SelectedItem.ToString(), out var slotNr))
{
return;
}
@@ -715,7 +729,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
CheckUpdateEnabled();
_currentGenesis.Logout();
}));
}).ContinueWith(delegate { ViewProgressPcb(false); });
}).ContinueWith(delegate
{
ViewProgressPcb(false);
});
}
catch (Exception ex)
{
@@ -836,6 +853,26 @@ namespace Xylem.Common.Ui.GenesisToolBox
}));
}
}
private void UploadFileControl(Boolean isActive)
{
if (isActive)
{
Invoke(new Action(() =>
{
_lastFwUpdateState = "";
ProcessViewControl(true);
tmrProgressUpdate.Enabled = true;
}));
}
else
{
Invoke(new Action(() =>
{
ProcessViewControl(false);
SetControlsDownloadIsFinished();
}));
}
}
private void DownloadFilesControl(Boolean isActive)
{
@@ -935,6 +972,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
}
private void VerifyFilesControl(Boolean isActive)
{
if (isActive)
@@ -1000,9 +1038,25 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
private Boolean CheckUpdateEnabled()
{
// enable file load and fix battery only if device is connected
if (_currentGenesis != null)
{
btnOpenUpdateDirectory.Enabled = true;
btnOpenPackageControlFile.Enabled = true;
btnFixBat.Enabled = true;
btnClearDisplay.Enabled = true;
btnUploadConfig.Enabled = true;
SetControlDownloadsUnlocked();
return true;
}
else
{
btnOpenUpdateDirectory.Enabled = false;
btnOpenPackageControlFile.Enabled = false;
btnFixBat.Enabled = false;
btnClearDisplay.Enabled = false;
btnUploadConfig.Enabled = false;
}
//this check has been placed here to force display update
if (_meterFwUpdate != null && _currentGenesis != null &&
@@ -1013,12 +1067,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
SetControlDownloadsUnlocked();
return true;
}
else
{
SetControlDownloadsLocked();
return false;
}
}
private Boolean CheckRetryPossible()
{
@@ -1272,7 +1324,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_fileAppsSuccessfulWritten = _meterFwUpdate.ManualVerifyFiles();
Thread.Sleep(1000);
}).ContinueWith(delegate { VerifyFilesControl(false); });
}).ContinueWith(delegate
{
VerifyFilesControl(false);
});
}
@@ -1313,7 +1368,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_fileAppsSuccessfulWritten = _meterFwUpdate.ManualDownloadAllFileApps();
Thread.Sleep(1000);
}).ContinueWith(delegate { DownloadFilesControl(false); });
}).ContinueWith(delegate
{
DownloadFilesControl(false);
});
}
@@ -1336,7 +1394,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_fileAppsSuccessfulWritten = _meterFwUpdate.ManualDownloadRemainingFileAppsParts();
Thread.Sleep(1000);
}).ContinueWith(delegate { DownloadFilesControl(false); });
}).ContinueWith(delegate
{
DownloadFilesControl(false);
});
}
/// <summary>
@@ -1374,7 +1435,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_fileAppsSuccessfulWritten = _meterFwUpdate.ManualTriggerUpgrade();
Thread.Sleep(1000);
}).ContinueWith(delegate { TriggerUpdateControl(false); });
}).ContinueWith(delegate
{
TriggerUpdateControl(false);
});
}
@@ -1416,7 +1480,10 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
_fileAppsSuccessfulWritten = _meterFwUpdate.UpdateMeterFw();
Thread.Sleep(1000);
}).ContinueWith(delegate { AutomaticUpdateControl(false); });
}).ContinueWith(delegate
{
AutomaticUpdateControl(false);
});
}
private void btnStopFwUpdate_Click(Object sender, EventArgs e)
@@ -1571,17 +1638,11 @@ namespace Xylem.Common.Ui.GenesisToolBox
return true;
}
else
{
return false;
}
}
public void StartUpdate()
{
}
public MsgEventargs LastMsgEvent;
public class MsgEventargs : EventArgs
@@ -1608,7 +1669,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
#endregion
#region User Controls
private void tabDb_Click(Object sender, EventArgs e)
{
@@ -1618,15 +1679,15 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
if (tabFwSources.SelectedTab == tabLocalFile)
{
checkSelectionChanged(FwSource.File);
CheckSelectionChanged(FwSource.File);
}
else if (tabFwSources.SelectedTab == tabProduction)
{
checkSelectionChanged(FwSource.File);
CheckSelectionChanged(FwSource.File);
}
else if (tabFwSources.SelectedTab == tabDb)
{
checkSelectionChanged(FwSource.Db);
CheckSelectionChanged(FwSource.Db);
cbxFilterFwDn.Items.Add("ALL");
@@ -1650,20 +1711,21 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
else
{
MessageBox.Show("No Tab selected!");
MessageBox.Show(@"No Tab selected!");
}
//tabFwSources.SelectedTab = tabLocalFile;
}
private void checkSelectionChanged(FwSource newMode)
private void CheckSelectionChanged(FwSource newSource)
{
if (newMode == _fwSource)
// ReSharper disable once RedundantCheckBeforeAssignment
if (newSource == _fwSource)
{
return;
}
_fwSource = newMode;
_fwSource = newSource;
}
private void PushFwFile(MeterFwUpdate meterFwUpdate)
@@ -1688,19 +1750,19 @@ namespace Xylem.Common.Ui.GenesisToolBox
private void btnGetFWFiles_Click(Object sender, EventArgs e)
{
var IsDevloper = chbFilterIsDeveloper.Checked;
var isDeveloper = chbFilterIsDeveloper.Checked;
var url = $"http://sla12iis01/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly={IsDevloper}";
var url = $"http://sla12iis01/MeterProcessState/api/FileUpToDate/GetFwFiles?FileIsForDeveloperOnly={isDeveloper}";
if (cbxFilterFwDn.SelectedItem.ToString() != "ALL")
{
var MyMeterSize = ((MeterSize)cbxFilterFwDn.SelectedItem).GetHashCode();
url = url + $"&CordonelFwFile_Dn={MyMeterSize}";
var myMeterSize = ((MeterSize)cbxFilterFwDn.SelectedItem).GetHashCode();
url = url + $"&CordonelFwFile_Dn={myMeterSize}";
}
if (cbxFilterFWType.SelectedItem.ToString() != "ALL")
{
var FWTypeEnum = ((CordonelFWTypeEnum)cbxFilterFWType.SelectedItem).GetHashCode();
url = url + $"&CordonelFwFile_Type={FWTypeEnum}";
var fwTypeEnum = ((CordonelFWTypeEnum)cbxFilterFWType.SelectedItem).GetHashCode();
url = url + $"&CordonelFwFile_Type={fwTypeEnum}";
}
url = url + $"&FileCategoryID=1";
@@ -1751,14 +1813,14 @@ namespace Xylem.Common.Ui.GenesisToolBox
else if (item.FileName.ToLower().EndsWith(".txt"))
{
//encode content
String ControlFileContent = "";
String controlFileContent;
System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
ControlFileContent = enc.GetString(item.FileContent.ToArray());
controlFileContent = enc.GetString(item.FileContent.ToArray());
_meterFwUpdate.LoadPackageFileFromText(ControlFileContent);
_meterFwUpdate.LoadPackageFileFromText(controlFileContent);
}
}
@@ -1772,15 +1834,13 @@ namespace Xylem.Common.Ui.GenesisToolBox
CheckUpdateEnabled();
_resetTimeMeasurement = true;
}
private void button1_Click(Object sender, EventArgs e)
private void btnClearDisplay_Click(Object sender, EventArgs e)
{
if (_currentGenesis == null ) return;
if (_currentGenesis == null)
return;
if (!_currentGenesis.IsLoggedOn)
{
_currentGenesis.Login();
@@ -1791,40 +1851,62 @@ namespace Xylem.Common.Ui.GenesisToolBox
}
private void btnFixBat_Click(Object sender, EventArgs e)
{
try
{
_currentGenesis.Login();
_currentGenesis.WriteRegister("GENESISFLOW_SealDisplay", (UInt32)0, true, false);
_currentGenesis.WriteRegister("GENESISFLOW_SealDisplay", (UInt32)0);
_currentGenesis.ResetAlarm(GenesisMeter.Alarm.ALL);
_currentGenesis.WriteRegister("POWERMON_WarnFromClamp", (UInt32)630720000, true, false);
_currentGenesis.WriteRegister("POWERMON_BatteryQuantity", (UInt32)2, true, false);
_currentGenesis.WriteRegister("POWERMON_StoreConfiguration", (UInt32)1, true, false);
_currentGenesis.WriteRegister("GENESISFLOW_TriggerIdle", (UInt32)0, true, false);
_currentGenesis.WriteRegister("POWERMON_WarnFromClamp", (UInt32)630720000);
_currentGenesis.WriteRegister("POWERMON_BatteryQuantity", (UInt32)2);
_currentGenesis.WriteRegister("POWERMON_StoreConfiguration", (UInt32)1);
_currentGenesis.WriteRegister("GENESISFLOW_TriggerIdle", (UInt32)0);
_currentGenesis.StoreAllConfigurations();
_currentGenesis.Logout();
Thread.Sleep(15000);
Thread.Sleep(5000);
_currentGenesis.Login();
}
catch (Exception)
private void cbxStoreConfigEnable_CheckedChanged(Object sender, EventArgs e)
{
if (_meterFwUpdate != null)
_meterFwUpdate.StoreConfigEnable = cbxStoreConfigEnable.Checked;
}
/// <summary>
/// Read config file from meter and store it to disk.
/// </summary>
/// <remarks date="2021-Jan-05" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void btnUploadConfig_Click(Object sender, EventArgs e)
{
throw;
}
if (_currentGenesis == null ) return;
if (_meterFwUpdate == null) _meterFwUpdate = new MeterFwUpdate(_currentGenesis);
UploadFileControl(true);
if (!_currentGenesis.IsLoggedOn) _currentGenesis.ReLogin();
}
private void label2_Click(Object sender, EventArgs e)
if (_meterFwUpdate.UploadConfigFile())
{
if (saveConfigFile.ShowDialog() == DialogResult.OK)
{
var fs = new FileStream(saveConfigFile.FileName, FileMode.OpenOrCreate);
var bw = new BinaryWriter(fs);
foreach (var t in _meterFwUpdate.ConfigFile.BinData)
bw.Write(t);
fs.Close();
}
}
_currentGenesis.Logout();
UploadFileControl(false);
}
#endregion
}
}
+3 -3
View File
@@ -126,13 +126,13 @@
<metadata name="dlgOpenPackageFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>465, 17</value>
</metadata>
<metadata name="tabProduction.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabDb.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="saveConfigFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>465, 17</value>
</metadata>
</root>
+1 -2
View File
@@ -165,10 +165,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
try
{
Init();
Int32 slotNr;
if (string.IsNullOrEmpty(cbComSlot.SelectedItem.ToString()) ||
!int.TryParse(cbComSlot.SelectedItem.ToString(), out slotNr))
!int.TryParse(cbComSlot.SelectedItem.ToString(), out var slotNr))
{
return;
}