Skip to content

Commit da12083

Browse files
author
Max Robert
committed
Fix python sandbox for child devices
1 parent e3b4b60 commit da12083

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

redhawk-codegen/redhawk/codegen/model/softpkg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ def __init__(self, spdFile=None, name=None, prfFile=None, scdFile=None):
131131
self.__children = []
132132
if self.__spd.get_child():
133133
for child in self.__spd.get_child():
134-
self.__children.append({'name':child.get_name(), 'prf':child.get_childPropertyFile().get_localfile().get_name(), 'scd':child.get_childDescriptorFile().get_localfile().get_name()})
134+
child_spd_name = child.get_childSoftwarePackageFile().get_localfile().get_name()
135+
child_spd = ossie.parsers.spd.parse(child_spd_name)
136+
child_prf_name = child_spd.propertyfile.localfile.name
137+
child_scd_name = child_spd.descriptor.localfile.name
138+
self.__children.append({'name':child.get_name(), 'spd':child_spd_name, 'prf':child_prf_name, 'scd':child_scd_name})
135139
else:
136140
self.__spdFile = None
137141
class tmpSPD:

redhawk/src/base/framework/python/ossie/dynamiccomponent.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from omniORB import any as _any
66
import threading
77

8+
from utils.sandbox.model import SandboxDevice
9+
810
class DynamicComponentRegistry:
911
def __init__(self):
1012
self.__components = {}
@@ -44,9 +46,11 @@ def addChild(self, instance, instanceName=None):
4446
self._dynamicComponentCount[device_name] += 1
4547
device_name_count = device_name+'_'+str(self._dynamicComponentCount[device_name])
4648
device_label = self._label+':'+device_name_count
49+
base_path = self._softwareProfile.split('/')
50+
device_spd = '/'.join(base_path[:-1])+'/'+device_name+'.spd.xml'
4751
parameters.append(CF.DataType('IDM_CHANNEL_IOR', _any.to_any(ossie.resource.__orb__.object_to_string(self._idm_publisher.channel))))
4852
parameters.append(CF.DataType('DEVICE_LABEL', _any.to_any(device_label)))
49-
parameters.append(CF.DataType('PROFILE_NAME', _any.to_any('')))
53+
parameters.append(CF.DataType('PROFILE_NAME', _any.to_any(device_spd)))
5054
parameters.append(CF.DataType('DEVICE_MGR_IOR', _any.to_any(ossie.resource.__orb__.object_to_string(self._devMgr.ref))))
5155
parameters.append(CF.DataType('DEVICE_ID', _any.to_any(self._id+':'+device_name_count)))
5256
parameters.append(CF.DataType('COMPOSITE_DEVICE_IOR', _any.to_any(ossie.resource.__orb__.object_to_string(self._this()))))

redhawk/src/base/framework/python/ossie/utils/sandbox/local.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import launcher
4141
from debugger import GDB, JDB, PDB, Valgrind, Debugger
4242
import terminal
43+
from model import SandboxDevice
4344

4445
warnings.filterwarnings('once',category=DeprecationWarning)
4546

@@ -507,7 +508,24 @@ def _createLauncher(self, comptype, execparams, initProps, initialize, configPro
507508
return None
508509
return clazz(execparams, initProps, initialize, configProps, debugger, window, timeout, shared, stdout)
509510

511+
def _refreshChildDevices(self):
512+
for comp in self.__components.values():
513+
if hasattr(comp, 'devices'):
514+
for dev in comp.devices:
515+
found_device = False
516+
for _tmp_comp_key in self.__components:
517+
if _tmp_comp_key == dev.label:
518+
found_device = True
519+
break
520+
if not found_device:
521+
sdrRoot = self.getSdrRoot()
522+
spd, scd, prf = sdrRoot.readProfile(dev.softwareProfile)
523+
comp = SandboxDevice(self, dev.softwareProfile, spd, scd, prf, dev.label, dev.identifier, None)
524+
comp.ref = dev
525+
self._registerComponent(comp)
526+
510527
def getComponents(self):
528+
self._refreshChildDevices()
511529
return self.__components.values()
512530

513531
def getServices(self):
@@ -526,6 +544,7 @@ def _addService(self, service):
526544
self.__services[service._instanceName] = service
527545

528546
def getComponent(self, name):
547+
self._refreshChildDevices()
529548
return self.__components.get(name, None)
530549

531550
def retrieve(self, name):

redhawk/src/base/framework/python/ossie/utils/sb/domainless.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def show():
301301
sandbox = _getSandbox()
302302
print "Components Running:"
303303
print "------------------"
304+
print '*********'
304305
for component in sandbox.getComponents():
305306
print component._instanceName, component
306307
print "\n"

0 commit comments

Comments
 (0)