From cad2be8b465ae6ca82a5003adfc9d128eab9d603 Mon Sep 17 00:00:00 2001 From: Lars Elgtvedt Susaas <9848846+nimrof@users.noreply.github.com> Date: Mon, 1 Apr 2024 17:25:33 +0200 Subject: [PATCH] more comments --- libEDSsharp/eds.cs | 90 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 16 deletions(-) diff --git a/libEDSsharp/eds.cs b/libEDSsharp/eds.cs index a13b8de5..17cb39e2 100644 --- a/libEDSsharp/eds.cs +++ b/libEDSsharp/eds.cs @@ -184,6 +184,9 @@ public class CustomProperties /// public bool CO_disabled = false; public string CO_countLabel = ""; + /// + /// CanOpenNode storage group + /// public string CO_storageGroup = "RAM"; public bool CO_flagsPDO = false; public AccessSRDO CO_accessSRDO = AccessSRDO.no; @@ -287,17 +290,27 @@ public CO_storageGroups() } } } - + /// + /// Indicate that it should be exported in EDS files and may have some data about how + /// public class EdsExport : Attribute { + /// + /// Max length of the string when exported + /// public UInt16 maxlength; public bool commentonly=false; - //mehmeh + /// + /// default constructor + /// public EdsExport() { } - + /// + /// contstructor with max string length + /// + /// max length of the string when exported public EdsExport(UInt16 maxlength) { this.maxlength = maxlength; @@ -310,7 +323,9 @@ public bool IsReadOnly() } - + /// + /// Indicate that it should be exported in DCF files + /// public class DcfExport : EdsExport { } @@ -1210,7 +1225,9 @@ public ModuleSubExtends(Dictionary section, UInt16 moduleindex) } } - + /// + /// Represent object dictionary index and subindex objects + /// public class ODentry { private UInt16 _index; @@ -1256,22 +1273,39 @@ public UInt16 Index [DcfExport] public string denotation = ""; + /// + /// object type var,rec, array etc. + /// [EdsExport] public ObjectType objecttype = ObjectType.UNKNOWN; + /// + /// data type bool, integer etc. + /// [EdsExport] public DataType datatype = DataType.UNKNOWN; + /// + /// access type + /// [EdsExport] public EDSsharp.AccessType accesstype = EDSsharp.AccessType.UNKNOWN; - + /// + /// default value + /// [EdsExport] public string defaultvalue = ""; - + /// + /// low numeric limit + /// [EdsExport] public string LowLimit = ""; - + /// + /// high numeric limit + /// [EdsExport] public string HighLimit = ""; - + /// + /// actual value + /// [DcfExport] public string actualvalue = ""; @@ -1280,7 +1314,9 @@ public UInt16 Index [EdsExport] public byte CompactSubObj = 0; - + /// + /// true if it is PDO mapping object + /// [EdsExport] public bool PDOMapping { @@ -1887,7 +1923,11 @@ public ODentry Getsubobject(UInt16 no) return subobjects[no]; return null; } - + /// + /// Returns default value for a subindex + /// + /// subindex to get the default value for + /// default value for that subindex or "" if the subindex was not found public string Getsubobjectdefaultvalue(UInt16 no) { if (subobjects.ContainsKey(no)) @@ -1895,7 +1935,11 @@ public string Getsubobjectdefaultvalue(UInt16 no) else return ""; } - + /// + /// Returns true if the object contains a subindex + /// + /// the subindex to look for + /// true if it contains the subindex public bool Containssubindex(UInt16 no) { if (subobjects.ContainsKey(no)) @@ -1904,7 +1948,10 @@ public bool Containssubindex(UInt16 no) return false; } - + /// + /// Return max indicated subindex, or null if not array or record + /// + /// public byte Getmaxsubindex() { //Although subindex 0 should contain the max subindex value @@ -1950,7 +1997,9 @@ public int Lengthofstring } } } - + /// + /// Subindex of this object if it is a subindex object, 0 if not + /// public UInt16 Subindex { get @@ -1963,7 +2012,11 @@ public UInt16 Subindex } } - + /// + /// Look for a entry in the subindexs, return the index if found + /// + /// the OD entry to look for in the subindex objects + /// the subindex if found or 0 if not found public UInt16 Findsubindex(ODentry od) { foreach(KeyValuePairkvp in subobjects ) @@ -3171,7 +3224,12 @@ public void UpdatePDOcount() } - //Split on + , replace $NODEID with concrete value and add together + /// + /// Split on + , replace $NODEID with concrete value and add together + /// + /// input string containing a number maybe prefixed by $NODEID+ + /// if $NODEID is in the string + /// public UInt32 GetNodeID(string input, out bool nodeidpresent) {