diff --git a/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfg.cs b/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfg.cs index a1ddd8226..1461c269a 100644 --- a/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfg.cs +++ b/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfg.cs @@ -26,6 +26,8 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead /// Serialized parameters /// public int SlotNr; /// Number written to QuidoRS to connct the watermeter to RfidComPort, 1 .. 10 + public int OptoComPortNr; + public int HeadComPortNr; /// Procedure parameters [XmlIgnore] @@ -43,6 +45,8 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead Name = "Genesis"; ParentName = string.Empty; SlotNr = 0; + OptoComPortNr = 0; + HeadComPortNr = 0; ProcParams = new ProcParams(true); } @@ -54,9 +58,11 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead public string ToString(int i) { - return string.Format("{0} SlotNr={1}", + return string.Format("{0} SlotNr={1} OptoComPortNr={2} HeadComPortNr={3}", Name, - SlotNr + SlotNr, + OptoComPortNr, + HeadComPortNr ); } } diff --git a/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.cs b/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.cs index e068d9aa3..4ea95d81c 100644 --- a/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.cs +++ b/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.cs @@ -40,6 +40,8 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead nameLabel.Text = Strings.Name; classNameLabel.Text = config.Factory.ClassName; slotNrTextBox.Text = config.SlotNr.ToString(); + optoSerialPortTextBox.Text = config.OptoComPortNr.ToString(); + headPortNrTextBox.Text = config.HeadComPortNr.ToString(); Redraw(); } @@ -51,14 +53,16 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead { if (config == null) return; /// Control was not loaded, settings were not changed nameTextBox.Text = config.Name; - - + optoSerialPortTextBox.Text = config.OptoComPortNr.ToString(); + headPortNrTextBox.Text = config.HeadComPortNr.ToString(); } public void Unlock() { nameTextBox.Enabled = true; slotNrTextBox.Enabled = true; + optoSerialPortTextBox.Enabled = true; + headPortNrTextBox.Enabled = true; } public CfgUpdateFlags VerifyCfg(ref string message) @@ -72,6 +76,18 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead flags |= CfgUpdateFlags.Error; 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; } @@ -85,6 +101,9 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead config.Name = nameTextBox.Text; config.SlotNr = int.Parse(slotNrTextBox.Text); + + config.OptoComPortNr = int.Parse(optoSerialPortTextBox.Text); + config.HeadComPortNr = int.Parse(headPortNrTextBox.Text); return flags; } diff --git a/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.designer.cs b/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.designer.cs index 1fd24405e..78eae6c23 100644 --- a/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.designer.cs +++ b/TBF/Rig/TestMethods/GenesisCommunication/GenesisHead/GenesisHeadCfgCtrl.designer.cs @@ -37,84 +37,154 @@ namespace TBF.Rig.TestMethods.GenesisCommunication.GenesisHead this.slotNrTextBox = new System.Windows.Forms.TextBox(); this.muxBoardNrLabel = 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(); // // nameTextBox // this.nameTextBox.Enabled = false; - this.nameTextBox.Location = new System.Drawing.Point(202, 62); - this.nameTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.nameTextBox.Location = new System.Drawing.Point(135, 40); 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; // // nameLabel // this.nameLabel.AutoSize = true; - this.nameLabel.Location = new System.Drawing.Point(38, 66); - this.nameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.nameLabel.Location = new System.Drawing.Point(25, 43); 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.Text = "Name"; // // classNameLabel // this.classNameLabel.AutoSize = true; - this.classNameLabel.Location = new System.Drawing.Point(198, 25); - this.classNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.classNameLabel.Location = new System.Drawing.Point(132, 16); 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.Text = "ClassName"; // // slotNrTextBox // this.slotNrTextBox.Enabled = false; - this.slotNrTextBox.Location = new System.Drawing.Point(202, 97); - this.slotNrTextBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.slotNrTextBox.Location = new System.Drawing.Point(135, 63); 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; // // muxBoardNrLabel // this.muxBoardNrLabel.AutoSize = true; - this.muxBoardNrLabel.Location = new System.Drawing.Point(38, 102); - this.muxBoardNrLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.muxBoardNrLabel.Location = new System.Drawing.Point(25, 66); 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.Text = "Slot nr"; // // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(264, 102); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(176, 66); 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.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 // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 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.slotNrTextBox); this.Controls.Add(this.muxBoardNrLabel); this.Controls.Add(this.nameTextBox); this.Controls.Add(this.nameLabel); this.Controls.Add(this.classNameLabel); - this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); 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.groupBox1.ResumeLayout(false); + this.groupBox1.PerformLayout(); + this.optoDataGroupBox.ResumeLayout(false); + this.optoDataGroupBox.PerformLayout(); this.ResumeLayout(false); 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 private System.Windows.Forms.TextBox nameTextBox;