From 5b3d0ec91d8838e7579fae934d0e8880c3191143 Mon Sep 17 00:00:00 2001 From: Thomas Goodwin Date: Wed, 18 Oct 2017 10:03:47 -0400 Subject: [PATCH 1/3] Update create_xmls.py --- converter/lib/create_xmls.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/converter/lib/create_xmls.py b/converter/lib/create_xmls.py index 9e6b9cb..8ed37ea 100644 --- a/converter/lib/create_xmls.py +++ b/converter/lib/create_xmls.py @@ -27,7 +27,7 @@ "complex": "dataFloat", "int": "dataLong", "short": "dataShort", - "byte": "dataChar" + "byte": "dataOctet" } # ############################################################################## @@ -51,39 +51,46 @@ def formatSCD(rp, ports): for si in supports_list: all_interfaces.add_interface(scd.interface(si.name, si.id, si.inherits)) sup_interfaces.add_supportsinterface(scd.supportsInterface(si.name, si.id)) - - all_interfaces.add_interface(scd.interface("dataShort", "IDL:BULKIO/dataShort:1.0", [scd.inheritsInterface("IDL:BULKIO/ProvidesPortStatisticsProvider:1.0"), scd.inheritsInterface("IDL:BULKIO/updateSRI:1.0")])) - + for interface in all_interfaces.get_interface(): if "Resource" in interface.name: interface.add_inheritsinterface(scd.inheritsInterface("IDL:CF/Logging:1.0")) - rp.scd.set_interfaces(all_interfaces) rp.scd.set_componentfeatures(sup_interfaces) - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ports_scd = rp.scd.componentfeatures.get_ports() if ports_scd is None: ports_scd = scd.ports() - + + all_data_types = set() for port in ports: data_type = BLOCK_TO_BULKIO_MAP.get(port.type) + if data_type is None: raise Exception("Unknown source block data type: %s" % port.type) repid = "IDL:BULKIO/%s:1.0" % data_type if port.direction.endswith('source'): + all_data_types.add((data_type, 'Provides')) ports_scd.add_provides(scd.provides( providesname=port.name, repid=repid)) elif port.direction.endswith('sink'): + all_data_types.add((data_type, 'Uses')) ports_scd.add_uses(scd.uses( usesname=port.name, repid=repid)) else: raise Exception("Unknown block port direction: %s" % port.type) + + for dt in all_data_types: + all_interfaces.add_interface(scd.interface(dt[0], "IDL:BULKIO/{0}:1.0".format(dt[0]), [ + scd.inheritsInterface("IDL:BULKIO/{0}PortStatisticsProvider:1.0".format(dt[1]), + scd.inheritsInterface("IDL:BULKIO/updateSRI:1.0") + ])) + rp.scd.set_interfaces(all_interfaces) rp.scd.componentfeatures.set_ports(ports_scd) # ############################################################################## From d9f9d262009b0db59739e7822ad7e34d92b5a377 Mon Sep 17 00:00:00 2001 From: Thomas Goodwin Date: Wed, 18 Oct 2017 10:15:40 -0400 Subject: [PATCH 2/3] Stats interface only needed if Provides --- converter/lib/create_xmls.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/converter/lib/create_xmls.py b/converter/lib/create_xmls.py index 8ed37ea..855db4e 100644 --- a/converter/lib/create_xmls.py +++ b/converter/lib/create_xmls.py @@ -85,10 +85,12 @@ def formatSCD(rp, ports): raise Exception("Unknown block port direction: %s" % port.type) for dt in all_data_types: - all_interfaces.add_interface(scd.interface(dt[0], "IDL:BULKIO/{0}:1.0".format(dt[0]), [ - scd.inheritsInterface("IDL:BULKIO/{0}PortStatisticsProvider:1.0".format(dt[1]), - scd.inheritsInterface("IDL:BULKIO/updateSRI:1.0") - ])) + if dt[1] == "Provides": + all_interfaces.add_interface(scd.interface(dt[0], "IDL:BULKIO/{0}:1.0".format(dt[0]), [ + scd.inheritsInterface("IDL:BULKIO/{0}PortStatisticsProvider:1.0".format(dt[1]), + scd.inheritsInterface("IDL:BULKIO/updateSRI:1.0")])) + else: + all_interfaces.add_interface(scd.interface(dt[0], "IDL:BULKIO/{0}:1.0".format(dt[0]))) rp.scd.set_interfaces(all_interfaces) rp.scd.componentfeatures.set_ports(ports_scd) From 1798067519b1d8bbd3f412d0f2df8b84edc196af Mon Sep 17 00:00:00 2001 From: Thomas Goodwin Date: Thu, 19 Oct 2017 07:12:33 -0400 Subject: [PATCH 3/3] Missed a close paren --- converter/lib/create_xmls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/converter/lib/create_xmls.py b/converter/lib/create_xmls.py index 855db4e..f720f30 100644 --- a/converter/lib/create_xmls.py +++ b/converter/lib/create_xmls.py @@ -87,11 +87,11 @@ def formatSCD(rp, ports): for dt in all_data_types: if dt[1] == "Provides": all_interfaces.add_interface(scd.interface(dt[0], "IDL:BULKIO/{0}:1.0".format(dt[0]), [ - scd.inheritsInterface("IDL:BULKIO/{0}PortStatisticsProvider:1.0".format(dt[1]), + scd.inheritsInterface("IDL:BULKIO/{0}PortStatisticsProvider:1.0".format(dt[1])), scd.inheritsInterface("IDL:BULKIO/updateSRI:1.0")])) else: all_interfaces.add_interface(scd.interface(dt[0], "IDL:BULKIO/{0}:1.0".format(dt[0]))) - + rp.scd.set_interfaces(all_interfaces) rp.scd.componentfeatures.set_ports(ports_scd)