diff --git a/EDSEditorGUI/DeviceInfoView.Designer.cs b/EDSEditorGUI/DeviceInfoView.Designer.cs
index ce68a85..41a6621 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,6 +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_ordercode = new System.Windows.Forms.TextBox();
+ this.label12 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox6.SuspendLayout();
@@ -123,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, 537);
+ this.panel1.Size = new System.Drawing.Size(773, 833);
this.panel1.TabIndex = 60;
//
// groupBox5
@@ -142,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, 332);
+ 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;
@@ -414,6 +418,10 @@ 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);
this.groupBox4.Controls.Add(this.textBox_productname);
this.groupBox4.Controls.Add(this.textBox_vendornumber);
@@ -424,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, 126);
+ 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);
@@ -743,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, 146);
+ 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;
@@ -847,6 +871,22 @@ private void InitializeComponent()
this.label18.TabIndex = 18;
this.label18.Text = "File version";
//
+ // textBox_ordercode
+ //
+ 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;
+ //
+ // label12
+ //
+ 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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -949,5 +989,9 @@ 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;
+ private System.Windows.Forms.TextBox textBox_ordercode;
+ private System.Windows.Forms.Label label12;
}
}
diff --git a/EDSEditorGUI/DeviceInfoView.cs b/EDSEditorGUI/DeviceInfoView.cs
index 20ef719..ad67878 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,11 +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_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.fileVersionString;
textBox_di_description.Text = eds.fi.Description;
textBox_create_datetime.Text = eds.fi.CreationDateTime.ToString();
textBox_createdby.Text = eds.fi.CreatedBy;
@@ -137,11 +139,13 @@ private void update_devfile_info()
try
{
eds.di.ProductName = textBox_productname.Text;
- eds.di.ProductNumber = textBox_productnumber.Text;
+ eds.di.ProductNumber = EDSsharp.U32Parse(textBox_productnumber.Text);
eds.di.VendorName = textBox_vendorname.Text;
- eds.di.VendorNumber = textBox_vendornumber.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 = 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/Tests/EDSMappingTests.cs b/Tests/EDSMappingTests.cs
index ba23965..63675c5 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/CanOpenEDS.cs b/libEDSsharp/CanOpenEDS.cs
index d4be60f..a52e524 100644
--- a/libEDSsharp/CanOpenEDS.cs
+++ b/libEDSsharp/CanOpenEDS.cs
@@ -74,6 +74,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 ? ";" : ""));
@@ -1020,6 +1024,27 @@ void ApplycompactPDO(UInt16 index)
}
}
}
+ public static UInt32 U32Parse(string str)
+ {
+ if (str[0] == '0')
+ {
+ 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);
+ }
+ }
///
/// This function scans the PDO list and compares it to NrOfRXPDO and NrOfTXPDO
@@ -1059,7 +1084,38 @@ protected void ApplyimplicitPDO()
}
UpdatePDOcount();
}
-
+ private void GetEDSFileInfo()
+ {
+ string[] nums = fi.fileVersionString.Split('.');
+ if (nums.Length == 2)
+ {
+ 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)
{
if (ft == InfoSection.Filetype.File_EDS)
@@ -1087,6 +1143,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/CanOpenNodeExporter.cs b/libEDSsharp/CanOpenNodeExporter.cs
index df728b8..df2b8ea 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 786bb9c..65d9a85 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(@"
diff --git a/libEDSsharp/CanOpenXDD.cs b/libEDSsharp/CanOpenXDD.cs
index 165036c..4d2227c 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,10 @@ 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 +1185,19 @@ public EDSsharp convert(ISO15745ProfileContainer container)
eds.fi.EDSVersion = keyvalue[1];
break;
case "FileRevision":
- eds.fi.FileVersion = keyvalue[1];
+ 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 "RevisionNum":
- byte.TryParse(keyvalue[1], out eds.fi.FileRevision); break;
-
-
+ if (byte.TryParse(keyvalue[1], out eds.fi.FileRevision) == false)
+ {
+ eds.fi.FileRevision = 0;
+ Warnings.warning_list.Add("XDD RevisionNum value \"" + keyvalue[1] + "\" cannot be parsed!");
+ }
+ break;
}
}
}
diff --git a/libEDSsharp/CanOpenXDD_1_1.cs b/libEDSsharp/CanOpenXDD_1_1.cs
index 5c68202..682bf00 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.fileVersionString;
body_device.fileModifiedBy = eds.fi.ModifiedBy;
body_device.fileModificationDate = eds.fi.ModificationDateTime;
body_device.fileModificationTime = eds.fi.ModificationDateTime;
@@ -953,9 +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.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 };
+ 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
@@ -1050,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() + "." + eds.fi.FileRevision.ToString();
body_network.fileModificationDate = eds.fi.ModificationDateTime;
body_network.fileModificationTime = eds.fi.ModificationDateTime;
body_network.fileModificationDateSpecified = true;
@@ -1211,7 +1213,6 @@ private string G_label_getDescription(object[] items) {
}
return "";
}
-
private EDSsharp Convert(ISO15745ProfileContainer container)
{
EDSsharp eds = new EDSsharp();
@@ -1232,7 +1233,7 @@ private EDSsharp Convert(ISO15745ProfileContainer container)
if (body_device != null)
{
eds.fi.FileName = body_device.fileName ?? "";
- eds.fi.FileVersion = body_device.fileVersion ?? "";
+ eds.fi.fileVersionString = body_device.fileVersion ?? "";
eds.fi.CreatedBy = body_device.fileCreator ?? "";
eds.fi.ModifiedBy = body_device.fileModifiedBy ?? "";
@@ -1255,11 +1256,15 @@ 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 = EDSsharp.U32Parse(body_device.DeviceIdentity.vendorID.Value ?? "0");
+ 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)
- eds.di.ProductNumber = body_device.DeviceIdentity.productID.Value ?? "";
+ 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 0530d65..1c99fbe 100644
--- a/libEDSsharp/eds.cs
+++ b/libEDSsharp/eds.cs
@@ -582,13 +582,20 @@ 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)
///
[EdsExport]
public byte FileRevision;//=1
+ ///
+ /// indicate the file version as a vendor-specific string
+ ///
+ [EdsExport(commentonly = true)]
+ public string fileVersionString = "";
+
+
[DcfExport]
public string LastEDS = "";
@@ -647,6 +654,8 @@ public FileInfo()
{
infoheader = "CAN OPEN FileInfo";
edssection = "FileInfo";
+ FileVersion = 1;
+ FileRevision = 0;
}
}
@@ -664,7 +673,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,12 +683,17 @@ 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)
///
[EdsExport]
public UInt32 RevisionNumber;
+ ///
+ /// The value indicates the manufacturer specific order code
+ ///
+ [EdsExport]
+ public string OrderCode="";
///
/// indicate the supported baud rates (Boolean, 0 = not supported, 1=supported)
@@ -1810,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/extensions.cs b/libEDSsharp/extensions.cs
index f6ee903..d45339c 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);
}
}
diff --git a/libEDSsharp/libEDSsharp.csproj b/libEDSsharp/libEDSsharp.csproj
index 3e44383..7ab914a 100644
--- a/libEDSsharp/libEDSsharp.csproj
+++ b/libEDSsharp/libEDSsharp.csproj
@@ -64,4 +64,4 @@
-
\ No newline at end of file
+