0

同じコンポーネントを異なるアーキテクチャで作成して実行する方法について以前に質問しました。IDE は、[実装] タブを使用して、2 つの異なるアーキテクチャで実行できるコンポーネントを作成できます。波形を起動するときに、コンポーネント インスタンスに特定の GPP を指定するオプションがあります。

IDE から波形を起動していない場合、どのように同じことを行いますか? 現在、Python スクリプトから波形を起動しています。

4

1 に答える 1

1

DeviceAssignmentSequenceこれは、呼び出しの 3 番目の引数としてa を渡すことで実現できApplicationFactory::create()ます。

シーケンスの各メンバーは、DeviceAssignmentType2 つの文字列パラメーターを取る です。usagename1 つ目は、SAD ファイルに表示されるコンポーネントです。2 番目は、コンポーネントをデプロイするデバイスの識別子です。

例:

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 に答える