1- // crates/powerlink-rs-xdc/src/model/app_layers.rs
2-
31//! Contains model structs related to `<ApplicationLayers>`.
2+ //!
43//! (Schema: `ProfileBody_CommunicationNetwork_Powerlink.xsd`)
54
65use super :: modular:: ModuleManagementComm ;
76use alloc:: string:: String ;
87use alloc:: vec:: Vec ;
9- use serde:: { Deserialize , Serialize } ; // Added import
8+ use serde:: { Deserialize , Serialize } ;
109
11- /// Contains the ObjectList and DataTypeList.
10+ /// Contains the Object Dictionary definition (` ObjectList`) and Data Type definitions (` DataTypeList`) .
1211#[ derive( Debug , Serialize , Deserialize , Default ) ]
1312pub struct ApplicationLayers {
1413 /// This optional list defines the mapping from hex ID to type name.
@@ -42,7 +41,8 @@ pub struct ObjectList {
4241
4342// --- Enums for Object/SubObject Attributes ---
4443
45- /// Access types of an object / subobject (from XSD `t_ObjectAccessType`).
44+ /// Access types of an object / subobject.
45+ /// (from XSD `t_ObjectAccessType`)
4646#[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq ) ]
4747pub enum ObjectAccessType {
4848 #[ serde( rename = "ro" ) ]
@@ -55,7 +55,8 @@ pub enum ObjectAccessType {
5555 Constant ,
5656}
5757
58- /// Ability to map an object / subobject to a PDO (from XSD `t_ObjectPDOMapping`).
58+ /// Ability to map an object / subobject to a PDO.
59+ /// (from XSD `t_ObjectPDOMapping`)
5960#[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq ) ]
6061pub enum ObjectPdoMapping {
6162 #[ serde( rename = "no" ) ]
@@ -70,84 +71,79 @@ pub enum ObjectPdoMapping {
7071 Rpdo ,
7172}
7273
73- /// Represents an Object Dictionary index (e.g., <Object index="1F22"...>).
74- /// This struct includes attributes from the `ag_Powerlink_Object` group.
74+ /// Represents an Object Dictionary index.
75+ ///
76+ /// This struct includes attributes from the `ag_Powerlink_Object` attribute group.
7577#[ derive( Debug , Serialize , Deserialize , Default ) ]
7678pub struct Object {
7779 /// The OD index as a hex string (e.g., "1F22").
7880 #[ serde( rename = "@index" ) ]
7981 pub index : String ,
8082
8183 // --- Fields from ag_Powerlink_Object ---
82- /// The name of the object.
84+
8385 #[ serde( rename = "@name" ) ]
8486 pub name : String ,
8587
86- /// The object type (e.g., "9" for RECORD).
88+ /// The object type (e.g., "7" for VAR, "8" for ARRAY, " 9" for RECORD).
8789 #[ serde( rename = "@objectType" ) ]
8890 pub object_type : String ,
8991
90- /// The POWERLINK data type (e.g., "0006" for Unsigned16).
92+ /// The POWERLINK data type ID (e.g., "0006" for Unsigned16).
9193 #[ serde( rename = "@dataType" , default , skip_serializing_if = "Option::is_none" ) ]
9294 pub data_type : Option < String > ,
9395
94- /// The lower limit of the object's value.
9596 #[ serde( rename = "@lowLimit" , default , skip_serializing_if = "Option::is_none" ) ]
9697 pub low_limit : Option < String > ,
9798
98- /// The upper limit of the object's value.
9999 #[ serde(
100100 rename = "@highLimit" ,
101101 default ,
102102 skip_serializing_if = "Option::is_none"
103103 ) ]
104104 pub high_limit : Option < String > ,
105105
106- /// The access type (e.g., "ro", "rw").
107106 #[ serde(
108107 rename = "@accessType" ,
109108 default ,
110109 skip_serializing_if = "Option::is_none"
111110 ) ]
112111 pub access_type : Option < ObjectAccessType > ,
113112
114- /// The default value of the object.
113+ /// The default value of the object. Used primarily in Device Description (XDD) files.
115114 #[ serde(
116115 rename = "@defaultValue" ,
117116 default ,
118117 skip_serializing_if = "Option::is_none"
119118 ) ]
120119 pub default_value : Option < String > ,
121120
122- /// The actual value of the object (used in XDC).
121+ /// The actual value of the object. Used primarily in Configuration ( XDC) files .
123122 #[ serde(
124123 rename = "@actualValue" ,
125124 default ,
126125 skip_serializing_if = "Option::is_none"
127126 ) ]
128127 pub actual_value : Option < String > ,
129128
130- /// A denotation for the object.
131129 #[ serde(
132130 rename = "@denotation" ,
133131 default ,
134132 skip_serializing_if = "Option::is_none"
135133 ) ]
136134 pub denotation : Option < String > ,
137135
138- /// The PDO mapping capability of the object.
139136 #[ serde(
140137 rename = "@PDOmapping" ,
141138 default ,
142139 skip_serializing_if = "Option::is_none"
143140 ) ]
144141 pub pdo_mapping : Option < ObjectPdoMapping > ,
145142
146- /// Object flags.
147143 #[ serde( rename = "@objFlags" , default , skip_serializing_if = "Option::is_none" ) ]
148144 pub obj_flags : Option < String > ,
149145
150- /// This attribute references a Parameter's uniqueID in the ApplicationProcess.
146+ /// References a Parameter's ` uniqueID` in the ` ApplicationProcess` .
151147 #[ serde(
152148 rename = "@uniqueIDRef" ,
153149 default ,
@@ -156,6 +152,7 @@ pub struct Object {
156152 pub unique_id_ref : Option < String > ,
157153
158154 // --- End of fields from ag_Powerlink_Object ---
155+
159156 /// This attribute is used by modular devices to reference an index range.
160157 /// (from `t_Object_Extension_Head` and `t_Object_Extension`)
161158 #[ serde(
@@ -165,99 +162,86 @@ pub struct Object {
165162 ) ]
166163 pub range_selector : Option < String > ,
167164
168- /// A list of SubObjects (e.g., <SubObject subIndex="01"...>).
165+ /// A list of SubObjects (e.g., ` <SubObject subIndex="01"...>` ).
169166 #[ serde( rename = "SubObject" , default ) ]
170167 pub sub_object : Vec < SubObject > ,
171168}
172169
173170/// Represents an Object Dictionary sub-index.
174- /// This struct includes attributes from the `ag_Powerlink_Object` group.
175171#[ derive( Debug , Serialize , Deserialize , Default ) ]
176172pub struct SubObject {
177173 /// The OD sub-index as a hex string (e.g., "01").
178174 #[ serde( rename = "@subIndex" ) ]
179175 pub sub_index : String ,
180176
181177 // --- Fields from ag_Powerlink_Object ---
182- /// The name of the sub-object.
178+
183179 #[ serde( rename = "@name" ) ]
184180 pub name : String ,
185181
186- /// The object type (e.t., "7" for VAR).
187182 #[ serde( rename = "@objectType" ) ]
188183 pub object_type : String ,
189184
190- /// The POWERLINK data type (e.g., "0006" for Unsigned16).
191185 #[ serde( rename = "@dataType" , default , skip_serializing_if = "Option::is_none" ) ]
192186 pub data_type : Option < String > ,
193187
194- /// The lower limit of the sub-object's value.
195188 #[ serde( rename = "@lowLimit" , default , skip_serializing_if = "Option::is_none" ) ]
196189 pub low_limit : Option < String > ,
197190
198- /// The upper limit of the sub-object's value.
199191 #[ serde(
200192 rename = "@highLimit" ,
201193 default ,
202194 skip_serializing_if = "Option::is_none"
203195 ) ]
204196 pub high_limit : Option < String > ,
205197
206- /// The access type (e.g., "ro", "rw").
207198 #[ serde(
208199 rename = "@accessType" ,
209200 default ,
210201 skip_serializing_if = "Option::is_none"
211202 ) ]
212203 pub access_type : Option < ObjectAccessType > ,
213204
214- /// The `defaultValue` is the key data for an XDD file.
215205 #[ serde(
216206 rename = "@defaultValue" ,
217207 default ,
218208 skip_serializing_if = "Option::is_none"
219209 ) ]
220210 pub default_value : Option < String > ,
221211
222- /// The `actualValue` is the key data for an XDC file.
223212 #[ serde(
224213 rename = "@actualValue" ,
225214 default ,
226215 skip_serializing_if = "Option::is_none"
227216 ) ]
228217 pub actual_value : Option < String > ,
229218
230- /// A denotation for the sub-object.
231219 #[ serde(
232220 rename = "@denotation" ,
233221 default ,
234222 skip_serializing_if = "Option::is_none"
235223 ) ]
236224 pub denotation : Option < String > ,
237225
238- /// The PDO mapping capability of the sub-object.
239226 #[ serde(
240227 rename = "@PDOmapping" ,
241228 default ,
242229 skip_serializing_if = "Option::is_none"
243230 ) ]
244231 pub pdo_mapping : Option < ObjectPdoMapping > ,
245232
246- /// Object flags.
247233 #[ serde( rename = "@objFlags" , default , skip_serializing_if = "Option::is_none" ) ]
248234 pub obj_flags : Option < String > ,
249235
250- /// This attribute references a Parameter's uniqueID in the ApplicationProcess.
251236 #[ serde(
252237 rename = "@uniqueIDRef" ,
253238 default ,
254239 skip_serializing_if = "Option::is_none"
255240 ) ]
256241 pub unique_id_ref : Option < String > ,
257- // --- End of fields from ag_Powerlink_Object ---
258242}
259243
260- // --- STRUCTS for DataTypeList (Comm Profile) ---
244+ // --- STRUCTS for DataTypeList ---
261245
262246/// Represents `<DataTypeList>` (EPSG 311, 7.5.4.3).
263247#[ derive( Debug , Serialize , Deserialize , Default ) ]
@@ -278,7 +262,7 @@ pub struct DefType {
278262 pub type_name : DataTypeName ,
279263}
280264
281- /// Represents the tag name of the child of `<defType>` .
265+ /// Enumeration of standard POWERLINK data type tags .
282266/// (Based on EPSG 311, Table 56).
283267#[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq ) ]
284268pub enum DataTypeName {
@@ -317,4 +301,4 @@ pub enum DataTypeName {
317301 #[ serde( rename = "IP_ADDRESS" ) ]
318302 IpAddress ,
319303 NETTIME ,
320- }
304+ }
0 commit comments