Genesis dialog with Com ports

This commit is contained in:
Michal Buzik 2026-03-13 08:47:52 +01:00
parent b078d9586d
commit 2c8a0922d1
3 changed files with 120 additions and 25 deletions

View File

@ -26,6 +26,8 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
/// Serialized parameters /// Serialized parameters
/// ///
public int SlotNr; /// Number written to QuidoRS to connct the watermeter to RfidComPort, 1 .. 10 public int SlotNr; /// Number written to QuidoRS to connct the watermeter to RfidComPort, 1 .. 10
public int OptoComPortNr;
public int HeadComPortNr;
/// <summary> Procedure parameters </summary> /// <summary> Procedure parameters </summary>
[XmlIgnore] [XmlIgnore]
@ -43,6 +45,8 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
Name = "Genesis"; Name = "Genesis";
ParentName = string.Empty; ParentName = string.Empty;
SlotNr = 0; SlotNr = 0;
OptoComPortNr = 0;
HeadComPortNr = 0;
ProcParams = new ProcParams(true); ProcParams = new ProcParams(true);
} }
@ -54,9 +58,11 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
public string ToString(int i) public string ToString(int i)
{ {
return string.Format("{0} SlotNr={1}", return string.Format("{0} SlotNr={1} OptoComPortNr={2} HeadComPortNr={3}",
Name, Name,
SlotNr SlotNr,
OptoComPortNr,
HeadComPortNr
); );
} }
} }

View File

@ -40,6 +40,8 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
nameLabel.Text = Strings.Name; nameLabel.Text = Strings.Name;
classNameLabel.Text = config.Factory.ClassName; classNameLabel.Text = config.Factory.ClassName;
slotNrTextBox.Text = config.SlotNr.ToString(); slotNrTextBox.Text = config.SlotNr.ToString();
optoSerialPortTextBox.Text = config.OptoComPortNr.ToString();
headPortNrTextBox.Text = config.HeadComPortNr.ToString();
Redraw(); Redraw();
} }
@ -51,14 +53,16 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
{ {
if (config == null) return; /// Control was not loaded, settings were not changed if (config == null) return; /// Control was not loaded, settings were not changed
nameTextBox.Text = config.Name; nameTextBox.Text = config.Name;
optoSerialPortTextBox.Text = config.OptoComPortNr.ToString();
headPortNrTextBox.Text = config.HeadComPortNr.ToString();
} }
public void Unlock() public void Unlock()
{ {
nameTextBox.Enabled = true; nameTextBox.Enabled = true;
slotNrTextBox.Enabled = true; slotNrTextBox.Enabled = true;
optoSerialPortTextBox.Enabled = true;
headPortNrTextBox.Enabled = true;
} }
public CfgUpdateFlags VerifyCfg(ref string message) public CfgUpdateFlags VerifyCfg(ref string message)
@ -72,6 +76,18 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
flags |= CfgUpdateFlags.Error; flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + string.Format(Strings.Invalid_0, muxBoardNrLabel.Text); message += Environment.NewLine + string.Format(Strings.Invalid_0, muxBoardNrLabel.Text);
} }
if (!int.TryParse(optoSerialPortTextBox.Text, out dummy) || dummy < 1 || dummy > 999)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Opto serial port nr.' is not valid";
}
if (!int.TryParse(headPortNrTextBox.Text, out dummy) || dummy < 0 || dummy > 999)
{
flags |= CfgUpdateFlags.Error;
message += Environment.NewLine + "'Head communication serial port nr.' is not valid";
}
return flags; return flags;
} }
@ -85,6 +101,9 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
config.Name = nameTextBox.Text; config.Name = nameTextBox.Text;
config.SlotNr = int.Parse(slotNrTextBox.Text); config.SlotNr = int.Parse(slotNrTextBox.Text);
config.OptoComPortNr = int.Parse(optoSerialPortTextBox.Text);
config.HeadComPortNr = int.Parse(headPortNrTextBox.Text);
return flags; return flags;
} }

View File

@ -37,84 +37,154 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead
this.slotNrTextBox = new System.Windows.Forms.TextBox(); this.slotNrTextBox = new System.Windows.Forms.TextBox();
this.muxBoardNrLabel = new System.Windows.Forms.Label(); this.muxBoardNrLabel = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.headPortNrTextBox = new System.Windows.Forms.TextBox();
this.rfidSerialPortNrLabel = new System.Windows.Forms.Label();
this.optoDataGroupBox = new System.Windows.Forms.GroupBox();
this.optoSerialPortLabel = new System.Windows.Forms.Label();
this.optoSerialPortTextBox = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.optoDataGroupBox.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// nameTextBox // nameTextBox
// //
this.nameTextBox.Enabled = false; this.nameTextBox.Enabled = false;
this.nameTextBox.Location = new System.Drawing.Point(202, 62); this.nameTextBox.Location = new System.Drawing.Point(135, 40);
this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.nameTextBox.Name = "nameTextBox"; this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(180, 26); this.nameTextBox.Size = new System.Drawing.Size(121, 20);
this.nameTextBox.TabIndex = 2; this.nameTextBox.TabIndex = 2;
// //
// nameLabel // nameLabel
// //
this.nameLabel.AutoSize = true; this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(38, 66); this.nameLabel.Location = new System.Drawing.Point(25, 43);
this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.nameLabel.Name = "nameLabel"; this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(51, 20); this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 1; this.nameLabel.TabIndex = 1;
this.nameLabel.Text = "Name"; this.nameLabel.Text = "Name";
// //
// classNameLabel // classNameLabel
// //
this.classNameLabel.AutoSize = true; this.classNameLabel.AutoSize = true;
this.classNameLabel.Location = new System.Drawing.Point(198, 25); this.classNameLabel.Location = new System.Drawing.Point(132, 16);
this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.classNameLabel.Name = "classNameLabel"; this.classNameLabel.Name = "classNameLabel";
this.classNameLabel.Size = new System.Drawing.Size(90, 20); this.classNameLabel.Size = new System.Drawing.Size(60, 13);
this.classNameLabel.TabIndex = 0; this.classNameLabel.TabIndex = 0;
this.classNameLabel.Text = "ClassName"; this.classNameLabel.Text = "ClassName";
// //
// slotNrTextBox // slotNrTextBox
// //
this.slotNrTextBox.Enabled = false; this.slotNrTextBox.Enabled = false;
this.slotNrTextBox.Location = new System.Drawing.Point(202, 97); this.slotNrTextBox.Location = new System.Drawing.Point(135, 63);
this.slotNrTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.slotNrTextBox.Name = "slotNrTextBox"; this.slotNrTextBox.Name = "slotNrTextBox";
this.slotNrTextBox.Size = new System.Drawing.Size(49, 26); this.slotNrTextBox.Size = new System.Drawing.Size(34, 20);
this.slotNrTextBox.TabIndex = 9; this.slotNrTextBox.TabIndex = 9;
// //
// muxBoardNrLabel // muxBoardNrLabel
// //
this.muxBoardNrLabel.AutoSize = true; this.muxBoardNrLabel.AutoSize = true;
this.muxBoardNrLabel.Location = new System.Drawing.Point(38, 102); this.muxBoardNrLabel.Location = new System.Drawing.Point(25, 66);
this.muxBoardNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.muxBoardNrLabel.Name = "muxBoardNrLabel"; this.muxBoardNrLabel.Name = "muxBoardNrLabel";
this.muxBoardNrLabel.Size = new System.Drawing.Size(55, 20); this.muxBoardNrLabel.Size = new System.Drawing.Size(37, 13);
this.muxBoardNrLabel.TabIndex = 8; this.muxBoardNrLabel.TabIndex = 8;
this.muxBoardNrLabel.Text = "Slot nr"; this.muxBoardNrLabel.Text = "Slot nr";
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(264, 102); this.label3.Location = new System.Drawing.Point(176, 66);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(52, 20); this.label3.Size = new System.Drawing.Size(37, 13);
this.label3.TabIndex = 13; this.label3.TabIndex = 13;
this.label3.Text = "1 .. 10"; this.label3.Text = "1 .. 10";
// //
// groupBox1
//
this.groupBox1.Controls.Add(this.headPortNrTextBox);
this.groupBox1.Controls.Add(this.rfidSerialPortNrLabel);
this.groupBox1.Location = new System.Drawing.Point(9, 147);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(377, 59);
this.groupBox1.TabIndex = 25;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Head communication";
//
// headPortNrTextBox
//
this.headPortNrTextBox.Enabled = false;
this.headPortNrTextBox.Location = new System.Drawing.Point(123, 19);
this.headPortNrTextBox.Name = "headPortNrTextBox";
this.headPortNrTextBox.Size = new System.Drawing.Size(37, 20);
this.headPortNrTextBox.TabIndex = 7;
//
// rfidSerialPortNrLabel
//
this.rfidSerialPortNrLabel.AutoSize = true;
this.rfidSerialPortNrLabel.Location = new System.Drawing.Point(16, 26);
this.rfidSerialPortNrLabel.Name = "rfidSerialPortNrLabel";
this.rfidSerialPortNrLabel.Size = new System.Drawing.Size(72, 13);
this.rfidSerialPortNrLabel.TabIndex = 6;
this.rfidSerialPortNrLabel.Text = "Serial port nr.:";
//
// optoDataGroupBox
//
this.optoDataGroupBox.Controls.Add(this.optoSerialPortLabel);
this.optoDataGroupBox.Controls.Add(this.optoSerialPortTextBox);
this.optoDataGroupBox.Location = new System.Drawing.Point(9, 87);
this.optoDataGroupBox.Name = "optoDataGroupBox";
this.optoDataGroupBox.Size = new System.Drawing.Size(377, 55);
this.optoDataGroupBox.TabIndex = 24;
this.optoDataGroupBox.TabStop = false;
this.optoDataGroupBox.Text = "Opto-data";
//
// optoSerialPortLabel
//
this.optoSerialPortLabel.AutoSize = true;
this.optoSerialPortLabel.Location = new System.Drawing.Point(16, 22);
this.optoSerialPortLabel.Name = "optoSerialPortLabel";
this.optoSerialPortLabel.Size = new System.Drawing.Size(72, 13);
this.optoSerialPortLabel.TabIndex = 6;
this.optoSerialPortLabel.Text = "Serial port nr.:";
//
// optoSerialPortTextBox
//
this.optoSerialPortTextBox.Enabled = false;
this.optoSerialPortTextBox.Location = new System.Drawing.Point(126, 15);
this.optoSerialPortTextBox.Name = "optoSerialPortTextBox";
this.optoSerialPortTextBox.Size = new System.Drawing.Size(34, 20);
this.optoSerialPortTextBox.TabIndex = 7;
//
// GenesisHeadCfgCtrl // GenesisHeadCfgCtrl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.optoDataGroupBox);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.slotNrTextBox); this.Controls.Add(this.slotNrTextBox);
this.Controls.Add(this.muxBoardNrLabel); this.Controls.Add(this.muxBoardNrLabel);
this.Controls.Add(this.nameTextBox); this.Controls.Add(this.nameTextBox);
this.Controls.Add(this.nameLabel); this.Controls.Add(this.nameLabel);
this.Controls.Add(this.classNameLabel); this.Controls.Add(this.classNameLabel);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "GenesisHeadCfgCtrl"; this.Name = "GenesisHeadCfgCtrl";
this.Size = new System.Drawing.Size(594, 189); this.Size = new System.Drawing.Size(396, 225);
this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load); this.Load += new System.EventHandler(this.WaterMeterCfgCtrl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.optoDataGroupBox.ResumeLayout(false);
this.optoDataGroupBox.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox headPortNrTextBox;
private System.Windows.Forms.Label rfidSerialPortNrLabel;
private System.Windows.Forms.GroupBox optoDataGroupBox;
private System.Windows.Forms.Label optoSerialPortLabel;
private System.Windows.Forms.TextBox optoSerialPortTextBox;
#endregion #endregion
private System.Windows.Forms.TextBox nameTextBox; private System.Windows.Forms.TextBox nameTextBox;