我之前问过如何在不同的架构Same component run on 2 different GPPs上创建和运行相同的组件。 IDE可以通过实现选项卡创建可以在两种不同体系结构上运行的组件。启动波形时,您可以选择为组件实例指定特定的GPP。
当您不从IDE启动波形时,您会如何做同样的事情?我目前从python脚本启动波形。
答案 0 :(得分:1)
您可以通过将DeviceAssignmentSequence
作为第三个参数传递给ApplicationFactory::create()
来完成此操作。
序列的每个成员都是DeviceAssignmentType
,它接受两个字符串参数。第一个是组件的usagename
,因为它出现在SAD文件中。第二个是您要将Component部署到的设备的标识符。
一个例子:
from ossie.utils import redhawk
from ossie.cf import CF
dom = redhawk.attach("REDHAWK_DEV")
# Find the devices
for devMgr in dom.devMgrs:
# Check the name of Device Manager
if devMgr.name == 'DEV_MGR1':
# Find the GPP
for dev in devMgr.devs:
if dev.name == 'GPP'
dev1 = dev
elif devMgr.name == 'DEV_MGR2':
# Find the GPP
for dev in devMgr.devs:
if dev.name == 'GPP'
dev2 = dev
# Create the deployment requirements
# First variable is comp name as it appears in the SAD file, second is device ID
assignment1 = CF.DeviceAssignmentType('comp_1', dev1._get_identifier())
assignment2 = CF.DeviceAssignmentType('comp_2', dev2._get_identifier())
# Install the Application Factory
dom.installApplicationFactory('/waveforms/app_name/app_name.sad.xml')
# Get the Application Factory
facs = dom._get_applicationFactories()
# If using multiple, different Applications, this list needs to be iterated
# to get the correct factory
app_fac = facs[0]
# Create the Application
app = app_fac.create(app_fac._get_name(), [], [assignment1, assignment2])
# Uninstall the Application Factory
dom.uninstallApplication(app_fac._get_identifier())