Skip to content

Commit

Permalink
Improvements to denotation handling in XDD
Browse files Browse the repository at this point in the history
  • Loading branch information
robincornelius committed Feb 1, 2019
1 parent c97e4ec commit e63ed44
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions libEDSsharp/CanOpenXDD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ public void fillparamater(parameter p, ODentry od)
lab.Value = od.parameter_name;
p.Items[0] = lab;

//fixme we need to extract the denotation from the ODentry
//this is just an empty place holder

//FIXME we are currently writing the denotation value to both the object and the parameterList section
//i'm not sure why two exist

denotation denot = new denotation();
vendorTextLabel lab2 = new vendorTextLabel();
lab2.lang = "en";
Expand Down Expand Up @@ -378,6 +380,8 @@ public ISO15745ProfileContainer convert(EDSsharp eds)
AppLayer.CANopenObjectList.CANopenObject[count].accessType = (CANopenObjectListCANopenObjectAccessType)Enum.Parse(typeof(CANopenObjectListCANopenObjectAccessType), accesstype.ToString());
AppLayer.CANopenObjectList.CANopenObject[count].accessTypeSpecified = true;

AppLayer.CANopenObjectList.CANopenObject[count].denotation = od.denotation;

if (od.subobjects != null && od.subobjects.Count > 0)
{
AppLayer.CANopenObjectList.CANopenObject[count].subNumber = (byte)od.subobjects.Count;
Expand All @@ -401,6 +405,8 @@ public ISO15745ProfileContainer convert(EDSsharp eds)
AppLayer.CANopenObjectList.CANopenObject[count].CANopenSubObject[subcount].name = subod.parameter_name;
AppLayer.CANopenObjectList.CANopenObject[count].CANopenSubObject[subcount].objectType = (byte)subod.objecttype;

AppLayer.CANopenObjectList.CANopenObject[count].CANopenSubObject[subcount].denotation = subod.denotation;

bytes = BitConverter.GetBytes((UInt16)subod.datatype);
Array.Reverse(bytes);

Expand Down Expand Up @@ -1129,7 +1135,9 @@ public EDSsharp convert(ISO15745ProfileContainer container)

}

if(param.denotation!=null && param.denotation.Items.Length>0)
//FIXME: if we have a denotation set for an object in the <parameterList> section but it is not set on the object
//use the <parameterList> one. We may discover that this is used for something else and can be removed??
if ((od.denotation==null || od.denotation=="") && param.denotation!=null && param.denotation.Items.Length>0)
{
foreach (object item in param.denotation.Items)
{
Expand Down

0 comments on commit e63ed44

Please sign in to comment.