I am wanting to start Redhawk Domain Mgr, Device Mgrs, and Waveform on cpu at startup, without any user intervention. I then should be able to connect to it with the IDE.
I have created a python script that does the following:
#! /usr/local/bin/python
from ossie.utils import redhawk
#Start a new domain and device managers
domain = redhawk.kickDomain()
wave = domain.createApplication("/waveforms/msgWaveform/msgWaveform.sad.xml")
wave.start()
This starts Domain mgr, Device mgr, and Msg waveform.
After this perl script completes, I then bring up the IDE. I connect to the Domain. I see the devices, but the waveform is not present. It appears that waveform ends when the perl script finishes. I was hoping that the waveform would not disappear but I would be able to retrieve it at later time.
Do I need to start a service which is used to help keep the waveform alive?
The "createApplication" intentionally cleans up when the script exits, but there are two ways to get around it.
The easiest would be to add a while loop to the end of the script. This would keep the Waveform running as long as the script is running, and you would stop it by Ctrl-C in the terminal running the script. Based on your original script it would look like:
#! /usr/local/bin/python
import time
from ossie.utils import redhawk
#Start a new domain and device managers
domain = redhawk.kickDomain()
time.sleep(1)
wave = domain.createApplication("/waveforms/Test/Test.sad.xml")
wave.start()
while True:
time.sleep(1)
This is not recommended for anything other than testing. In addition to closing the Waveform when the script ends, the above code also stops the domain and the device manager.For systems that launch waveforms on boot, commonly the domain and device managers are launched via /etc/init.d scripts like so:
nodeBooter -D --daemon
nodeBooter -d /nodes/DevMgr_[hostname]/DeviceManager.dcd.xml --daemon
And then in your script you would do something like:
from ossie.utils import redhawk
from ossie.cf import CF
domain = redhawk.Domain('REDHAWK_DEV')
try:
domain.installApplication("/waveforms/Test/Test.sad.xml")
except CF.DomainManager.ApplicationAlreadyInstalled:
print "Already Installed, skipping."
factories = domain._get_applicationFactories()
#if multiple applications are installed you can look for the correct factory
# using factories[i]._get_name() == 'Test'
myFactory = factories[0]
myFactory.create('Test_[UNIQUEID]', [], [])