0

我之前问过一个关于如何在不同架构上创建和运行相同组件的问题,Same component run on 2 different GPPs。IDE 可以通过实现选项卡创建一个可以在两种不同架构上运行的组件。启动波形时,您可以选择为组件实例指定特定的 GPP。

当您不从 IDE 启动波形时,您将如何做同样的事情?我目前从 python 脚本启动波形。

4

1 回答 1

1

您可以通过将 aDeviceAssignmentSequence作为第三个参数传递给ApplicationFactory::create()调用来完成此操作。

序列的每个成员都是一个带有DeviceAssignmentType两个字符串参数的 a。第一个是usagename出现在 SAD 文件中的组件。第二个是您要将组件部署到的设备的标识符。

一个例子:

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())
于 2014-03-27T19:52:18.913 回答