@@ -37,63 +37,29 @@ public EDSsharp convert(ISO15745ProfileContainer container)
3737 ProfileBody_DataType dt ;
3838
3939
40+ ProfileBody_CommunicationNetwork_CANopen body_network = null ;
41+ ProfileBody_Device_CANopen body_device = null ;
42+
43+
4044 foreach ( ISO15745Profile dev in container . ISO15745Profile )
4145 {
46+ if ( dev . ProfileBody . GetType ( ) == typeof ( ProfileBody_CommunicationNetwork_CANopen ) )
47+ {
48+ body_network = ( ProfileBody_CommunicationNetwork_CANopen ) dev . ProfileBody ;
49+ }
4250
4351 if ( dev . ProfileBody . GetType ( ) == typeof ( ProfileBody_Device_CANopen ) )
4452 {
45- ProfileBody_Device_CANopen obj = ( ProfileBody_Device_CANopen ) dev . ProfileBody ;
46- eds . di . ProductName = obj . DeviceIdentity . productName . Value ;
47- eds . di . ProductNumber = EDSsharp . ConvertToUInt32 ( obj . DeviceIdentity . productID . Value ) ;
48- eds . di . VendorName = obj . DeviceIdentity . vendorName . Value ;
49- eds . di . VendorNumber = EDSsharp . ConvertToUInt32 ( obj . DeviceIdentity . vendorID . Value ) ;
50-
51- foreach ( object o in obj . DeviceIdentity . productText . Items )
52- {
53- //this is another g_label affair
54-
55- if ( o . GetType ( ) == typeof ( vendorTextDescription ) )
56- {
57- eds . fi . Description = ( ( vendorTextDescription ) o ) . Value ;
58- }
59-
60- if ( o . GetType ( ) == typeof ( vendorTextDescriptionRef ) )
61- {
62- }
63- if ( o . GetType ( ) == typeof ( vendorTextLabel ) )
64- {
65- }
66- if ( o . GetType ( ) == typeof ( vendorTextLabelRef ) )
67- {
68- }
69- }
70-
71- if ( obj . fileCreationTimeSpecified )
72- {
73- eds . fi . CreationDateTime = obj . fileCreationDate . Add ( obj . fileCreationTime . TimeOfDay ) ;
74- eds . fi . CreationDate = eds . fi . CreationDateTime . ToString ( "MM-dd-yyyy" ) ;
75- eds . fi . CreationTime = eds . fi . CreationDateTime . ToString ( "h:mmtt" ) ;
76-
77- }
78-
79- if ( obj . fileModificationDateSpecified )
80- {
81- eds . fi . ModificationDateTime = obj . fileModificationDate . Add ( obj . fileCreationTime . TimeOfDay ) ;
82- eds . fi . ModificationDate = eds . fi . ModificationDateTime . ToString ( "MM-dd-yyyy" ) ;
83- eds . fi . ModificationTime = eds . fi . ModificationDateTime . ToString ( "h:mmtt" ) ;
84-
85- }
86-
87- eds . fi . ModifiedBy = obj . fileModifiedBy ;
88- eds . fi . CreatedBy = obj . fileCreator ;
53+ body_device = ( ProfileBody_Device_CANopen ) dev . ProfileBody ;
8954
9055 }
9156
92- //ProfileBody_CommunicationNetwork_CANopen
57+ }
9358
94- if ( dev . ProfileBody . GetType ( ) == typeof ( ProfileBody_CommunicationNetwork_CANopen ) )
59+ //ProfileBody_CommunicationNetwork_CANopen
60+ if ( body_network != null )
9561 {
96- ProfileBody_CommunicationNetwork_CANopen obj = ( ProfileBody_CommunicationNetwork_CANopen ) dev . ProfileBody ;
62+ ProfileBody_CommunicationNetwork_CANopen obj = body_network ;
9763
9864 ProfileBody_CommunicationNetwork_CANopenApplicationLayers ApplicationLayers = null ;
9965 ProfileBody_CommunicationNetwork_CANopenTransportLayers TransportLayers = null ;
@@ -333,8 +299,8 @@ public EDSsharp convert(ISO15745ProfileContainer container)
333299 //subobj.actualValue;
334300 //subobj.denotation;
335301 //subobj.objFlags;
336- //subobj.uniqueIDRef;
337302
303+ entry . uniqueID = obj3 . uniqueIDRef ;
338304
339305 eds . ods . Add ( index , entry ) ;
340306
@@ -386,7 +352,8 @@ public EDSsharp convert(ISO15745ProfileContainer container)
386352 //subobj.actualValue;
387353 //subobj.denotation;
388354 //subobj.objFlags;
389- //subobj.uniqueIDRef;
355+
356+ subentry . uniqueID = subobj . uniqueIDRef ;
390357
391358 entry . subobjects . Add ( subobj . subIndex [ 0 ] , subentry ) ;
392359
@@ -396,6 +363,106 @@ public EDSsharp convert(ISO15745ProfileContainer container)
396363
397364 }
398365
366+ }
367+
368+ //Process Device after network so we already have the ODEntries populated then can match bu uniqueID
369+
370+ //ProfileBody_Device_CANopen
371+ if ( body_device != null )
372+ {
373+ ProfileBody_Device_CANopen obj = body_device ;
374+
375+ if ( obj . DeviceIdentity != null )
376+ {
377+ eds . di . ProductName = obj . DeviceIdentity . productName . Value ;
378+ eds . di . ProductNumber = EDSsharp . ConvertToUInt32 ( obj . DeviceIdentity . productID . Value ) ;
379+ eds . di . VendorName = obj . DeviceIdentity . vendorName . Value ;
380+ eds . di . VendorNumber = EDSsharp . ConvertToUInt32 ( obj . DeviceIdentity . vendorID . Value ) ;
381+
382+ foreach ( object o in obj . DeviceIdentity . productText . Items )
383+ {
384+ //this is another g_label affair
385+
386+ if ( o . GetType ( ) == typeof ( vendorTextDescription ) )
387+ {
388+ eds . fi . Description = ( ( vendorTextDescription ) o ) . Value ;
389+ }
390+
391+ if ( o . GetType ( ) == typeof ( vendorTextDescriptionRef ) )
392+ {
393+ }
394+ if ( o . GetType ( ) == typeof ( vendorTextLabel ) )
395+ {
396+ }
397+ if ( o . GetType ( ) == typeof ( vendorTextLabelRef ) )
398+ {
399+ }
400+ }
401+
402+ if ( obj . fileCreationTimeSpecified )
403+ {
404+ eds . fi . CreationDateTime = obj . fileCreationDate . Add ( obj . fileCreationTime . TimeOfDay ) ;
405+ eds . fi . CreationDate = eds . fi . CreationDateTime . ToString ( "MM-dd-yyyy" ) ;
406+ eds . fi . CreationTime = eds . fi . CreationDateTime . ToString ( "h:mmtt" ) ;
407+
408+ }
409+
410+ if ( obj . fileModificationDateSpecified )
411+ {
412+ eds . fi . ModificationDateTime = obj . fileModificationDate . Add ( obj . fileCreationTime . TimeOfDay ) ;
413+ eds . fi . ModificationDate = eds . fi . ModificationDateTime . ToString ( "MM-dd-yyyy" ) ;
414+ eds . fi . ModificationTime = eds . fi . ModificationDateTime . ToString ( "h:mmtt" ) ;
415+
416+ }
417+
418+ eds . fi . ModifiedBy = obj . fileModifiedBy ;
419+ eds . fi . CreatedBy = obj . fileCreator ;
420+ }
421+
422+ if ( obj . DeviceManager != null )
423+ {
424+
425+ }
426+
427+ if ( obj . DeviceFunction != null )
428+ {
429+
430+ }
431+
432+ if ( obj . ApplicationProcess != null )
433+ {
434+
435+ if ( obj . ApplicationProcess [ 0 ] != null )
436+ {
437+ foreach ( parameter param in obj . ApplicationProcess [ 0 ] . parameterList )
438+ {
439+
440+ //match unique ID
441+
442+
443+ ODentry od = eds . getobject ( param . uniqueID ) ;
444+
445+ if ( od == null )
446+ continue ;
447+
448+ //fix me defaultValue containes other stuff we might want
449+ if ( param . defaultValue != null )
450+ od . defaultvalue = param . defaultValue . value ;
451+
452+
453+
454+
455+
456+
457+
458+ }
459+
460+ }
461+
462+
463+
464+
465+
399466 }
400467
401468 }
0 commit comments