From e4bf2ff910b4637d1fc7054c35e4ae66fee72728 Mon Sep 17 00:00:00 2001 From: temi54c1l8 Date: Thu, 30 May 2024 09:08:42 +0200 Subject: [PATCH 01/16] Change RevisionNumber to string and implemented relative TextBox on Device Info --- EDSEditorGUI/DeviceInfoView.Designer.cs | 30 +++++++++++++++++++++---- EDSEditorGUI/DeviceInfoView.cs | 2 ++ libEDSsharp/eds.cs | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/EDSEditorGUI/DeviceInfoView.Designer.cs b/EDSEditorGUI/DeviceInfoView.Designer.cs index ce68a85c..dd147320 100644 --- a/EDSEditorGUI/DeviceInfoView.Designer.cs +++ b/EDSEditorGUI/DeviceInfoView.Designer.cs @@ -104,6 +104,8 @@ private void InitializeComponent() this.label22 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); + this.textBox_revisionnumber = new System.Windows.Forms.TextBox(); + this.label11 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.groupBox5.SuspendLayout(); this.groupBox6.SuspendLayout(); @@ -123,7 +125,7 @@ private void InitializeComponent() this.panel1.Controls.Add(this.groupBox3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(773, 537); + this.panel1.Size = new System.Drawing.Size(773, 807); this.panel1.TabIndex = 60; // // groupBox5 @@ -142,7 +144,7 @@ private void InitializeComponent() this.groupBox5.Controls.Add(this.label31); this.groupBox5.Controls.Add(this.textBox_projectFileName); this.groupBox5.Controls.Add(this.textBox_deviceedsname); - this.groupBox5.Location = new System.Drawing.Point(12, 332); + this.groupBox5.Location = new System.Drawing.Point(12, 358); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(377, 182); this.groupBox5.TabIndex = 63; @@ -414,6 +416,8 @@ private void InitializeComponent() // // groupBox4 // + this.groupBox4.Controls.Add(this.label11); + this.groupBox4.Controls.Add(this.textBox_revisionnumber); this.groupBox4.Controls.Add(this.textBox_productnumber); this.groupBox4.Controls.Add(this.textBox_productname); this.groupBox4.Controls.Add(this.textBox_vendornumber); @@ -424,7 +428,7 @@ private void InitializeComponent() this.groupBox4.Controls.Add(this.label26); this.groupBox4.Location = new System.Drawing.Point(12, 14); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(377, 126); + this.groupBox4.Size = new System.Drawing.Size(377, 152); this.groupBox4.TabIndex = 0; this.groupBox4.TabStop = false; this.groupBox4.Text = "Device Info"; @@ -743,7 +747,7 @@ private void InitializeComponent() this.groupBox3.Controls.Add(this.label22); this.groupBox3.Controls.Add(this.label20); this.groupBox3.Controls.Add(this.label18); - this.groupBox3.Location = new System.Drawing.Point(12, 146); + this.groupBox3.Location = new System.Drawing.Point(12, 172); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(377, 180); this.groupBox3.TabIndex = 1; @@ -847,6 +851,22 @@ private void InitializeComponent() this.label18.TabIndex = 18; this.label18.Text = "File version"; // + // textBox_revisionnumber + // + this.textBox_revisionnumber.Location = new System.Drawing.Point(139, 124); + this.textBox_revisionnumber.Name = "textBox_revisionnumber"; + this.textBox_revisionnumber.Size = new System.Drawing.Size(226, 20); + this.textBox_revisionnumber.TabIndex = 38; + // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(10, 127); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(88, 13); + this.label11.TabIndex = 39; + this.label11.Text = "Revision Number"; + // // DeviceInfoView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -949,5 +969,7 @@ private void InitializeComponent() private System.Windows.Forms.Label label10; private System.Windows.Forms.CheckBox checkBox_ngMaster; private System.Windows.Forms.CheckBox checkBox_ngSlave; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox textBox_revisionnumber; } } diff --git a/EDSEditorGUI/DeviceInfoView.cs b/EDSEditorGUI/DeviceInfoView.cs index 20ef719d..4a18dcfd 100644 --- a/EDSEditorGUI/DeviceInfoView.cs +++ b/EDSEditorGUI/DeviceInfoView.cs @@ -44,6 +44,7 @@ public void populatedeviceinfo() textBox_productnumber.Text = eds.di.ProductNumber; textBox_vendorname.Text = eds.di.VendorName; textBox_vendornumber.Text = eds.di.VendorNumber; + textBox_revisionnumber.Text = eds.di.RevisionNumber; textBox_fileversion.Text = eds.fi.FileVersion; textBox_di_description.Text = eds.fi.Description; @@ -140,6 +141,7 @@ private void update_devfile_info() eds.di.ProductNumber = textBox_productnumber.Text; eds.di.VendorName = textBox_vendorname.Text; eds.di.VendorNumber = textBox_vendornumber.Text; + eds.di.RevisionNumber = textBox_revisionnumber.Text; eds.fi.FileVersion = textBox_fileversion.Text; eds.fi.Description = textBox_di_description.Text; diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index 0530d652..bd4305ac 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -679,7 +679,7 @@ public partial class DeviceInfo : InfoSection /// product revision number according to identity object sub-index 03h (Unsigned32) /// [EdsExport] - public UInt32 RevisionNumber; + public string RevisionNumber=""; /// /// indicate the supported baud rates (Boolean, 0 = not supported, 1=supported) From 6f93f4e49f837a60ca72bd8cab4ed2fda1cfd2ac Mon Sep 17 00:00:00 2001 From: temi54c1l8 Date: Thu, 30 May 2024 11:24:20 +0200 Subject: [PATCH 02/16] Save revisionNumber on XDD file --- libEDSsharp/CanOpenXDD_1_1.cs | 3 ++ libEDSsharp/CanOpenXSD_1_1.cs | 80 +++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 5c682027..47414280 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -954,6 +954,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_device.DeviceIdentity = new DeviceIdentity(); body_device.DeviceIdentity.vendorName = new vendorName { Value = eds.di.VendorName }; body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber }; + body_device.DeviceIdentity.revisionNumber = new revisionNumber { Value = eds.di.RevisionNumber }; body_device.DeviceIdentity.productName = new productName { Value = eds.di.ProductName }; body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber }; if (eds.fi.Description != null && eds.fi.Description != "") @@ -1256,6 +1257,8 @@ private EDSsharp Convert(ISO15745ProfileContainer container) eds.di.VendorName = body_device.DeviceIdentity.vendorName.Value ?? ""; if (body_device.DeviceIdentity.vendorID != null) eds.di.VendorNumber = body_device.DeviceIdentity.vendorID.Value ?? ""; + if (body_device.DeviceIdentity.revisionNumber != null) + eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value ?? ""; if (body_device.DeviceIdentity.productName != null) eds.di.ProductName = body_device.DeviceIdentity.productName.Value ?? ""; if (body_device.DeviceIdentity.productID != null) diff --git a/libEDSsharp/CanOpenXSD_1_1.cs b/libEDSsharp/CanOpenXSD_1_1.cs index 4ef42cf8..135dbc6a 100644 --- a/libEDSsharp/CanOpenXSD_1_1.cs +++ b/libEDSsharp/CanOpenXSD_1_1.cs @@ -683,6 +683,8 @@ public partial class ProfileBody_CommunicationNetwork_CANopenApplicationLayersId private vendorID vendorIDField; + private revisionNumber revisionNumberField; + private deviceFamily deviceFamilyField; private productID productIDField; @@ -706,6 +708,20 @@ public vendorID vendorID { } } + /// + [System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.canopen.org/xml/1.1")] + public revisionNumber revisionNumer + { + get + { + return this.revisionNumberField; + } + set + { + this.revisionNumberField = value; + } + } + /// [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.canopen.org/xml/1.1")] public deviceFamily deviceFamily { @@ -814,6 +830,55 @@ public string Value { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.canopen.org/xml/1.1")] + [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.canopen.org/xml/1.1", IsNullable = false)] + public partial class revisionNumber + { + + private bool readOnlyField; + + private string valueField; + + public revisionNumber() + { + this.readOnlyField = true; + } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(true)] + public bool readOnly + { + get + { + return this.readOnlyField; + } + set + { + this.readOnlyField = value; + } + } + + /// + [System.Xml.Serialization.XmlTextAttribute()] + public string Value + { + get + { + return this.valueField; + } + set + { + this.valueField = value; + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] [System.SerializableAttribute()] @@ -3306,6 +3371,8 @@ public partial class DeviceIdentity { private vendorID vendorIDField; + private revisionNumber revisionNumberField; + private vendorText vendorTextField; private deviceFamily deviceFamilyField; @@ -3350,6 +3417,19 @@ public vendorID vendorID { } } + /// + public revisionNumber revisionNumber + { + get + { + return this.revisionNumberField; + } + set + { + this.revisionNumberField = value; + } + } + /// public vendorText vendorText { get { From ec3b63ab40b6bc7b75611645976ca9cf6814dd7b Mon Sep 17 00:00:00 2001 From: temi54c1l8 Date: Wed, 5 Jun 2024 18:02:35 +0200 Subject: [PATCH 03/16] Implemented OrderCode (cherry picked from commit 5d945264adfbc4c7a4f0c8cea723520554974c61) --- EDSEditorGUI/DeviceInfoView.Designer.cs | 58 ++++++++++++------ EDSEditorGUI/DeviceInfoView.cs | 2 + libEDSsharp/CanOpenXDD_1_1.cs | 3 + libEDSsharp/CanOpenXSD_1_1.cs | 80 +++++++++++++++++++++++++ libEDSsharp/eds.cs | 5 ++ 5 files changed, 130 insertions(+), 18 deletions(-) diff --git a/EDSEditorGUI/DeviceInfoView.Designer.cs b/EDSEditorGUI/DeviceInfoView.Designer.cs index dd147320..41a66216 100644 --- a/EDSEditorGUI/DeviceInfoView.Designer.cs +++ b/EDSEditorGUI/DeviceInfoView.Designer.cs @@ -60,6 +60,8 @@ private void InitializeComponent() this.label32 = new System.Windows.Forms.Label(); this.textBox_concretenodeid = new System.Windows.Forms.TextBox(); this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.label11 = new System.Windows.Forms.Label(); + this.textBox_revisionnumber = new System.Windows.Forms.TextBox(); this.textBox_productnumber = new System.Windows.Forms.TextBox(); this.textBox_productname = new System.Windows.Forms.TextBox(); this.textBox_vendornumber = new System.Windows.Forms.TextBox(); @@ -104,8 +106,8 @@ private void InitializeComponent() this.label22 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label(); this.label18 = new System.Windows.Forms.Label(); - this.textBox_revisionnumber = new System.Windows.Forms.TextBox(); - this.label11 = new System.Windows.Forms.Label(); + this.textBox_ordercode = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); this.groupBox5.SuspendLayout(); this.groupBox6.SuspendLayout(); @@ -125,7 +127,7 @@ private void InitializeComponent() this.panel1.Controls.Add(this.groupBox3); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(773, 807); + this.panel1.Size = new System.Drawing.Size(773, 833); this.panel1.TabIndex = 60; // // groupBox5 @@ -144,7 +146,7 @@ private void InitializeComponent() this.groupBox5.Controls.Add(this.label31); this.groupBox5.Controls.Add(this.textBox_projectFileName); this.groupBox5.Controls.Add(this.textBox_deviceedsname); - this.groupBox5.Location = new System.Drawing.Point(12, 358); + this.groupBox5.Location = new System.Drawing.Point(12, 384); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(377, 182); this.groupBox5.TabIndex = 63; @@ -416,6 +418,8 @@ private void InitializeComponent() // // groupBox4 // + this.groupBox4.Controls.Add(this.label12); + this.groupBox4.Controls.Add(this.textBox_ordercode); this.groupBox4.Controls.Add(this.label11); this.groupBox4.Controls.Add(this.textBox_revisionnumber); this.groupBox4.Controls.Add(this.textBox_productnumber); @@ -428,11 +432,27 @@ private void InitializeComponent() this.groupBox4.Controls.Add(this.label26); this.groupBox4.Location = new System.Drawing.Point(12, 14); this.groupBox4.Name = "groupBox4"; - this.groupBox4.Size = new System.Drawing.Size(377, 152); + this.groupBox4.Size = new System.Drawing.Size(377, 178); this.groupBox4.TabIndex = 0; this.groupBox4.TabStop = false; this.groupBox4.Text = "Device Info"; // + // label11 + // + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(10, 127); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(88, 13); + this.label11.TabIndex = 39; + this.label11.Text = "Revision Number"; + // + // textBox_revisionnumber + // + this.textBox_revisionnumber.Location = new System.Drawing.Point(139, 124); + this.textBox_revisionnumber.Name = "textBox_revisionnumber"; + this.textBox_revisionnumber.Size = new System.Drawing.Size(226, 20); + this.textBox_revisionnumber.TabIndex = 38; + // // textBox_productnumber // this.textBox_productnumber.Location = new System.Drawing.Point(139, 46); @@ -747,7 +767,7 @@ private void InitializeComponent() this.groupBox3.Controls.Add(this.label22); this.groupBox3.Controls.Add(this.label20); this.groupBox3.Controls.Add(this.label18); - this.groupBox3.Location = new System.Drawing.Point(12, 172); + this.groupBox3.Location = new System.Drawing.Point(12, 198); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(377, 180); this.groupBox3.TabIndex = 1; @@ -851,21 +871,21 @@ private void InitializeComponent() this.label18.TabIndex = 18; this.label18.Text = "File version"; // - // textBox_revisionnumber + // textBox_ordercode // - this.textBox_revisionnumber.Location = new System.Drawing.Point(139, 124); - this.textBox_revisionnumber.Name = "textBox_revisionnumber"; - this.textBox_revisionnumber.Size = new System.Drawing.Size(226, 20); - this.textBox_revisionnumber.TabIndex = 38; + this.textBox_ordercode.Location = new System.Drawing.Point(139, 150); + this.textBox_ordercode.Name = "textBox_ordercode"; + this.textBox_ordercode.Size = new System.Drawing.Size(226, 20); + this.textBox_ordercode.TabIndex = 40; // - // label11 + // label12 // - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(10, 127); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(88, 13); - this.label11.TabIndex = 39; - this.label11.Text = "Revision Number"; + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(10, 153); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(58, 13); + this.label12.TabIndex = 41; + this.label12.Text = "OrderCode"; // // DeviceInfoView // @@ -971,5 +991,7 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox checkBox_ngSlave; private System.Windows.Forms.Label label11; private System.Windows.Forms.TextBox textBox_revisionnumber; + private System.Windows.Forms.TextBox textBox_ordercode; + private System.Windows.Forms.Label label12; } } diff --git a/EDSEditorGUI/DeviceInfoView.cs b/EDSEditorGUI/DeviceInfoView.cs index 4a18dcfd..344a0cb7 100644 --- a/EDSEditorGUI/DeviceInfoView.cs +++ b/EDSEditorGUI/DeviceInfoView.cs @@ -45,6 +45,7 @@ public void populatedeviceinfo() textBox_vendorname.Text = eds.di.VendorName; textBox_vendornumber.Text = eds.di.VendorNumber; textBox_revisionnumber.Text = eds.di.RevisionNumber; + textBox_ordercode.Text = eds.di.OrderCode; textBox_fileversion.Text = eds.fi.FileVersion; textBox_di_description.Text = eds.fi.Description; @@ -142,6 +143,7 @@ private void update_devfile_info() eds.di.VendorName = textBox_vendorname.Text; eds.di.VendorNumber = textBox_vendornumber.Text; eds.di.RevisionNumber = textBox_revisionnumber.Text; + eds.di.OrderCode = textBox_ordercode.Text; eds.fi.FileVersion = textBox_fileversion.Text; eds.fi.Description = textBox_di_description.Text; diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 47414280..137f1a84 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -955,6 +955,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_device.DeviceIdentity.vendorName = new vendorName { Value = eds.di.VendorName }; body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber }; body_device.DeviceIdentity.revisionNumber = new revisionNumber { Value = eds.di.RevisionNumber }; + body_device.DeviceIdentity.orderCode = new orderCode { Value = eds.di.OrderCode }; body_device.DeviceIdentity.productName = new productName { Value = eds.di.ProductName }; body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber }; if (eds.fi.Description != null && eds.fi.Description != "") @@ -1259,6 +1260,8 @@ private EDSsharp Convert(ISO15745ProfileContainer container) eds.di.VendorNumber = body_device.DeviceIdentity.vendorID.Value ?? ""; if (body_device.DeviceIdentity.revisionNumber != null) eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value ?? ""; + if (body_device.DeviceIdentity.orderCode != null) + eds.di.OrderCode = body_device.DeviceIdentity.orderCode.Value ?? ""; if (body_device.DeviceIdentity.productName != null) eds.di.ProductName = body_device.DeviceIdentity.productName.Value ?? ""; if (body_device.DeviceIdentity.productID != null) diff --git a/libEDSsharp/CanOpenXSD_1_1.cs b/libEDSsharp/CanOpenXSD_1_1.cs index 135dbc6a..6af9c201 100644 --- a/libEDSsharp/CanOpenXSD_1_1.cs +++ b/libEDSsharp/CanOpenXSD_1_1.cs @@ -685,6 +685,8 @@ public partial class ProfileBody_CommunicationNetwork_CANopenApplicationLayersId private revisionNumber revisionNumberField; + private orderCode orderCodeField; + private deviceFamily deviceFamilyField; private productID productIDField; @@ -722,6 +724,20 @@ public revisionNumber revisionNumer } } + /// + [System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.canopen.org/xml/1.1")] + public orderCode orderCode + { + get + { + return this.orderCodeField; + } + set + { + this.orderCodeField = value; + } + } + /// [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.canopen.org/xml/1.1")] public deviceFamily deviceFamily { @@ -879,6 +895,55 @@ public string Value } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.canopen.org/xml/1.1")] + [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.canopen.org/xml/1.1", IsNullable = false)] + public partial class orderCode + { + + private bool readOnlyField; + + private string valueField; + + public orderCode() + { + this.readOnlyField = true; + } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(true)] + public bool readOnly + { + get + { + return this.readOnlyField; + } + set + { + this.readOnlyField = value; + } + } + + /// + [System.Xml.Serialization.XmlTextAttribute()] + public string Value + { + get + { + return this.valueField; + } + set + { + this.valueField = value; + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] [System.SerializableAttribute()] @@ -3373,6 +3438,8 @@ public partial class DeviceIdentity { private revisionNumber revisionNumberField; + private orderCode orderCodeField; + private vendorText vendorTextField; private deviceFamily deviceFamilyField; @@ -3430,6 +3497,19 @@ public revisionNumber revisionNumber } } + /// + public orderCode orderCode + { + get + { + return this.orderCodeField; + } + set + { + this.orderCodeField = value; + } + } + /// public vendorText vendorText { get { diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index bd4305ac..d9b75c4b 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -680,6 +680,11 @@ public partial class DeviceInfo : InfoSection /// [EdsExport] public string RevisionNumber=""; + /// + /// The value indicates the manufacturer specific order code + /// + [EdsExport] + public string OrderCode=""; /// /// indicate the supported baud rates (Boolean, 0 = not supported, 1=supported) From b4f6e3c04853c606760ef4f166260b01f45e595d Mon Sep 17 00:00:00 2001 From: temi54c1l8 Date: Thu, 6 Jun 2024 10:09:11 +0200 Subject: [PATCH 04/16] Change RevisionNumber to UInt32 (cherry picked from commit d4061869275ea6ce1a1a96facb827c91b19a32ef) --- EDSEditorGUI/DeviceInfoView.cs | 4 ++-- libEDSsharp/CanOpenEDS.cs | 5 +++++ libEDSsharp/CanOpenXDD_1_1.cs | 2 +- libEDSsharp/CanOpenXSD_1_1.cs | 5 +++-- libEDSsharp/eds.cs | 2 +- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/EDSEditorGUI/DeviceInfoView.cs b/EDSEditorGUI/DeviceInfoView.cs index 344a0cb7..bd559b1d 100644 --- a/EDSEditorGUI/DeviceInfoView.cs +++ b/EDSEditorGUI/DeviceInfoView.cs @@ -44,7 +44,7 @@ public void populatedeviceinfo() textBox_productnumber.Text = eds.di.ProductNumber; textBox_vendorname.Text = eds.di.VendorName; textBox_vendornumber.Text = eds.di.VendorNumber; - textBox_revisionnumber.Text = eds.di.RevisionNumber; + textBox_revisionnumber.Text = string.Format("0x{0:x8}", eds.di.RevisionNumber); textBox_ordercode.Text = eds.di.OrderCode; textBox_fileversion.Text = eds.fi.FileVersion; @@ -142,7 +142,7 @@ private void update_devfile_info() eds.di.ProductNumber = textBox_productnumber.Text; eds.di.VendorName = textBox_vendorname.Text; eds.di.VendorNumber = textBox_vendornumber.Text; - eds.di.RevisionNumber = textBox_revisionnumber.Text; + eds.di.RevisionNumber = Convert.ToUInt32(textBox_revisionnumber.Text,16); eds.di.OrderCode = textBox_ordercode.Text; eds.fi.FileVersion = textBox_fileversion.Text; diff --git a/libEDSsharp/CanOpenEDS.cs b/libEDSsharp/CanOpenEDS.cs index d4be60f6..9a97f225 100644 --- a/libEDSsharp/CanOpenEDS.cs +++ b/libEDSsharp/CanOpenEDS.cs @@ -22,6 +22,7 @@ You should have received a copy of the GNU General Public License using System.Globalization; using System.IO; using System.Reflection; +using System.Security.Cryptography; using System.Text.RegularExpressions; namespace libEDSsharp @@ -74,6 +75,10 @@ public void Write(StreamWriter writer, Filetype ft) { writer.WriteLine(string.Format("{2}{0}={1}", f.Name, ((bool)f.GetValue(this)) == true ? 1 : 0, comment == true ? ";" : "")); } + else if (f.FieldType.Name == "UInt32") + { + writer.WriteLine(string.Format("{2}{0}={1}", f.Name, string.Format("0x{0:x8}", f.GetValue(this)), comment == true ? ";" : "")); + } else { writer.WriteLine(string.Format("{2}{0}={1}", f.Name, f.GetValue(this).ToString(), comment == true ? ";" : "")); diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 137f1a84..91acb74b 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -1259,7 +1259,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device.DeviceIdentity.vendorID != null) eds.di.VendorNumber = body_device.DeviceIdentity.vendorID.Value ?? ""; if (body_device.DeviceIdentity.revisionNumber != null) - eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value ?? ""; + eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value; if (body_device.DeviceIdentity.orderCode != null) eds.di.OrderCode = body_device.DeviceIdentity.orderCode.Value ?? ""; if (body_device.DeviceIdentity.productName != null) diff --git a/libEDSsharp/CanOpenXSD_1_1.cs b/libEDSsharp/CanOpenXSD_1_1.cs index 6af9c201..67d2fe85 100644 --- a/libEDSsharp/CanOpenXSD_1_1.cs +++ b/libEDSsharp/CanOpenXSD_1_1.cs @@ -12,6 +12,7 @@ // This source code was auto-generated by xsd, Version=4.8.3928.0. // namespace CanOpenXSD_1_1 { + using System; using System.Xml.Serialization; @@ -858,7 +859,7 @@ public partial class revisionNumber private bool readOnlyField; - private string valueField; + private UInt32 valueField; public revisionNumber() { @@ -882,7 +883,7 @@ public bool readOnly /// [System.Xml.Serialization.XmlTextAttribute()] - public string Value + public UInt32 Value { get { diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index d9b75c4b..8fc65256 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -679,7 +679,7 @@ public partial class DeviceInfo : InfoSection /// product revision number according to identity object sub-index 03h (Unsigned32) /// [EdsExport] - public string RevisionNumber=""; + public UInt32 RevisionNumber; /// /// The value indicates the manufacturer specific order code /// From 0e0c08bc16731000a109394b89198d5655b404cf Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 3 Nov 2025 17:13:18 +0200 Subject: [PATCH 05/16] Working on FileVersion & FileRevision --- EDSEditorGUI/DeviceInfoView.cs | 18 +++++++++--------- libEDSsharp/CanOpenXDD.cs | 19 +++++++++---------- libEDSsharp/CanOpenXDD_1_1.cs | 14 +++++++------- libEDSsharp/eds.cs | 8 ++++---- libEDSsharp/libEDSsharp.csproj | 2 +- 5 files changed, 30 insertions(+), 31 deletions(-) diff --git a/EDSEditorGUI/DeviceInfoView.cs b/EDSEditorGUI/DeviceInfoView.cs index bd559b1d..020e1068 100644 --- a/EDSEditorGUI/DeviceInfoView.cs +++ b/EDSEditorGUI/DeviceInfoView.cs @@ -23,8 +23,8 @@ You should have received a copy of the GNU General Public License using System.IO; using System.Runtime.CompilerServices; using System.Drawing; - namespace ODEditor + { public partial class DeviceInfoView : MyTabUserControl { @@ -41,13 +41,13 @@ public void populatedeviceinfo() return; textBox_productname.Text = eds.di.ProductName; - textBox_productnumber.Text = eds.di.ProductNumber; + textBox_productnumber.Text = eds.di.ProductNumber.ToHexString(); textBox_vendorname.Text = eds.di.VendorName; - textBox_vendornumber.Text = eds.di.VendorNumber; - textBox_revisionnumber.Text = string.Format("0x{0:x8}", eds.di.RevisionNumber); + textBox_vendornumber.Text = eds.di.VendorNumber.ToHexString(); + textBox_revisionnumber.Text = eds.di.RevisionNumber.ToHexString(); textBox_ordercode.Text = eds.di.OrderCode; - textBox_fileversion.Text = eds.fi.FileVersion; + textBox_fileversion.Text = eds.fi.FileVersion.ToString(); textBox_di_description.Text = eds.fi.Description; textBox_create_datetime.Text = eds.fi.CreationDateTime.ToString(); textBox_createdby.Text = eds.fi.CreatedBy; @@ -139,13 +139,13 @@ private void update_devfile_info() try { eds.di.ProductName = textBox_productname.Text; - eds.di.ProductNumber = textBox_productnumber.Text; + eds.di.ProductNumber = UInt32.Parse(textBox_productnumber.Text); eds.di.VendorName = textBox_vendorname.Text; - eds.di.VendorNumber = textBox_vendornumber.Text; - eds.di.RevisionNumber = Convert.ToUInt32(textBox_revisionnumber.Text,16); + eds.di.VendorNumber = UInt32.Parse(textBox_vendornumber.Text); + eds.di.RevisionNumber = UInt32.Parse(textBox_revisionnumber.Text); eds.di.OrderCode = textBox_ordercode.Text; - eds.fi.FileVersion = textBox_fileversion.Text; + eds.fi.FileVersion = Byte.Parse(textBox_fileversion.Text); eds.fi.Description = textBox_di_description.Text; eds.fi.CreationDateTime = DateTime.Parse(textBox_create_datetime.Text); eds.fi.CreatedBy = textBox_createdby.Text; diff --git a/libEDSsharp/CanOpenXDD.cs b/libEDSsharp/CanOpenXDD.cs index 165036ca..eb24e4ec 100644 --- a/libEDSsharp/CanOpenXDD.cs +++ b/libEDSsharp/CanOpenXDD.cs @@ -240,7 +240,7 @@ public ISO15745ProfileContainer convert(EDSsharp eds) device.DeviceIdentity.vendorName.readOnly = true; device.DeviceIdentity.vendorID = new vendorID(); - device.DeviceIdentity.vendorID.Value = eds.di.VendorNumber; + device.DeviceIdentity.vendorID.Value = eds.di.VendorNumber.ToHexString(); device.DeviceIdentity.vendorID.readOnly = true; device.DeviceIdentity.deviceFamily = new deviceFamily(); @@ -263,7 +263,7 @@ public ISO15745ProfileContainer convert(EDSsharp eds) device.supportedLanguages = "en"; - device.fileVersion = eds.fi.FileVersion; + device.fileVersion = eds.fi.FileVersion.ToString(); device.fileName = Path.GetFileName(eds.projectFilename); @@ -277,7 +277,7 @@ public ISO15745ProfileContainer convert(EDSsharp eds) device.DeviceIdentity.productName.readOnly = true; device.DeviceIdentity.productID = new productID(); - device.DeviceIdentity.productID.Value = eds.di.ProductNumber; + device.DeviceIdentity.productID.Value = eds.di.ProductNumber.ToHexString(); device.DeviceIdentity.productID.readOnly = true; device.DeviceIdentity.productText = new productText(); @@ -401,7 +401,7 @@ public ISO15745ProfileContainer convert(EDSsharp eds) comnet.fileModificationTime = eds.fi.ModificationDateTime; comnet.fileModificationDateSpecified = true; - comnet.fileVersion = eds.fi.FileVersion; + comnet.fileVersion = eds.fi.FileVersion.ToString(); comnet.supportedLanguages = "en"; @@ -1157,9 +1157,9 @@ public EDSsharp convert(ISO15745ProfileContainer container) if (obj.DeviceIdentity != null) { eds.di.ProductName = obj.DeviceIdentity.productName.Value; - eds.di.ProductNumber = obj.DeviceIdentity.productID.Value; + eds.di.ProductNumber = UInt32.Parse(obj.DeviceIdentity.productID.Value); eds.di.VendorName = obj.DeviceIdentity.vendorName.Value; - eds.di.VendorNumber = obj.DeviceIdentity.vendorID.Value; + eds.di.VendorNumber = UInt32.Parse(obj.DeviceIdentity.vendorID.Value); foreach (object o in obj.DeviceIdentity.productText.Items) { @@ -1184,12 +1184,11 @@ public EDSsharp convert(ISO15745ProfileContainer container) eds.fi.EDSVersion = keyvalue[1]; break; case "FileRevision": - eds.fi.FileVersion = keyvalue[1]; + byte.TryParse(keyvalue[1], out eds.fi.FileVersion); break; case "RevisionNum": - byte.TryParse(keyvalue[1], out eds.fi.FileRevision); break; - - + byte.TryParse(keyvalue[1], out eds.fi.FileRevision); + break; } } } diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 91acb74b..82f4ee11 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -941,7 +941,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_device.fileCreationDate = eds.fi.CreationDateTime; body_device.fileCreationTime = eds.fi.CreationDateTime; body_device.fileCreationTimeSpecified = true; - body_device.fileVersion = eds.fi.FileVersion; + body_device.fileVersion = eds.fi.FileVersion.ToString(); body_device.fileModifiedBy = eds.fi.ModifiedBy; body_device.fileModificationDate = eds.fi.ModificationDateTime; body_device.fileModificationTime = eds.fi.ModificationDateTime; @@ -953,11 +953,11 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev if (body_device.DeviceIdentity == null) body_device.DeviceIdentity = new DeviceIdentity(); body_device.DeviceIdentity.vendorName = new vendorName { Value = eds.di.VendorName }; - body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber }; + body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber.ToHexString() }; body_device.DeviceIdentity.revisionNumber = new revisionNumber { Value = eds.di.RevisionNumber }; body_device.DeviceIdentity.orderCode = new orderCode { Value = eds.di.OrderCode }; body_device.DeviceIdentity.productName = new productName { Value = eds.di.ProductName }; - body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber }; + body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber.ToHexString() }; if (eds.fi.Description != null && eds.fi.Description != "") { body_device.DeviceIdentity.productText = new productText @@ -1052,7 +1052,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_network.fileCreationDate = eds.fi.CreationDateTime; body_network.fileCreationTime = eds.fi.CreationDateTime; body_network.fileCreationTimeSpecified = true; - body_network.fileVersion = eds.fi.FileVersion; + body_network.fileVersion = eds.fi.FileVersion.ToString(); body_network.fileModificationDate = eds.fi.ModificationDateTime; body_network.fileModificationTime = eds.fi.ModificationDateTime; body_network.fileModificationDateSpecified = true; @@ -1234,7 +1234,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device != null) { eds.fi.FileName = body_device.fileName ?? ""; - eds.fi.FileVersion = body_device.fileVersion ?? ""; + eds.fi.FileVersion = Byte.Parse(body_device.fileVersion ?? "0"); eds.fi.CreatedBy = body_device.fileCreator ?? ""; eds.fi.ModifiedBy = body_device.fileModifiedBy ?? ""; @@ -1257,7 +1257,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device.DeviceIdentity.vendorName != null) eds.di.VendorName = body_device.DeviceIdentity.vendorName.Value ?? ""; if (body_device.DeviceIdentity.vendorID != null) - eds.di.VendorNumber = body_device.DeviceIdentity.vendorID.Value ?? ""; + eds.di.VendorNumber = UInt32.Parse(body_device.DeviceIdentity.vendorID.Value ?? "0"); if (body_device.DeviceIdentity.revisionNumber != null) eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value; if (body_device.DeviceIdentity.orderCode != null) @@ -1265,7 +1265,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device.DeviceIdentity.productName != null) eds.di.ProductName = body_device.DeviceIdentity.productName.Value ?? ""; if (body_device.DeviceIdentity.productID != null) - eds.di.ProductNumber = body_device.DeviceIdentity.productID.Value ?? ""; + eds.di.ProductNumber = UInt32.Parse(body_device.DeviceIdentity.productID.Value ?? "0"); if (body_device.DeviceIdentity.productText != null) eds.fi.Description = G_label_getDescription(body_device.DeviceIdentity.productText.Items); } diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index 8fc65256..aa10c1a3 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -582,7 +582,7 @@ public partial class FileInfo : InfoSection /// indicate the actual file version (Unsigned8) /// [EdsExport] - public string FileVersion=""; + public byte FileVersion;//=1; /// /// indicate the actual file revision (Unsigned8) /// @@ -664,7 +664,7 @@ public partial class DeviceInfo : InfoSection /// unique vendor ID according to identity object sub-index 01h (Unsigned32) /// [EdsExport] - public string VendorNumber=""; + public UInt32 VendorNumber; /// /// product name (max. 243 characters) /// @@ -674,7 +674,7 @@ public partial class DeviceInfo : InfoSection /// product code according to identity object sub-index 02h (Unsigned32) /// [EdsExport] - public string ProductNumber=""; + public UInt32 ProductNumber; /// /// product revision number according to identity object sub-index 03h (Unsigned32) /// @@ -1815,7 +1815,7 @@ public EDSsharp() fi.EDSVersionMajor = 4; fi.EDSVersionMinor = 0; - fi.FileVersion = "1"; + fi.FileVersion = 1; fi.FileRevision = 1; fi.CreationDateTime = DateTime.Now; diff --git a/libEDSsharp/libEDSsharp.csproj b/libEDSsharp/libEDSsharp.csproj index 3e443832..7ab914af 100644 --- a/libEDSsharp/libEDSsharp.csproj +++ b/libEDSsharp/libEDSsharp.csproj @@ -64,4 +64,4 @@ - \ No newline at end of file + From 586e2a123bf233986321823867922a1d21d90971 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 3 Nov 2025 18:00:33 +0200 Subject: [PATCH 06/16] Working on file version/revision --- libEDSsharp/CanOpenXDD.cs | 2 +- libEDSsharp/eds.cs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libEDSsharp/CanOpenXDD.cs b/libEDSsharp/CanOpenXDD.cs index eb24e4ec..3f1779f7 100644 --- a/libEDSsharp/CanOpenXDD.cs +++ b/libEDSsharp/CanOpenXDD.cs @@ -1186,7 +1186,7 @@ public EDSsharp convert(ISO15745ProfileContainer container) case "FileRevision": byte.TryParse(keyvalue[1], out eds.fi.FileVersion); break; - case "RevisionNum": + case "RevisionNumber": byte.TryParse(keyvalue[1], out eds.fi.FileRevision); break; } diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index aa10c1a3..9a8d760a 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -589,6 +589,13 @@ public partial class FileInfo : InfoSection [EdsExport] public byte FileRevision;//=1 + /// + /// indicate the file version as a vendor-specific string + /// + [EdsExport(commentonly = true)] + public string fileVersionString = ""; + + [DcfExport] public string LastEDS = ""; From 1bccfda028ff755a7471316a3ee94c006d786ab6 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 3 Nov 2025 21:57:03 +0200 Subject: [PATCH 07/16] FileVersion and FileRevision read correctly from XDD --- EDSEditorGUI/DeviceInfoView.cs | 10 +++++----- libEDSsharp/CanOpenEDS.cs | 23 ++++++++++++++++++++++- libEDSsharp/CanOpenXDD_1_1.cs | 11 +++++------ libEDSsharp/eds.cs | 5 ++--- libEDSsharp/proto/CanOpen.proto | 4 ++++ 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/EDSEditorGUI/DeviceInfoView.cs b/EDSEditorGUI/DeviceInfoView.cs index 020e1068..ad67878e 100644 --- a/EDSEditorGUI/DeviceInfoView.cs +++ b/EDSEditorGUI/DeviceInfoView.cs @@ -47,7 +47,7 @@ public void populatedeviceinfo() textBox_revisionnumber.Text = eds.di.RevisionNumber.ToHexString(); textBox_ordercode.Text = eds.di.OrderCode; - textBox_fileversion.Text = eds.fi.FileVersion.ToString(); + textBox_fileversion.Text = eds.fi.fileVersionString; textBox_di_description.Text = eds.fi.Description; textBox_create_datetime.Text = eds.fi.CreationDateTime.ToString(); textBox_createdby.Text = eds.fi.CreatedBy; @@ -139,13 +139,13 @@ private void update_devfile_info() try { eds.di.ProductName = textBox_productname.Text; - eds.di.ProductNumber = UInt32.Parse(textBox_productnumber.Text); + eds.di.ProductNumber = EDSsharp.U32Parse(textBox_productnumber.Text); eds.di.VendorName = textBox_vendorname.Text; - eds.di.VendorNumber = UInt32.Parse(textBox_vendornumber.Text); - eds.di.RevisionNumber = UInt32.Parse(textBox_revisionnumber.Text); + eds.di.VendorNumber = EDSsharp.U32Parse(textBox_vendornumber.Text); + eds.di.RevisionNumber = EDSsharp.U32Parse(textBox_revisionnumber.Text); eds.di.OrderCode = textBox_ordercode.Text; - eds.fi.FileVersion = Byte.Parse(textBox_fileversion.Text); + eds.fi.fileVersionString = textBox_fileversion.Text; eds.fi.Description = textBox_di_description.Text; eds.fi.CreationDateTime = DateTime.Parse(textBox_create_datetime.Text); eds.fi.CreatedBy = textBox_createdby.Text; diff --git a/libEDSsharp/CanOpenEDS.cs b/libEDSsharp/CanOpenEDS.cs index 9a97f225..c88c814b 100644 --- a/libEDSsharp/CanOpenEDS.cs +++ b/libEDSsharp/CanOpenEDS.cs @@ -1025,6 +1025,17 @@ void ApplycompactPDO(UInt16 index) } } } + public static UInt32 U32Parse(string str) + { + if (str.Trim().ToLower().StartsWith("0x")) + { + return System.Convert.ToUInt32(str, 16); + } + else + { + return System.Convert.ToUInt32(str); + } + } /// /// This function scans the PDO list and compares it to NrOfRXPDO and NrOfTXPDO @@ -1064,7 +1075,15 @@ protected void ApplyimplicitPDO() } UpdatePDOcount(); } - + private void GetEDSFileInfo() + { + string[] nums = fi.fileVersionString.Split('.'); + if (nums.Length == 2) + { + byte.TryParse(nums[0], out fi.FileVersion); + byte.TryParse(nums[1], out fi.FileRevision); + } + } public void Savefile(string filename, InfoSection.Filetype ft) { if (ft == InfoSection.Filetype.File_EDS) @@ -1092,6 +1111,8 @@ public void Savefile(string filename, InfoSection.Filetype ft) fi.EDSVersionMajor = 4; fi.EDSVersionMinor = 0; + GetEDSFileInfo(); + StreamWriter writer = System.IO.File.CreateText(filename); writer.NewLine = "\n"; fi.Write(writer, ft); diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 82f4ee11..1663b07d 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -941,7 +941,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_device.fileCreationDate = eds.fi.CreationDateTime; body_device.fileCreationTime = eds.fi.CreationDateTime; body_device.fileCreationTimeSpecified = true; - body_device.fileVersion = eds.fi.FileVersion.ToString(); + body_device.fileVersion = eds.fi.fileVersionString; body_device.fileModifiedBy = eds.fi.ModifiedBy; body_device.fileModificationDate = eds.fi.ModificationDateTime; body_device.fileModificationTime = eds.fi.ModificationDateTime; @@ -1052,7 +1052,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_network.fileCreationDate = eds.fi.CreationDateTime; body_network.fileCreationTime = eds.fi.CreationDateTime; body_network.fileCreationTimeSpecified = true; - body_network.fileVersion = eds.fi.FileVersion.ToString(); + body_network.fileVersion = eds.fi.FileVersion.ToString() + "." + eds.fi.FileRevision.ToString(); body_network.fileModificationDate = eds.fi.ModificationDateTime; body_network.fileModificationTime = eds.fi.ModificationDateTime; body_network.fileModificationDateSpecified = true; @@ -1213,7 +1213,6 @@ private string G_label_getDescription(object[] items) { } return ""; } - private EDSsharp Convert(ISO15745ProfileContainer container) { EDSsharp eds = new EDSsharp(); @@ -1234,7 +1233,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device != null) { eds.fi.FileName = body_device.fileName ?? ""; - eds.fi.FileVersion = Byte.Parse(body_device.fileVersion ?? "0"); + eds.fi.fileVersionString = body_device.fileVersion ?? ""; eds.fi.CreatedBy = body_device.fileCreator ?? ""; eds.fi.ModifiedBy = body_device.fileModifiedBy ?? ""; @@ -1257,7 +1256,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device.DeviceIdentity.vendorName != null) eds.di.VendorName = body_device.DeviceIdentity.vendorName.Value ?? ""; if (body_device.DeviceIdentity.vendorID != null) - eds.di.VendorNumber = UInt32.Parse(body_device.DeviceIdentity.vendorID.Value ?? "0"); + eds.di.VendorNumber = EDSsharp.U32Parse(body_device.DeviceIdentity.vendorID.Value ?? "0"); if (body_device.DeviceIdentity.revisionNumber != null) eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value; if (body_device.DeviceIdentity.orderCode != null) @@ -1265,7 +1264,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container) if (body_device.DeviceIdentity.productName != null) eds.di.ProductName = body_device.DeviceIdentity.productName.Value ?? ""; if (body_device.DeviceIdentity.productID != null) - eds.di.ProductNumber = UInt32.Parse(body_device.DeviceIdentity.productID.Value ?? "0"); + eds.di.ProductNumber = EDSsharp.U32Parse(body_device.DeviceIdentity.productID.Value ?? "0"); if (body_device.DeviceIdentity.productText != null) eds.fi.Description = G_label_getDescription(body_device.DeviceIdentity.productText.Items); } diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index 9a8d760a..1c99fbe1 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -654,6 +654,8 @@ public FileInfo() { infoheader = "CAN OPEN FileInfo"; edssection = "FileInfo"; + FileVersion = 1; + FileRevision = 0; } } @@ -1822,9 +1824,6 @@ public EDSsharp() fi.EDSVersionMajor = 4; fi.EDSVersionMinor = 0; - fi.FileVersion = 1; - fi.FileRevision = 1; - fi.CreationDateTime = DateTime.Now; fi.ModificationDateTime = DateTime.Now; diff --git a/libEDSsharp/proto/CanOpen.proto b/libEDSsharp/proto/CanOpen.proto index e6867a0c..9991ab4c 100644 --- a/libEDSsharp/proto/CanOpen.proto +++ b/libEDSsharp/proto/CanOpen.proto @@ -19,7 +19,11 @@ message CanOpen_FileInfo message CanOpen_DeviceInfo { string vendorName = 1; // Vendor name. + uint32 vendorID = 2; // Vendor ID string productName = 3; // Product name. + uint32 productID = 4; // Product ID + uint32 revisionNumber = 5; // Revision number + string orderCode = 6; // Order code bool baudRate10 = 100; // Support of the baud rate 10 kbit/s. bool baudRate20 = 101; // Support of the baud rate 20 kbit/s. bool baudRate50 = 102; // Support of the baud rate 50 kbit/s. From 168013028698623bef7c356cd71ff2c9e7c4d39e Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 3 Nov 2025 23:38:48 +0200 Subject: [PATCH 08/16] Restored XSD --- libEDSsharp/CanOpenXSD_1_1.cs | 161 ---------------------------------- 1 file changed, 161 deletions(-) diff --git a/libEDSsharp/CanOpenXSD_1_1.cs b/libEDSsharp/CanOpenXSD_1_1.cs index 67d2fe85..4ef42cf8 100644 --- a/libEDSsharp/CanOpenXSD_1_1.cs +++ b/libEDSsharp/CanOpenXSD_1_1.cs @@ -12,7 +12,6 @@ // This source code was auto-generated by xsd, Version=4.8.3928.0. // namespace CanOpenXSD_1_1 { - using System; using System.Xml.Serialization; @@ -684,10 +683,6 @@ public partial class ProfileBody_CommunicationNetwork_CANopenApplicationLayersId private vendorID vendorIDField; - private revisionNumber revisionNumberField; - - private orderCode orderCodeField; - private deviceFamily deviceFamilyField; private productID productIDField; @@ -711,34 +706,6 @@ public vendorID vendorID { } } - /// - [System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.canopen.org/xml/1.1")] - public revisionNumber revisionNumer - { - get - { - return this.revisionNumberField; - } - set - { - this.revisionNumberField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute(Namespace = "http://www.canopen.org/xml/1.1")] - public orderCode orderCode - { - get - { - return this.orderCodeField; - } - set - { - this.orderCodeField = value; - } - } - /// [System.Xml.Serialization.XmlElementAttribute(Namespace="http://www.canopen.org/xml/1.1")] public deviceFamily deviceFamily { @@ -847,104 +814,6 @@ public string Value { } } - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.canopen.org/xml/1.1")] - [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.canopen.org/xml/1.1", IsNullable = false)] - public partial class revisionNumber - { - - private bool readOnlyField; - - private UInt32 valueField; - - public revisionNumber() - { - this.readOnlyField = true; - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - [System.ComponentModel.DefaultValueAttribute(true)] - public bool readOnly - { - get - { - return this.readOnlyField; - } - set - { - this.readOnlyField = value; - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public UInt32 Value - { - get - { - return this.valueField; - } - set - { - this.valueField = value; - } - } - } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] - [System.SerializableAttribute()] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - [System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true, Namespace = "http://www.canopen.org/xml/1.1")] - [System.Xml.Serialization.XmlRootAttribute(Namespace = "http://www.canopen.org/xml/1.1", IsNullable = false)] - public partial class orderCode - { - - private bool readOnlyField; - - private string valueField; - - public orderCode() - { - this.readOnlyField = true; - } - - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - [System.ComponentModel.DefaultValueAttribute(true)] - public bool readOnly - { - get - { - return this.readOnlyField; - } - set - { - this.readOnlyField = value; - } - } - - /// - [System.Xml.Serialization.XmlTextAttribute()] - public string Value - { - get - { - return this.valueField; - } - set - { - this.valueField = value; - } - } - } - /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0")] [System.SerializableAttribute()] @@ -3437,10 +3306,6 @@ public partial class DeviceIdentity { private vendorID vendorIDField; - private revisionNumber revisionNumberField; - - private orderCode orderCodeField; - private vendorText vendorTextField; private deviceFamily deviceFamilyField; @@ -3485,32 +3350,6 @@ public vendorID vendorID { } } - /// - public revisionNumber revisionNumber - { - get - { - return this.revisionNumberField; - } - set - { - this.revisionNumberField = value; - } - } - - /// - public orderCode orderCode - { - get - { - return this.orderCodeField; - } - set - { - this.orderCodeField = value; - } - } - /// public vendorText vendorText { get { From 0ee349295ab9dae393380d3a3d209a1a87ab15ef Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Tue, 4 Nov 2025 00:19:54 +0200 Subject: [PATCH 09/16] RevisionNumber and OrderCode set in XDD/XSD --- libEDSsharp/CanOpenXDD_1_1.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 1663b07d..92b83371 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -954,8 +954,8 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_device.DeviceIdentity = new DeviceIdentity(); body_device.DeviceIdentity.vendorName = new vendorName { Value = eds.di.VendorName }; body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber.ToHexString() }; - body_device.DeviceIdentity.revisionNumber = new revisionNumber { Value = eds.di.RevisionNumber }; - body_device.DeviceIdentity.orderCode = new orderCode { Value = eds.di.OrderCode }; + body_device.DeviceIdentity.specificationRevision = new specificationRevision { Value = eds.di.RevisionNumber.ToString() }; + body_device.DeviceIdentity.orderNumber = new orderNumber[] { new orderNumber { Value = eds.di.OrderCode } }; body_device.DeviceIdentity.productName = new productName { Value = eds.di.ProductName }; body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber.ToHexString() }; if (eds.fi.Description != null && eds.fi.Description != "") @@ -1257,10 +1257,10 @@ private EDSsharp Convert(ISO15745ProfileContainer container) eds.di.VendorName = body_device.DeviceIdentity.vendorName.Value ?? ""; if (body_device.DeviceIdentity.vendorID != null) eds.di.VendorNumber = EDSsharp.U32Parse(body_device.DeviceIdentity.vendorID.Value ?? "0"); - if (body_device.DeviceIdentity.revisionNumber != null) - eds.di.RevisionNumber = body_device.DeviceIdentity.revisionNumber.Value; - if (body_device.DeviceIdentity.orderCode != null) - eds.di.OrderCode = body_device.DeviceIdentity.orderCode.Value ?? ""; + if (body_device.DeviceIdentity.specificationRevision != null) + eds.di.RevisionNumber = EDSsharp.U32Parse(body_device.DeviceIdentity.specificationRevision.Value ?? "0") ; + if (body_device.DeviceIdentity.orderNumber != null) + eds.di.OrderCode = body_device.DeviceIdentity.orderNumber[0].Value ?? ""; if (body_device.DeviceIdentity.productName != null) eds.di.ProductName = body_device.DeviceIdentity.productName.Value ?? ""; if (body_device.DeviceIdentity.productID != null) From 37a36868f081f7ee5a0db526df6b644ca21d6c88 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Tue, 4 Nov 2025 15:33:57 +0200 Subject: [PATCH 10/16] Updated Hex string format --- libEDSsharp/CanOpenXDD_1_1.cs | 2 +- libEDSsharp/extensions.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs index 92b83371..682bf004 100644 --- a/libEDSsharp/CanOpenXDD_1_1.cs +++ b/libEDSsharp/CanOpenXDD_1_1.cs @@ -954,7 +954,7 @@ private ISO15745ProfileContainer Convert(EDSsharp eds, string fileName, bool dev body_device.DeviceIdentity = new DeviceIdentity(); body_device.DeviceIdentity.vendorName = new vendorName { Value = eds.di.VendorName }; body_device.DeviceIdentity.vendorID = new vendorID { Value = eds.di.VendorNumber.ToHexString() }; - body_device.DeviceIdentity.specificationRevision = new specificationRevision { Value = eds.di.RevisionNumber.ToString() }; + body_device.DeviceIdentity.specificationRevision = new specificationRevision { Value = eds.di.RevisionNumber.ToHexString() }; body_device.DeviceIdentity.orderNumber = new orderNumber[] { new orderNumber { Value = eds.di.OrderCode } }; body_device.DeviceIdentity.productName = new productName { Value = eds.di.ProductName }; body_device.DeviceIdentity.productID = new productID { Value = eds.di.ProductNumber.ToHexString() }; diff --git a/libEDSsharp/extensions.cs b/libEDSsharp/extensions.cs index f6ee903e..d45339c4 100644 --- a/libEDSsharp/extensions.cs +++ b/libEDSsharp/extensions.cs @@ -18,7 +18,7 @@ public static class extensions /// hexadecimal string representing the value public static string ToHexString(this byte val) { - return String.Format("0x{0:x}", val); + return String.Format("0x{0:X2}", val); } /// /// returns a string containing the value as hexadecimal @@ -27,7 +27,7 @@ public static string ToHexString(this byte val) /// hexadecimal string representing the value public static string ToHexString(this UInt16 val) { - return String.Format("0x{0:x}",val); + return String.Format("0x{0:X4}",val); } /// /// returns a string containing the value as hexadecimal @@ -36,7 +36,7 @@ public static string ToHexString(this UInt16 val) /// hexadecimal string representing the value public static string ToHexString(this UInt32 val) { - return String.Format("0x{0:x}", val); + return String.Format("0x{0:X8}", val); } } From d583899a9fcfc2ebb12edde0415c6722f63d1831 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Tue, 4 Nov 2025 17:39:45 +0200 Subject: [PATCH 11/16] Updated identity output --- Tests/EDSMappingTests.cs | 7 ++++--- libEDSsharp/CanOpenNodeExporter.cs | 6 +++--- libEDSsharp/CanOpenNodeExporter_V4.cs | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Tests/EDSMappingTests.cs b/Tests/EDSMappingTests.cs index ba239650..63675c52 100644 --- a/Tests/EDSMappingTests.cs +++ b/Tests/EDSMappingTests.cs @@ -51,8 +51,9 @@ public void Test_ToProtobufferFileInfo() CreationDate = "01-20-2000", CreationTime = "12:20am", Description = "Description", + FileVersion = (byte)'X', FileRevision = (byte)'A', - FileVersion = "1.0.0", + fileVersionString = "1.0.0", ModificationDate = "02-10-1000", ModificationTime = "12:20pm", ModifiedBy = "ModifiedBy" @@ -68,7 +69,7 @@ public void Test_ToProtobufferFileInfo() Assert.Equal(eds.fi.CreatedBy, tmp.FileInfo.CreatedBy); Assert.Equal(creationTimestamp, tmp.FileInfo.CreationTime); Assert.Equal(eds.fi.Description, tmp.FileInfo.Description); - Assert.Equal(eds.fi.FileVersion, tmp.FileInfo.FileVersion); + Assert.Equal(eds.fi.fileVersionString, tmp.FileInfo.FileVersion); Assert.Equal(eds.fi.ModifiedBy, tmp.FileInfo.ModifiedBy); Assert.Equal(modificationTimestamp, tmp.FileInfo.ModificationTime); } @@ -371,7 +372,7 @@ public void Test_FromProtobufferFileInfo() Assert.Equal(d.FileInfo.CreationTime.ToDateTime().ToString("h:mmtt"), tmp.fi.CreationTime); Assert.Equal(d.FileInfo.CreationTime.ToDateTime().ToString("MM-dd-yyyy"), tmp.fi.CreationDate); Assert.Equal(d.FileInfo.Description, tmp.fi.Description); - Assert.Equal(d.FileInfo.FileVersion, tmp.fi.FileVersion); + Assert.Equal(d.FileInfo.FileVersion, tmp.fi.fileVersionString); Assert.Equal(d.FileInfo.ModifiedBy, tmp.fi.ModifiedBy); Assert.Equal(d.FileInfo.ModificationTime.ToDateTime().ToString("h:mmtt"), tmp.fi.ModificationTime); Assert.Equal(d.FileInfo.ModificationTime.ToDateTime().ToString("MM-dd-yyyy"), tmp.fi.ModificationDate); diff --git a/libEDSsharp/CanOpenNodeExporter.cs b/libEDSsharp/CanOpenNodeExporter.cs index df728b8d..df2b8eaa 100644 --- a/libEDSsharp/CanOpenNodeExporter.cs +++ b/libEDSsharp/CanOpenNodeExporter.cs @@ -506,7 +506,7 @@ CANopen DATA TYPES file.WriteLine("/*******************************************************************************"); file.WriteLine(" FILE INFO:"); file.WriteLine(string.Format(" FileName: {0}", Path.GetFileName(eds.projectFilename))); - file.WriteLine(string.Format(" FileVersion: {0}", eds.fi.FileVersion)); + file.WriteLine(string.Format(" FileVersion: {0}", eds.fi.fileVersionString)); file.WriteLine(string.Format(" CreationTime: {0}", eds.fi.CreationTime)); file.WriteLine(string.Format(" CreationDate: {0}", eds.fi.CreationDate)); file.WriteLine(string.Format(" CreatedBy: {0}", eds.fi.CreatedBy)); @@ -517,9 +517,9 @@ CANopen DATA TYPES file.WriteLine("/*******************************************************************************"); file.WriteLine(" DEVICE INFO:"); file.WriteLine(string.Format(" VendorName: {0}", eds.di.VendorName)); - file.WriteLine(string.Format(" VendorNumber: {0}", eds.di.VendorNumber)); + file.WriteLine(string.Format(" VendorNumber: {0}", eds.di.VendorNumber.ToHexString())); file.WriteLine(string.Format(" ProductName: {0}", eds.di.ProductName)); - file.WriteLine(string.Format(" ProductNumber: {0}", eds.di.ProductNumber)); + file.WriteLine(string.Format(" ProductNumber: {0}", eds.di.ProductNumber.ToHexString())); file.WriteLine("*******************************************************************************/"); file.WriteLine(""); file.WriteLine(""); diff --git a/libEDSsharp/CanOpenNodeExporter_V4.cs b/libEDSsharp/CanOpenNodeExporter_V4.cs index 786bb9c1..65d9a852 100644 --- a/libEDSsharp/CanOpenNodeExporter_V4.cs +++ b/libEDSsharp/CanOpenNodeExporter_V4.cs @@ -446,9 +446,9 @@ This file was automatically generated by CANopenEditor {0} Description: {12} *******************************************************************************/", gitVersion, odname, - Path.GetFileName(eds.projectFilename), eds.fi.FileVersion, + Path.GetFileName(eds.projectFilename), eds.fi.fileVersionString, eds.fi.CreationDateTime, eds.fi.CreatedBy, eds.fi.ModificationDateTime, eds.fi.ModifiedBy, - eds.di.VendorName, eds.di.VendorNumber, eds.di.ProductName, eds.di.ProductNumber, + eds.di.VendorName, eds.di.VendorNumber.ToHexString(), eds.di.ProductName, eds.di.ProductNumber.ToHexString(), eds.fi.Description)); file.WriteLine(string.Format(@" From 4fa871fb2f12731616eb7b6801a1ac14c39a2ae2 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 10 Nov 2025 13:29:54 +0200 Subject: [PATCH 12/16] Added Octal support, fixed parsing error handling --- libEDSsharp/CanOpenEDS.cs | 15 ++++++++++++--- libEDSsharp/CanOpenXDD.cs | 12 ++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/libEDSsharp/CanOpenEDS.cs b/libEDSsharp/CanOpenEDS.cs index c88c814b..63b93201 100644 --- a/libEDSsharp/CanOpenEDS.cs +++ b/libEDSsharp/CanOpenEDS.cs @@ -22,7 +22,6 @@ You should have received a copy of the GNU General Public License using System.Globalization; using System.IO; using System.Reflection; -using System.Security.Cryptography; using System.Text.RegularExpressions; namespace libEDSsharp @@ -1027,12 +1026,22 @@ void ApplycompactPDO(UInt16 index) } public static UInt32 U32Parse(string str) { - if (str.Trim().ToLower().StartsWith("0x")) + if (str[0] == '0') { - return System.Convert.ToUInt32(str, 16); + if (str[1] == 'x' || str[1] == 'X') + { + // Hex format + return System.Convert.ToUInt32(str, 16); + } + else + { + // Octal format + return System.Convert.ToUInt32(str, 8); + } } else { + // Decimal format return System.Convert.ToUInt32(str); } } diff --git a/libEDSsharp/CanOpenXDD.cs b/libEDSsharp/CanOpenXDD.cs index 3f1779f7..b7a1d0a4 100644 --- a/libEDSsharp/CanOpenXDD.cs +++ b/libEDSsharp/CanOpenXDD.cs @@ -1184,10 +1184,18 @@ public EDSsharp convert(ISO15745ProfileContainer container) eds.fi.EDSVersion = keyvalue[1]; break; case "FileRevision": - byte.TryParse(keyvalue[1], out eds.fi.FileVersion); + if (byte.TryParse(keyvalue[1], out eds.fi.FileVersion) == false) + { + eds.fi.FileVersion = 0; + Warnings.warning_list.Add("XDD FileRevision value \"" + keyvalue[1] + "\" cannot be parsed!"); + } break; case "RevisionNumber": - byte.TryParse(keyvalue[1], out eds.fi.FileRevision); + if (byte.TryParse(keyvalue[1], out eds.fi.FileRevision) == false) + { + eds.fi.FileRevision = 0; + Warnings.warning_list.Add("XDD RevisionNumber value \"" + keyvalue[1] + "\" cannot be parsed!"); + } break; } } From a8d9ec90051774c4a3c0b7e4bb61bb524d89a89d Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 10 Nov 2025 14:41:40 +0200 Subject: [PATCH 13/16] Improved GetEDSFileInfo() --- libEDSsharp/CanOpenEDS.cs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/libEDSsharp/CanOpenEDS.cs b/libEDSsharp/CanOpenEDS.cs index 63b93201..a52e5244 100644 --- a/libEDSsharp/CanOpenEDS.cs +++ b/libEDSsharp/CanOpenEDS.cs @@ -1089,8 +1089,31 @@ private void GetEDSFileInfo() string[] nums = fi.fileVersionString.Split('.'); if (nums.Length == 2) { - byte.TryParse(nums[0], out fi.FileVersion); - byte.TryParse(nums[1], out fi.FileRevision); + if (byte.TryParse(nums[0], out fi.FileVersion) == false) + { + fi.FileVersion = 1; + Warnings.warning_list.Add("EDS FileVersion cannot be extracted from string \"" + nums[0] +"\", set to 1"); + } + if (byte.TryParse(nums[1], out fi.FileRevision) == false) + { + fi.FileRevision = 0; + Warnings.warning_list.Add("EDS FileRevision cannot be extracted from string \"" + nums[1] + "\", set to 0"); + } + } + else if (nums.Length == 1) + { + if (byte.TryParse(nums[0], out fi.FileVersion) == false) + { + fi.FileVersion = 1; + Warnings.warning_list.Add("EDS FileVersion cannot be extracted from string \"" + nums[0] + "\", set to 1"); + } + fi.FileRevision = 0; + } + else + { + fi.FileVersion = 1; + fi.FileRevision = 0; + Warnings.warning_list.Add("EDS FileVersion and FileRevision cannot be extracted from string \"" + fi.fileVersionString + "\", set to 1.0"); } } public void Savefile(string filename, InfoSection.Filetype ft) From ab69d072c9b7b6c13845799c8b47aa44ba0e589e Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Mon, 10 Nov 2025 19:18:22 +0200 Subject: [PATCH 14/16] Reverted parsing of vendorTextDescription --- libEDSsharp/CanOpenXDD.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libEDSsharp/CanOpenXDD.cs b/libEDSsharp/CanOpenXDD.cs index b7a1d0a4..4d2227c1 100644 --- a/libEDSsharp/CanOpenXDD.cs +++ b/libEDSsharp/CanOpenXDD.cs @@ -1161,6 +1161,7 @@ public EDSsharp convert(ISO15745ProfileContainer container) eds.di.VendorName = obj.DeviceIdentity.vendorName.Value; eds.di.VendorNumber = UInt32.Parse(obj.DeviceIdentity.vendorID.Value); + foreach (object o in obj.DeviceIdentity.productText.Items) { //this is another g_label affair @@ -1190,11 +1191,11 @@ public EDSsharp convert(ISO15745ProfileContainer container) Warnings.warning_list.Add("XDD FileRevision value \"" + keyvalue[1] + "\" cannot be parsed!"); } break; - case "RevisionNumber": + case "RevisionNum": if (byte.TryParse(keyvalue[1], out eds.fi.FileRevision) == false) { eds.fi.FileRevision = 0; - Warnings.warning_list.Add("XDD RevisionNumber value \"" + keyvalue[1] + "\" cannot be parsed!"); + Warnings.warning_list.Add("XDD RevisionNum value \"" + keyvalue[1] + "\" cannot be parsed!"); } break; } From 3e69fe1ca638a1369c1de11323fe8bdd81064645 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Wed, 19 Nov 2025 14:22:22 +0200 Subject: [PATCH 15/16] Fixed mapping for Protobuffer --- libEDSsharp/CanOpenEDSMapping.cs | 6 +++--- libEDSsharp/proto/CanOpen.proto | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libEDSsharp/CanOpenEDSMapping.cs b/libEDSsharp/CanOpenEDSMapping.cs index ce980ef3..358fcf13 100644 --- a/libEDSsharp/CanOpenEDSMapping.cs +++ b/libEDSsharp/CanOpenEDSMapping.cs @@ -99,9 +99,9 @@ public static EDSsharp MapFromProtobuffer(CanOpenDevice source) .ForMember(dest => dest.BaudRate_800, opt => opt.MapFrom(src => src.BaudRate800)) .ForMember(dest => dest.BaudRate_1000, opt => opt.MapFrom(src => src.BaudRate1000)) .ForMember(dest => dest.BaudRate_auto, opt => opt.MapFrom(src => src.BaudRateAuto)) - .ForMember(dest => dest.VendorNumber, opt => opt.Ignore()) - .ForMember(dest => dest.ProductNumber, opt => opt.Ignore()) - .ForMember(dest => dest.RevisionNumber, opt => opt.Ignore()) + .ForMember(dest => dest.VendorNumber, opt => opt.MapFrom(src => src.VendorID)) + .ForMember(dest => dest.ProductNumber, opt => opt.MapFrom(src => src.ProductID)) + .ForMember(dest => dest.RevisionNumber, opt => opt.MapFrom(src => src.RevisionNumber)) .ForMember(dest => dest.SimpleBootUpMaster, opt => opt.Ignore()) .ForMember(dest => dest.SimpleBootUpSlave, opt => opt.Ignore()) .ForMember(dest => dest.Granularity, opt => opt.Ignore()) diff --git a/libEDSsharp/proto/CanOpen.proto b/libEDSsharp/proto/CanOpen.proto index 9991ab4c..7d257de7 100644 --- a/libEDSsharp/proto/CanOpen.proto +++ b/libEDSsharp/proto/CanOpen.proto @@ -19,11 +19,11 @@ message CanOpen_FileInfo message CanOpen_DeviceInfo { string vendorName = 1; // Vendor name. - uint32 vendorID = 2; // Vendor ID + uint32 vendorID = 2; // Vendor ID. string productName = 3; // Product name. - uint32 productID = 4; // Product ID - uint32 revisionNumber = 5; // Revision number - string orderCode = 6; // Order code + uint32 productID = 4; // Product ID. + uint32 revisionNumber = 5; // Revision number. + string orderCode = 6; // Order code. bool baudRate10 = 100; // Support of the baud rate 10 kbit/s. bool baudRate20 = 101; // Support of the baud rate 20 kbit/s. bool baudRate50 = 102; // Support of the baud rate 50 kbit/s. From bf1a95624eb20bb2e90229a755077e4748cb5a20 Mon Sep 17 00:00:00 2001 From: Giannis Roussos Date: Wed, 19 Nov 2025 15:10:53 +0200 Subject: [PATCH 16/16] Reverted CanOpen.proto changes --- libEDSsharp/CanOpenEDSMapping.cs | 6 +++--- libEDSsharp/proto/CanOpen.proto | 4 ---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libEDSsharp/CanOpenEDSMapping.cs b/libEDSsharp/CanOpenEDSMapping.cs index 358fcf13..ce980ef3 100644 --- a/libEDSsharp/CanOpenEDSMapping.cs +++ b/libEDSsharp/CanOpenEDSMapping.cs @@ -99,9 +99,9 @@ public static EDSsharp MapFromProtobuffer(CanOpenDevice source) .ForMember(dest => dest.BaudRate_800, opt => opt.MapFrom(src => src.BaudRate800)) .ForMember(dest => dest.BaudRate_1000, opt => opt.MapFrom(src => src.BaudRate1000)) .ForMember(dest => dest.BaudRate_auto, opt => opt.MapFrom(src => src.BaudRateAuto)) - .ForMember(dest => dest.VendorNumber, opt => opt.MapFrom(src => src.VendorID)) - .ForMember(dest => dest.ProductNumber, opt => opt.MapFrom(src => src.ProductID)) - .ForMember(dest => dest.RevisionNumber, opt => opt.MapFrom(src => src.RevisionNumber)) + .ForMember(dest => dest.VendorNumber, opt => opt.Ignore()) + .ForMember(dest => dest.ProductNumber, opt => opt.Ignore()) + .ForMember(dest => dest.RevisionNumber, opt => opt.Ignore()) .ForMember(dest => dest.SimpleBootUpMaster, opt => opt.Ignore()) .ForMember(dest => dest.SimpleBootUpSlave, opt => opt.Ignore()) .ForMember(dest => dest.Granularity, opt => opt.Ignore()) diff --git a/libEDSsharp/proto/CanOpen.proto b/libEDSsharp/proto/CanOpen.proto index 7d257de7..e6867a0c 100644 --- a/libEDSsharp/proto/CanOpen.proto +++ b/libEDSsharp/proto/CanOpen.proto @@ -19,11 +19,7 @@ message CanOpen_FileInfo message CanOpen_DeviceInfo { string vendorName = 1; // Vendor name. - uint32 vendorID = 2; // Vendor ID. string productName = 3; // Product name. - uint32 productID = 4; // Product ID. - uint32 revisionNumber = 5; // Revision number. - string orderCode = 6; // Order code. bool baudRate10 = 100; // Support of the baud rate 10 kbit/s. bool baudRate20 = 101; // Support of the baud rate 20 kbit/s. bool baudRate50 = 102; // Support of the baud rate 50 kbit/s.