GTB: - configuration version, - comments extended

This commit is contained in:
Thomas Wiedebusch 2025-08-06 11:29:36 +02:00
parent d9564b3c95
commit 6a88734902
9 changed files with 99 additions and 42 deletions

View File

@ -18,6 +18,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications
/// <summary>
/// address of application
/// </summary>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppId from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
public UInt16 AppId;
/// <summary>

View File

@ -17,6 +17,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications
/// <summary>
/// Identification number of application
/// </summary>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppId from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
public UInt16 AppId;
/// <summary>
@ -25,10 +31,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Applications
public UInt32 Version;
/// <summary>
/// Version string of application because of FLEXNETVERSION
/// does return a different layout, instead of decimals it
/// used hexadecimals. Therefore the version has to be saved as
/// string at time of receiving for the FW-Update comparison
/// Version string of application because of FLEXNETVERSION does return a different layout, instead of decimals
/// it uses hexadecimals. Therefore, the version has to be saved as string at time of receiving for the FW-Update
/// comparison.
/// </summary>
public String StrVersion;

View File

@ -1630,6 +1630,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// </remarks>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - Extract interface version (configuration.json) from "OPTICALINTERFACE".
/// - AppId from Byte to UInt16 including typecast for Byte on WriteRegister. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppId 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
protected virtual void ReadMeterFirmwareAndAssignRegisters()
{
@ -1660,7 +1664,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var isInstalled = false;
var installationStatus = MeterAppState.MeterAppNotInstalled;
var versionString = "";
if (WriteRegister(Register.System.CheckFwPresence, meterApp.AppId))
if (WriteRegister(Register.System.CheckFwPresence, (Byte)meterApp.AppId))
{
//read version, skip retries on SYSTEM 0x04-> FW nor present is a valid feedback
var readFwVersionBytes = ReadRegister(Register.System.CheckFwPresence, 4);

View File

@ -20,6 +20,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// <summary>
/// address of application which is the base address for the register
/// </summary>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppAddress from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppAddress 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
public UInt16 AppAddress;
/// <summary>
@ -57,6 +63,12 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// <summary>
/// address combined of application and register in this application
/// </summary>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppAddress from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
/// AppAddress 256, which exceeds the byte range as this isn't a real application, but will be used to identify
/// the interface (configuration.json) version.
/// </remarks>
public Byte[] RegisterAddress
{
get { return new[] { (Byte)AppAddress, RegAddressInApp }; }

View File

@ -224,7 +224,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
_dataTable.Columns.Add(StrStatus, typeof(String));
var version = Assembly.GetExecutingAssembly().GetName().Version;
lblFwUpdateInfo.Text = $@"Version: {version.Major}.{version.Minor}.{version.Build}";
lblFwUpdateInfo.Text = $@"GTB Version: {version.Major}.{version.Minor}.{version.Build}";
_resetTimeMeasurement = true;
Init();
}

View File

@ -109,7 +109,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
private void FrmLowLevelTools_Load(Object sender, EventArgs e)
{
var version = Assembly.GetExecutingAssembly().GetName().Version;
lblFwUpdateInfo.Text = $@"Version: {version.Major}.{version.Minor}.{version.Build}";
lblFwUpdateInfo.Text = $@"GTB Version: {version.Major}.{version.Minor}.{version.Build}";
_resetTimeMeasurement = true;
Init();

View File

@ -104,7 +104,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
private void FrmLutUpdate_Load(Object sender, EventArgs e)
{
var version = Assembly.GetExecutingAssembly().GetName().Version;
lblFwUpdateInfo.Text = $@"Version: {version.Major}.{version.Minor}.{version.Build}";
lblFwUpdateInfo.Text = $@"GTB Version: {version.Major}.{version.Minor}.{version.Build}";
_resetTimeMeasurement = true;
Init();
@ -219,7 +219,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (!_currentGenesis.IsLoggedOn)
{
//this is needed from meter as an unsuccessfully login requires a delay for the next trial
//this is needed from meter as an unsuccessful login requires a delay for the next trial
Thread.Sleep(2000);
_meterBatch.MetersLogin();
}
@ -246,7 +246,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (_currentGenesis.RadioFrequencyMhz != null)
{
tbxRadio.Text = $@"{_currentGenesis.RadioFrequencyMhz}";
LogText($"Meter radio frequency [MHz]: {_currentGenesis.RadioFrequencyMhz}");
LogText($"Meter Radio Frequency [MHz]: {_currentGenesis.RadioFrequencyMhz}");
}
LogText("Configuration.json Version: " + _currentGenesis.InterfaceVersion);
@ -799,7 +799,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
if (cbxDbLuts.SelectedItem is CordonelMetrologyLut lut)
{
lblLutFileLoadedInfo.Text = "";
tbxLutFilePathName.Text = $"fromDB{lut.FileName}";
tbxLutFilePathName.Text = $@"fromDB{lut.FileName}";
if (_meterLutUpdate == null)
{
_meterLutUpdate = new MeterLutUpdate(_currentGenesis);

View File

@ -54,6 +54,8 @@
this.btnRadioPressure = new System.Windows.Forms.Button();
this.nundCalResultID = new System.Windows.Forms.NumericUpDown();
this.btnFingerWeg = new System.Windows.Forms.Button();
this.lblGtbVersion = new System.Windows.Forms.Label();
this.lblConfigVersion = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.registerGridView)).BeginInit();
this.pnlBussy.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nundCalResultID)).BeginInit();
@ -62,27 +64,27 @@
// cbComSlot
//
this.cbComSlot.FormattingEnabled = true;
this.cbComSlot.Location = new System.Drawing.Point(79, 12);
this.cbComSlot.Location = new System.Drawing.Point(41, 56);
this.cbComSlot.Name = "cbComSlot";
this.cbComSlot.Size = new System.Drawing.Size(104, 21);
this.cbComSlot.Size = new System.Drawing.Size(58, 21);
this.cbComSlot.TabIndex = 0;
this.cbComSlot.Text = "1";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(8, 21);
this.label1.Location = new System.Drawing.Point(10, 59);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(25, 13);
this.label1.Size = new System.Drawing.Size(28, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Slot";
this.label1.Text = "Slot:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// btnRead
//
this.btnRead.Location = new System.Drawing.Point(189, 48);
this.btnRead.Location = new System.Drawing.Point(10, 123);
this.btnRead.Name = "btnRead";
this.btnRead.Size = new System.Drawing.Size(185, 30);
this.btnRead.Size = new System.Drawing.Size(175, 30);
this.btnRead.TabIndex = 2;
this.btnRead.Text = "Read Meter";
this.btnRead.UseVisualStyleBackColor = true;
@ -105,9 +107,9 @@
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(189, 12);
this.btnConnect.Location = new System.Drawing.Point(105, 50);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(85, 30);
this.btnConnect.Size = new System.Drawing.Size(80, 30);
this.btnConnect.TabIndex = 4;
this.btnConnect.Text = "Connect";
this.btnConnect.UseVisualStyleBackColor = true;
@ -116,7 +118,7 @@
// lblState
//
this.lblState.AutoSize = true;
this.lblState.Location = new System.Drawing.Point(5, 55);
this.lblState.Location = new System.Drawing.Point(10, 94);
this.lblState.Name = "lblState";
this.lblState.Size = new System.Drawing.Size(78, 13);
this.lblState.TabIndex = 5;
@ -129,9 +131,9 @@
//
// btnGetPCbID
//
this.btnGetPCbID.Location = new System.Drawing.Point(280, 12);
this.btnGetPCbID.Location = new System.Drawing.Point(309, 50);
this.btnGetPCbID.Name = "btnGetPCbID";
this.btnGetPCbID.Size = new System.Drawing.Size(94, 30);
this.btnGetPCbID.Size = new System.Drawing.Size(80, 30);
this.btnGetPCbID.TabIndex = 11;
this.btnGetPCbID.Text = "Get PCB ID";
this.btnGetPCbID.UseVisualStyleBackColor = true;
@ -198,9 +200,9 @@
//
// btnReadFwVersions
//
this.btnReadFwVersions.Location = new System.Drawing.Point(380, 12);
this.btnReadFwVersions.Location = new System.Drawing.Point(400, 50);
this.btnReadFwVersions.Name = "btnReadFwVersions";
this.btnReadFwVersions.Size = new System.Drawing.Size(114, 30);
this.btnReadFwVersions.Size = new System.Drawing.Size(110, 30);
this.btnReadFwVersions.TabIndex = 52;
this.btnReadFwVersions.Text = "Read FW Versions";
this.btnReadFwVersions.UseVisualStyleBackColor = true;
@ -208,19 +210,20 @@
//
// btn_CalibrationRestore
//
this.btn_CalibrationRestore.Location = new System.Drawing.Point(516, 12);
this.btn_CalibrationRestore.Location = new System.Drawing.Point(516, 50);
this.btn_CalibrationRestore.Name = "btn_CalibrationRestore";
this.btn_CalibrationRestore.Size = new System.Drawing.Size(114, 30);
this.btn_CalibrationRestore.Size = new System.Drawing.Size(110, 30);
this.btn_CalibrationRestore.TabIndex = 58;
this.btn_CalibrationRestore.Text = "CalibrationRestore";
this.btn_CalibrationRestore.UseVisualStyleBackColor = true;
this.btn_CalibrationRestore.Visible = false;
this.btn_CalibrationRestore.Click += new System.EventHandler(this.btn_CalibrationRestore_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(380, 48);
this.button1.Location = new System.Drawing.Point(400, 85);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(114, 30);
this.button1.Size = new System.Drawing.Size(110, 30);
this.button1.TabIndex = 60;
this.button1.Text = "Battery Idle";
this.button1.UseVisualStyleBackColor = true;
@ -228,9 +231,9 @@
//
// button2
//
this.button2.Location = new System.Drawing.Point(516, 80);
this.button2.Location = new System.Drawing.Point(516, 120);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(114, 30);
this.button2.Size = new System.Drawing.Size(110, 30);
this.button2.TabIndex = 61;
this.button2.Text = "Set default Pulse";
this.button2.UseVisualStyleBackColor = true;
@ -238,7 +241,7 @@
//
// btnStoreAll
//
this.btnStoreAll.Location = new System.Drawing.Point(635, 12);
this.btnStoreAll.Location = new System.Drawing.Point(251, 52);
this.btnStoreAll.Name = "btnStoreAll";
this.btnStoreAll.Size = new System.Drawing.Size(52, 55);
this.btnStoreAll.TabIndex = 62;
@ -248,9 +251,9 @@
//
// button3
//
this.button3.Location = new System.Drawing.Point(34, 80);
this.button3.Location = new System.Drawing.Point(309, 120);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(85, 30);
this.button3.Size = new System.Drawing.Size(80, 30);
this.button3.TabIndex = 63;
this.button3.Text = "applist to db";
this.button3.UseVisualStyleBackColor = true;
@ -263,9 +266,9 @@
//
// btnBatLife
//
this.btnBatLife.Location = new System.Drawing.Point(516, 116);
this.btnBatLife.Location = new System.Drawing.Point(309, 85);
this.btnBatLife.Name = "btnBatLife";
this.btnBatLife.Size = new System.Drawing.Size(114, 30);
this.btnBatLife.Size = new System.Drawing.Size(80, 30);
this.btnBatLife.TabIndex = 71;
this.btnBatLife.Text = "Lifetime";
this.btnBatLife.UseVisualStyleBackColor = true;
@ -273,9 +276,9 @@
//
// btnRadioPressure
//
this.btnRadioPressure.Location = new System.Drawing.Point(34, 116);
this.btnRadioPressure.Location = new System.Drawing.Point(400, 120);
this.btnRadioPressure.Name = "btnRadioPressure";
this.btnRadioPressure.Size = new System.Drawing.Size(113, 23);
this.btnRadioPressure.Size = new System.Drawing.Size(110, 30);
this.btnRadioPressure.TabIndex = 72;
this.btnRadioPressure.Text = "Activate Radio";
this.btnRadioPressure.UseVisualStyleBackColor = true;
@ -283,7 +286,7 @@
//
// nundCalResultID
//
this.nundCalResultID.Location = new System.Drawing.Point(516, 47);
this.nundCalResultID.Location = new System.Drawing.Point(518, 82);
this.nundCalResultID.Maximum = new decimal(new int[] {
999999,
0,
@ -292,22 +295,43 @@
this.nundCalResultID.Name = "nundCalResultID";
this.nundCalResultID.Size = new System.Drawing.Size(114, 20);
this.nundCalResultID.TabIndex = 73;
this.nundCalResultID.Visible = false;
//
// btnFingerWeg
//
this.btnFingerWeg.Location = new System.Drawing.Point(635, 80);
this.btnFingerWeg.Location = new System.Drawing.Point(638, 52);
this.btnFingerWeg.Name = "btnFingerWeg";
this.btnFingerWeg.Size = new System.Drawing.Size(52, 66);
this.btnFingerWeg.Size = new System.Drawing.Size(62, 98);
this.btnFingerWeg.TabIndex = 74;
this.btnFingerWeg.Text = "Finger weg!";
this.btnFingerWeg.Text = "Do NOT touch! Recalib!";
this.btnFingerWeg.UseVisualStyleBackColor = true;
this.btnFingerWeg.Click += new System.EventHandler(this.FingerWeg_Clicked);
//
// lblGtbVersion
//
this.lblGtbVersion.AutoSize = true;
this.lblGtbVersion.Location = new System.Drawing.Point(10, 10);
this.lblGtbVersion.Name = "lblGtbVersion";
this.lblGtbVersion.Size = new System.Drawing.Size(79, 13);
this.lblGtbVersion.TabIndex = 75;
this.lblGtbVersion.Text = "GTB Version: ?";
//
// lblConfigVersion
//
this.lblConfigVersion.AutoSize = true;
this.lblConfigVersion.Location = new System.Drawing.Point(10, 31);
this.lblConfigVersion.Name = "lblConfigVersion";
this.lblConfigVersion.Size = new System.Drawing.Size(119, 13);
this.lblConfigVersion.TabIndex = 76;
this.lblConfigVersion.Text = "Configuration Version: ?";
//
// FrmRegisterStore
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(704, 553);
this.Controls.Add(this.lblConfigVersion);
this.Controls.Add(this.lblGtbVersion);
this.Controls.Add(this.btnFingerWeg);
this.Controls.Add(this.nundCalResultID);
this.Controls.Add(this.btnRadioPressure);
@ -365,5 +389,7 @@
private System.Windows.Forms.Button btnRadioPressure;
private System.Windows.Forms.NumericUpDown nundCalResultID;
private System.Windows.Forms.Button btnFingerWeg;
private System.Windows.Forms.Label lblGtbVersion;
private System.Windows.Forms.Label lblConfigVersion;
}
}

View File

@ -186,6 +186,7 @@ namespace Xylem.Common.Ui.GenesisToolBox
{
lblState.ForeColor = Color.Green;
lblState.Text = $"Connected to PCB {_currentPcbId}";
lblConfigVersion.Text = @"Configuration Version: " + _currentGenesis.InterfaceVersion;
_dataTable.Rows.Clear();
@ -437,6 +438,9 @@ namespace Xylem.Common.Ui.GenesisToolBox
//{
// cbPreselection.Items.Add(info.Name);
//}
var version = Assembly.GetExecutingAssembly().GetName().Version;
lblGtbVersion.Text = $@"GTB Version: {version.Major}.{version.Minor}.{version.Build}";
}
private void frmRegisterStore_FormClosing(Object sender, FormClosingEventArgs e)