Reboot via pseudo update (PSU) accepts hexadecimal FLEXNETVERSION like 10.3C for "R" or 90.0E for "B" versions

This commit is contained in:
Thomas Wiedebusch
2022-08-11 17:24:03 +02:00
parent 3f5b5c498f
commit 845a87e2a3
8 changed files with 73 additions and 132 deletions
+2 -2
View File
@@ -14,5 +14,5 @@ using System.Reflection;
//[assembly: AssemblyVersion("1.2.*.0")]
[assembly: AssemblyVersion("2.2.9.*")]
[assembly: AssemblyFileVersion("2.2.9.0")]
[assembly: AssemblyVersion("2.3.0.*")]
[assembly: AssemblyFileVersion("2.3.0.0")]
+1 -1
View File
@@ -155,7 +155,7 @@
</site>
<site name="MeterProcessState" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\drabesch_ro\Repo\lab\la_operations\laa_production\Common\Service\MeterProcessState" />
<virtualDirectory path="/" physicalPath="D:\Projekte\SENSUS_GitLab\laa_production\Common\Service\MeterProcessState" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:56011:localhost" />
@@ -48,8 +48,8 @@ namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol
//the IrDA length covers the payload length only
private const UInt16 ProtAddLength = IrdaProtocolFrameLength;
//private const Int32 DefaultResponseTimeoutMs = 50;
private const Int32 DefaultResponseTimeoutMs = 150;
private const Int32 DefaultResponseTimeoutMs = 250;
//private const Int32 DefaultResponseTimeoutMs = 150;
private Int32 _responseTimeoutMs = DefaultResponseTimeoutMs;
private const UInt32 BaudRate = 115200;
@@ -63,13 +63,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig
/// added from the transmit protocol timeout. This timeout
/// will be multiplied with the (retry + 1)!
/// </summary>
public const Int32 ResponseTimeoutMs = 100;
public const Int32 ResponseTimeoutMs = 250;
// public const Int32 ResponseTimeoutMs = 100;
/// <summary>
/// Timeout before retry will be initiated if the meter is
/// not ready indicated by a wakeup-message or decoding error.
/// </summary>
public const Int32 BusyTimeoutMs = 1000;
public const Int32 BusyTimeoutMs = 500;
// public const Int32 BusyTimeoutMs = 1000;
/// <summary>
/// Time to avoid automatic lock off of genesis device due to
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
@@ -70,10 +71,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
// position of version string
private const Int32 FlexVersionStringIndex = 0x66;
// size of version string e.g. R1.2.47
private const Int32 FlexVersionStringSize = 7;
// retry counter
private Int32 _processRetryCtr;
private GenesisMeter _genesisMeter;
@@ -286,7 +284,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
/// <remarks date="2022-Aug-10" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private void ResetAll()
public void ResetAll()
{
LutFile = null;
//remove the update stop action
@@ -468,7 +466,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
foreach (var app in _genesisMeter.MeterAppListVersion.Where(app => app.AppName == "FLEXNETVERSION"))
{
strVersion = app.StrVersion;
fileAppCrc = (UInt16)app.Crc;
fileAppCrc = app.Crc;
flexnetversionFound = true;
}
@@ -485,34 +483,32 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
// as it does lose the "B" information on conversion which is represented with the mask 0x80.
// Later the file contains the preceding "B" or "R" instead of a number higher than 0x80.
// The expected version string is 12.47 or 92.47 from app.StrVersion. Convert to R1.2.47 or B.2.47
var version = new Char[strVersion.Length];
version = strVersion.ToCharArray();
int.TryParse(version[0].ToString(), out var digit);
// remove all points
strVersion = strVersion.Replace(".", "");
// to insert the correct naming in the string, all characters have to be separated
var charVersion = strVersion.ToCharArray();
// for the hex number needed in the upgrade file
int.TryParse(strVersion, NumberStyles.HexNumber, null, out var hexVersion);
// add the "B" for test versions and the "R" for release versions
strVersion = (version[0] & 0x80) == 0x80 ? "B" : "R";
// Mask out the 0x80 to get the number behind
if (digit >= 8)
if ((hexVersion & 0x8000) == 0x8000)
{
digit -= 8;
strVersion = "B";
charVersion[0] = Convert.ToChar($"{(hexVersion & ~0x8000) >> 12}");
}
strVersion += $"{digit}.";
var versionMsb = digit << 4;
int.TryParse(version[1].ToString(), out digit);
strVersion += $"{digit}.";
versionMsb += digit;
int.TryParse(version[3].ToString(), out digit);
var versionLsb = digit << 4;
strVersion += digit;
int.TryParse(version[4].ToString(), out digit);
versionLsb += digit;
strVersion += digit;
strVersion += "";
_upg18File[MeterFwUpdate.FileAppVersionIndex] = (Byte)versionLsb;
_upg18File[MeterFwUpdate.FileAppVersionIndex + 1] = (Byte)versionMsb;
else
{
strVersion = "R";
}
_upg18File[MeterFwUpdate.FileAppVersionIndex] = (Byte)(hexVersion & 0xFF);
_upg18File[MeterFwUpdate.FileAppVersionIndex + 1] = (Byte)((hexVersion & 0xFF00) >> 8);
// build the version string and copy it to the upgrade file
strVersion += $"{charVersion[0]}.{charVersion[1]}.{charVersion[2]}{charVersion[3]}";
var upg18Idx = FlexVersionStringIndex;
foreach (var t in strVersion)
{
@@ -1 +1 @@
5ed75d99ee45ff67821090f1b3dbb001dd9e4fe3
1a3d4919c9c702245832d925951f2b7cb72fc333
+38 -91
View File
@@ -31,10 +31,7 @@
this.gpGerneral = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.btnLutUpdate = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.btnPressure = new System.Windows.Forms.Button();
this.btnConfiguration = new System.Windows.Forms.Button();
this.btnCalender = new System.Windows.Forms.Button();
this.btnFwUpdate = new System.Windows.Forms.Button();
this.btnStreamingQuality = new System.Windows.Forms.Button();
this.btnTempLogger = new System.Windows.Forms.Button();
@@ -42,18 +39,17 @@
this.btnAlarm = new System.Windows.Forms.Button();
this.btnSetup = new System.Windows.Forms.Button();
this.gpLAA = new System.Windows.Forms.GroupBox();
this.button5 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.btnPara = new System.Windows.Forms.Button();
this.btnRegHistory = new System.Windows.Forms.Button();
this.btnRawDataInt = new System.Windows.Forms.Button();
this.btnRelatePCbID = new System.Windows.Forms.Button();
this.btnPassword = new System.Windows.Forms.Button();
this.gbDeveloper = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.BtnFileSplit = new System.Windows.Forms.Button();
this.btnFiles = new System.Windows.Forms.Button();
this.btnLegacyTestApp = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.lblVersionNumber = new System.Windows.Forms.Label();
this.gpGerneral.SuspendLayout();
this.gpLAA.SuspendLayout();
this.gbDeveloper.SuspendLayout();
@@ -63,10 +59,7 @@
//
this.gpGerneral.Controls.Add(this.button4);
this.gpGerneral.Controls.Add(this.btnLutUpdate);
this.gpGerneral.Controls.Add(this.button1);
this.gpGerneral.Controls.Add(this.btnPressure);
this.gpGerneral.Controls.Add(this.btnConfiguration);
this.gpGerneral.Controls.Add(this.btnCalender);
this.gpGerneral.Controls.Add(this.btnFwUpdate);
this.gpGerneral.Controls.Add(this.btnStreamingQuality);
this.gpGerneral.Controls.Add(this.btnTempLogger);
@@ -74,9 +67,9 @@
this.gpGerneral.Controls.Add(this.btnAlarm);
this.gpGerneral.Controls.Add(this.btnSetup);
this.gpGerneral.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpGerneral.Location = new System.Drawing.Point(13, 12);
this.gpGerneral.Location = new System.Drawing.Point(18, 37);
this.gpGerneral.Name = "gpGerneral";
this.gpGerneral.Size = new System.Drawing.Size(181, 503);
this.gpGerneral.Size = new System.Drawing.Size(181, 459);
this.gpGerneral.TabIndex = 19;
this.gpGerneral.TabStop = false;
this.gpGerneral.Text = "General";
@@ -101,19 +94,9 @@
this.btnLutUpdate.UseVisualStyleBackColor = true;
this.btnLutUpdate.Click += new System.EventHandler(this.btnLutUpdate_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(4, 455);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(152, 40);
this.button1.TabIndex = 16;
this.button1.Text = "LogFile";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// btnPressure
//
this.btnPressure.Location = new System.Drawing.Point(4, 409);
this.btnPressure.Location = new System.Drawing.Point(7, 366);
this.btnPressure.Name = "btnPressure";
this.btnPressure.Size = new System.Drawing.Size(152, 40);
this.btnPressure.TabIndex = 15;
@@ -121,27 +104,6 @@
this.btnPressure.UseVisualStyleBackColor = true;
this.btnPressure.Click += new System.EventHandler(this.btnPressure_Click);
//
// btnConfiguration
//
this.btnConfiguration.Location = new System.Drawing.Point(7, 365);
this.btnConfiguration.Name = "btnConfiguration";
this.btnConfiguration.Size = new System.Drawing.Size(152, 40);
this.btnConfiguration.TabIndex = 14;
this.btnConfiguration.Text = "Configuration";
this.btnConfiguration.UseVisualStyleBackColor = true;
this.btnConfiguration.Click += new System.EventHandler(this.btnCustomerText_Click);
//
// btnCalender
//
this.btnCalender.Enabled = false;
this.btnCalender.Location = new System.Drawing.Point(3, 366);
this.btnCalender.Name = "btnCalender";
this.btnCalender.Size = new System.Drawing.Size(151, 39);
this.btnCalender.TabIndex = 13;
this.btnCalender.Text = "Calender Seconds";
this.btnCalender.UseVisualStyleBackColor = true;
this.btnCalender.Click += new System.EventHandler(this.btnCalender_Click);
//
// btnFwUpdate
//
this.btnFwUpdate.Location = new System.Drawing.Point(6, 235);
@@ -208,20 +170,30 @@
this.gpLAA.Controls.Add(this.button2);
this.gpLAA.Controls.Add(this.btnPara);
this.gpLAA.Controls.Add(this.btnRegHistory);
this.gpLAA.Controls.Add(this.btnRawDataInt);
this.gpLAA.Controls.Add(this.btnRelatePCbID);
this.gpLAA.Controls.Add(this.btnPassword);
this.gpLAA.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gpLAA.Location = new System.Drawing.Point(200, 12);
this.gpLAA.Location = new System.Drawing.Point(201, 37);
this.gpLAA.Name = "gpLAA";
this.gpLAA.Size = new System.Drawing.Size(181, 344);
this.gpLAA.Size = new System.Drawing.Size(181, 293);
this.gpLAA.TabIndex = 20;
this.gpLAA.TabStop = false;
this.gpLAA.Text = "Production LAA";
//
// button5
//
this.button5.Location = new System.Drawing.Point(5, 245);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(152, 40);
this.button5.TabIndex = 21;
this.button5.Text = "Mapping NA";
this.button5.UseMnemonic = false;
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(6, 244);
this.button2.Location = new System.Drawing.Point(4, 199);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(152, 40);
this.button2.TabIndex = 20;
@@ -232,7 +204,7 @@
//
// btnPara
//
this.btnPara.Location = new System.Drawing.Point(6, 198);
this.btnPara.Location = new System.Drawing.Point(5, 153);
this.btnPara.Name = "btnPara";
this.btnPara.Size = new System.Drawing.Size(152, 40);
this.btnPara.TabIndex = 19;
@@ -243,7 +215,7 @@
//
// btnRegHistory
//
this.btnRegHistory.Location = new System.Drawing.Point(5, 152);
this.btnRegHistory.Location = new System.Drawing.Point(4, 107);
this.btnRegHistory.Name = "btnRegHistory";
this.btnRegHistory.Size = new System.Drawing.Size(152, 40);
this.btnRegHistory.TabIndex = 17;
@@ -251,16 +223,6 @@
this.btnRegHistory.UseVisualStyleBackColor = true;
this.btnRegHistory.Click += new System.EventHandler(this.btnRegHistory_Click);
//
// btnRawDataInt
//
this.btnRawDataInt.Location = new System.Drawing.Point(5, 107);
this.btnRawDataInt.Name = "btnRawDataInt";
this.btnRawDataInt.Size = new System.Drawing.Size(151, 39);
this.btnRawDataInt.TabIndex = 16;
this.btnRawDataInt.Text = "Raw Data Interpreter";
this.btnRawDataInt.UseVisualStyleBackColor = true;
this.btnRawDataInt.Click += new System.EventHandler(this.btnCalibrationResult_Click);
//
// btnRelatePCbID
//
this.btnRelatePCbID.Location = new System.Drawing.Point(5, 61);
@@ -284,29 +246,18 @@
//
// gbDeveloper
//
this.gbDeveloper.Controls.Add(this.button3);
this.gbDeveloper.Controls.Add(this.BtnFileSplit);
this.gbDeveloper.Controls.Add(this.btnFiles);
this.gbDeveloper.Controls.Add(this.btnLegacyTestApp);
this.gbDeveloper.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.gbDeveloper.Location = new System.Drawing.Point(200, 362);
this.gbDeveloper.Location = new System.Drawing.Point(201, 336);
this.gbDeveloper.Name = "gbDeveloper";
this.gbDeveloper.Size = new System.Drawing.Size(181, 153);
this.gbDeveloper.Size = new System.Drawing.Size(181, 160);
this.gbDeveloper.TabIndex = 21;
this.gbDeveloper.TabStop = false;
this.gbDeveloper.Text = "Developer";
this.gbDeveloper.Enter += new System.EventHandler(this.gbDeveloper_Enter);
//
// button3
//
this.button3.Location = new System.Drawing.Point(126, 17);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(30, 37);
this.button3.TabIndex = 19;
this.button3.Text = "button3";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// BtnFileSplit
//
this.BtnFileSplit.Location = new System.Drawing.Point(5, 107);
@@ -330,37 +281,36 @@
//
// btnLegacyTestApp
//
this.btnLegacyTestApp.Location = new System.Drawing.Point(5, 15);
this.btnLegacyTestApp.Location = new System.Drawing.Point(7, 15);
this.btnLegacyTestApp.Name = "btnLegacyTestApp";
this.btnLegacyTestApp.Size = new System.Drawing.Size(115, 40);
this.btnLegacyTestApp.Size = new System.Drawing.Size(151, 40);
this.btnLegacyTestApp.TabIndex = 15;
this.btnLegacyTestApp.Text = "LegacyTestApp";
this.btnLegacyTestApp.UseVisualStyleBackColor = true;
this.btnLegacyTestApp.Click += new System.EventHandler(this.btnLegacyTestApp_Click);
//
// button5
// lblVersionNumber
//
this.button5.Location = new System.Drawing.Point(6, 290);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(152, 40);
this.button5.TabIndex = 21;
this.button5.Text = "Mapping NA";
this.button5.UseMnemonic = false;
this.button5.UseVisualStyleBackColor = true;
this.button5.Click += new System.EventHandler(this.button5_Click);
this.lblVersionNumber.AutoSize = true;
this.lblVersionNumber.Location = new System.Drawing.Point(22, 9);
this.lblVersionNumber.Name = "lblVersionNumber";
this.lblVersionNumber.Size = new System.Drawing.Size(37, 13);
this.lblVersionNumber.TabIndex = 23;
this.lblVersionNumber.Text = "----------";
//
// FrmMainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(390, 517);
this.ClientSize = new System.Drawing.Size(390, 497);
this.Controls.Add(this.lblVersionNumber);
this.Controls.Add(this.gbDeveloper);
this.Controls.Add(this.gpLAA);
this.Controls.Add(this.gpGerneral);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(410, 560);
this.MinimumSize = new System.Drawing.Size(410, 560);
this.MaximumSize = new System.Drawing.Size(410, 540);
this.MinimumSize = new System.Drawing.Size(410, 540);
this.Name = "FrmMainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Genesis ToolBox";
@@ -369,14 +319,13 @@
this.gpLAA.ResumeLayout(false);
this.gbDeveloper.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox gpGerneral;
private System.Windows.Forms.Button btnConfiguration;
private System.Windows.Forms.Button btnCalender;
private System.Windows.Forms.Button btnFwUpdate;
private System.Windows.Forms.Button btnStreamingQuality;
private System.Windows.Forms.Button btnTempLogger;
@@ -386,7 +335,6 @@
private System.Windows.Forms.GroupBox gpLAA;
private System.Windows.Forms.Button btnPara;
private System.Windows.Forms.Button btnRegHistory;
private System.Windows.Forms.Button btnRawDataInt;
private System.Windows.Forms.Button btnRelatePCbID;
private System.Windows.Forms.Button btnPassword;
private System.Windows.Forms.GroupBox gbDeveloper;
@@ -394,12 +342,11 @@
private System.Windows.Forms.Button btnFiles;
private System.Windows.Forms.Button btnLegacyTestApp;
private System.Windows.Forms.Button btnPressure;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button btnLutUpdate;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label lblVersionNumber;
}
}
+1 -5
View File
@@ -34,6 +34,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
// valid = context.ValidateCredentials("drabesch_ro", "password");
//}
lblVersionNumber.Text = $@"Version: {version.Major}.{version.Minor}.{version.Build}";
}
private void btnSetup_Click(Object sender, EventArgs e)
@@ -370,11 +371,6 @@ namespace Xylem.Common.Ui.GenesisToolBox
Hide();
}
private void button3_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
var form = new FrmLutManagement();