@@ -187,6 +187,20 @@ public Device convert(EDSsharp eds)
187187 dev . Other . BaudRate . SupportedBaudRate . Add ( baud ) ;
188188
189189
190+ dev . Other . Capabilities = new Capabilities ( ) ;
191+ dev . Other . Capabilities . CharacteristicsList = new CharacteristicsList ( ) ;
192+ dev . Other . Capabilities . CharacteristicsList . Characteristic = new List < Characteristic > ( ) ;
193+
194+
195+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "SimpleBootUpSlave" , eds . di . SimpleBootUpSlave . ToString ( ) ) ) ;
196+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "SimpleBootUpMaster" , eds . di . SimpleBootUpMaster . ToString ( ) ) ) ;
197+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "DynamicChannelsSupported" , eds . di . DynamicChannelsSupported . ToString ( ) ) ) ;
198+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "CompactPDO" , eds . di . CompactPDO . ToString ( ) ) ) ;
199+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "GroupMessaging" , eds . di . GroupMessaging . ToString ( ) ) ) ;
200+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "LSS_Supported" , eds . di . LSS_Supported . ToString ( ) ) ) ;
201+
202+ dev . Other . Capabilities . CharacteristicsList . Characteristic . Add ( makecharcteristic ( "Granularity" , eds . di . Granularity . ToString ( ) ) ) ;
203+
190204 dev . Other . DeviceIdentity = new DeviceIdentity ( ) ;
191205 dev . Other . DeviceIdentity . ProductName = eds . di . ProductName ;
192206 dev . Other . DeviceIdentity . ProductNumber = eds . di . ProductNumber ;
@@ -222,6 +236,21 @@ public Device convert(EDSsharp eds)
222236 }
223237
224238
239+ public Characteristic makecharcteristic ( string name , string content )
240+ {
241+ Characteristic cl = new Characteristic ( ) ;
242+
243+ cl . CharacteristicName = new CharacteristicName ( ) ;
244+ cl . CharacteristicContent = new CharacteristicContent ( ) ;
245+ cl . CharacteristicContent . Label = new Label ( ) ;
246+ cl . CharacteristicName . Label = new Label ( ) ;
247+
248+ cl . CharacteristicName . Label . Text = name ;
249+ cl . CharacteristicContent . Label . Text = content ;
250+
251+ return cl ;
252+ }
253+
225254 public EDSsharp convert ( Device dev )
226255 {
227256 EDSsharp eds = new EDSsharp ( ) ;
@@ -397,6 +426,44 @@ public EDSsharp convert(Device dev)
397426
398427 }
399428
429+ Dictionary < string , string > keypairs = new Dictionary < string , string > ( ) ;
430+
431+
432+ if ( dev . Other . Capabilities . CharacteristicsList != null )
433+ {
434+ foreach ( Characteristic c in dev . Other . Capabilities . CharacteristicsList . Characteristic )
435+ {
436+ try
437+ {
438+ keypairs . Add ( c . CharacteristicName . Label . Text , c . CharacteristicContent . Label . Text ) ;
439+ }
440+ catch ( Exception e )
441+ {
442+ // Warnings.warning_list.Add("Parsing characteristics failed " + e.ToString());
443+ }
444+ }
445+ }
446+
447+
448+ bool boolout ;
449+ if ( keypairs . ContainsKey ( "SimpleBootUpSlave" ) && bool . TryParse ( keypairs [ "SimpleBootUpSlave" ] , out boolout ) )
450+ eds . di . SimpleBootUpSlave = boolout ;
451+ if ( keypairs . ContainsKey ( "SimpleBootUpMaster" ) && bool . TryParse ( keypairs [ "SimpleBootUpMaster" ] , out boolout ) )
452+ eds . di . SimpleBootUpMaster = boolout ;
453+ if ( keypairs . ContainsKey ( "DynamicChannelsSupported" ) && bool . TryParse ( keypairs [ "DynamicChannelsSupported" ] , out boolout ) )
454+ eds . di . DynamicChannelsSupported = boolout ;
455+ if ( keypairs . ContainsKey ( "CompactPDO" ) && bool . TryParse ( keypairs [ "CompactPDO" ] , out boolout ) )
456+ eds . di . CompactPDO = boolout ;
457+ if ( keypairs . ContainsKey ( "GroupMessaging" ) && bool . TryParse ( keypairs [ "GroupMessaging" ] , out boolout ) )
458+ eds . di . GroupMessaging = boolout ;
459+ if ( keypairs . ContainsKey ( "LSS_Supported" ) && bool . TryParse ( keypairs [ "LSS_Supported" ] , out boolout ) )
460+ eds . di . LSS_Supported = boolout ;
461+
462+ byte byteout ;
463+ if ( keypairs . ContainsKey ( "Granularity" ) && byte . TryParse ( keypairs [ "Granularity" ] , out byteout ) )
464+ eds . di . Granularity = byteout ;
465+
466+
400467 eds . di . ProductName = dev . Other . DeviceIdentity . ProductName ;
401468 eds . di . ProductNumber = dev . Other . DeviceIdentity . ProductNumber ;
402469
@@ -456,7 +523,17 @@ public EDSsharp convert(Device dev)
456523 catch ( Exception e )
457524 {
458525 if ( dev . Other . File != null )
459- Warnings . warning_list . Add ( String . Format ( "Unable to parse FileVersion\" {0}\" {1}" , dev . Other . File . FileVersion , e . ToString ( ) ) ) ;
526+ {
527+ // CanOpenNode default project.xml conatins - for fileversion, its suspose to be a byte field according to DS306
528+ if ( dev . Other . File . FileVersion == "-" )
529+ {
530+ dev . Other . File . FileVersion = "0" ;
531+ }
532+ else
533+ {
534+ Warnings . warning_list . Add ( String . Format ( "Unable to parse FileVersion\" {0}\" {1}" , dev . Other . File . FileVersion , e . ToString ( ) ) ) ;
535+ }
536+ }
460537
461538 eds . fi . FileVersion = 0 ;
462539 }
0 commit comments