def languageChange(self, domainName):
     if domainName == None:
         self.setWindowTitle(self.__tr("REDHAWK Domain Browser"))
         try:
             redhawk.scan()
         except RuntimeError:
             self.setStatusBar()
     else:
         self.setWindowTitle(self.__tr("REDHAWK Domain Browser: "+domainName))
     self.textLabel1.setText(self.__tr("Domain:"))
     self.domainLabel.setText(QString())
     self.refreshButton.setText(self.__tr("&Refresh"))
    def refreshView (self):
        runsetup = False
        if self.currentDomain == "":
            domainName = self.findDomains()
            if not domainName:
                return
            runsetup = True
        elif self.currentDomain not in redhawk.scan():
            domainName = self.findDomains()
            self.objectListView.clear()
            runsetup = True
        else:
            domainName = self.currentDomain

        self.getDomain(domainName)
        if runsetup:
            self.setupDomain()
        self._requests.put('cleardomMgrItem')
        self._requests.put('cleardevMgrItem')
        self._requests.put('clearappsItem')
        self._requests.put('parseDomainManager')
        self._requests.put('parseApplications')
        self._requests.put('parseAllDeviceManagers')

        if domainName == None:
            self._requests.put(('setWindowTitle', "REDHAWK Domain Browser"))
        else:
            self._requests.put(('setWindowTitle', "REDHAWK Domain Browser: "+domainName))
    def refreshView(self):
        runsetup = False
        if self.currentDomain == "":
            domainName = self.findDomains()
            if not domainName:
                return
            runsetup = True
        elif self.currentDomain not in redhawk.scan():
            domainName = self.findDomains()
            self.objectListView.clear()
            runsetup = True
        else:
            domainName = self.currentDomain

        self.getDomain(domainName)
        if runsetup:
            self.setupDomain()
        self._requests.put('cleardomMgrItem')
        self._requests.put('cleardevMgrItem')
        self._requests.put('clearappsItem')
        self._requests.put('parseDomainManager')
        self._requests.put('parseApplications')
        self._requests.put('parseAllDeviceManagers')

        if domainName == None:
            self._requests.put(('setWindowTitle', "REDHAWK Domain Browser"))
        else:
            self._requests.put(
                ('setWindowTitle', "REDHAWK Domain Browser: " + domainName))
Example #4
0
def get_domain(domain, devices=[]):
    """Get the domain

    .. warn:: Enforcing device list has not been implemented

    Parameters
    ----------
    domain : str or None
        The name of the domain.  If None, tries to connect to
        available domain

    devices : list
        List of devices to launch with the domain.
    """
    active_domains = redhawk.scan()
    if domain in active_domains:
        # domain exists, just attach
        dom = redhawk.attach(domain)
    else:
        if devices:
            dom = redhawk.kickDomain(domain,
                kick_domain_managers=True, device_managers=devices)
        else:
            dom = redhawk.kickDomain(domain, kick_device_managers=False)

    # TODO: check that devices is available, otherwise launch them now
    pass

    return dom
Example #5
0
 def __init__(self, *args, **kwargs):
     super(DeviceDialog,self).__init__(*args, **kwargs)
     ui.load('devicedialog.ui', self)
     self._nodes = {}
     for domain in redhawk.scan():
         self.domainNameEdit.addItem(domain)
     self.nodeListWidget.itemDoubleClicked.connect(self.onTreeWidgetItemDoubleClicked)
Example #6
0
 def __init__(self, *args, **kwargs):
     super(DeviceDialog, self).__init__(*args, **kwargs)
     ui.load('devicedialog.ui', self)
     for domain in redhawk.scan():
         self.domainNameEdit.addItem(domain)
     self.nodeTreeWidget.itemDoubleClicked.connect(
         self.onTreeWidgetItemDoubleClicked)
Example #7
0
 def _connectToDomain(self):
     self.dom = redhawk.attach(redhawk.scan()[0])
     rx_pis, tx_pis = self._getPisList()
     for node in rx_pis:
         lat, lon, valid = self._getNodeLatLon(node)
         self.update_map(node.name, 'add', lat, lon)
     for node in tx_pis:
         lat, lon, valid = self._getNodeLatLon(node)
         self.update_map(node.name, 'addTx', lat, lon)
 def setupDomain(self):
     self.domainLabel.setText(self.currentDomain + ' ' + self.domManager._get_identifier())
     #check if a domain is running to clear status bar of errors
     if len(redhawk.scan()) > 0:
         self.textLabel2.setText("")
     self.objectListView.setContextMenuPolicy(Qt.CustomContextMenu)
     self.domMgrItem = self.addTreeWidgetItem(self.objectListView, 'Domain Manager')
     self.devMgrItem = self.addTreeWidgetItem(self.objectListView, 'Device Managers')
     self.appsItem = self.addTreeWidgetItem(self.objectListView, 'Applications')
     self.objectListView.setCallbackObject(self)
Example #9
0
 def findDomains(self):
     domainList = redhawk.scan()
     if len(domainList) == 1:
         return domainList[0]
     stringlist = QStringList()
     for entry in domainList:
         stringlist.append(QString(entry))
     retval = QInputDialog.getItem(None, QString("pick a domain"), QString("domains"), stringlist, 0, False)
     if retval[1] == False:
         return None
     return str(retval[0])
Example #10
0
 def findDomains(self):
     domainList = redhawk.scan()
     if len(domainList) == 1:
         return domainList[0]
     stringlist = QStringList()
     for entry in domainList:
         stringlist.append(QString(entry))
     retval = QInputDialog.getItem(None, QString("pick a domain"),
                                   QString("domains"), stringlist, 0, False)
     if retval[1] == False:
         return None
     return str(retval[0])
Example #11
0
 def setupDomain(self):
     self.domainLabel.setText(self.currentDomain + ' ' +
                              self.domManager._get_identifier())
     #check if a domain is running to clear status bar of errors
     if len(redhawk.scan()) > 0:
         self.textLabel2.setText("")
     self.objectListView.setContextMenuPolicy(Qt.CustomContextMenu)
     self.domMgrItem = self.addTreeWidgetItem(self.objectListView,
                                              'Domain Manager')
     self.devMgrItem = self.addTreeWidgetItem(self.objectListView,
                                              'Device Managers')
     self.appsItem = self.addTreeWidgetItem(self.objectListView,
                                            'Applications')
     self.objectListView.setCallbackObject(self)
Example #12
0
def getLaptopLatLon():
    dom = redhawk.attach(redhawk.scan()[0])
    for node in dom.devMgrs:
        if node.name.lower() == 'LaptopNode':
            for dev in node.devs:
                if dev.name.lower() == 'gps_receiver':
                    gps_port = dev.getPort('GPS_idl')
                    pos = gps_port._get_gps_time_pos().position
                    return pos.lat, pos.lon, pos.valid
    lat = raw_input(
        "WARNING: Unable to find GPS device connected to server.\nPlease enter latitude in degrees: "
    )
    lon = raw_input("Please enter longitue in degrees: ")
    return lat, lon, True
Example #13
0
 def get(self):
     print("A client pulled map_template.html to show the map")
     pis = 0
     dom = redhawk.attach(redhawk.scan()[0])
     for node in dom.devMgrs:
         print("Node name: %s" % node.name)
         if 'raspberry' in node.name.lower():
             pis = pis + 1
     print("Number of pis: %s" % pis)
     self.render("map_template.html",
                 ipaddr=self._ipaddr,
                 port=self._port,
                 lat=self._lat,
                 lon=self._lon,
                 num_pis=0)
Example #14
0
def setup_domains(domain_dict, delay=5):
    """Setup domains specified

    Attempts to attach or kick start a list of domains with the
    specified device managers.

    .. warning:: Currently does not support launching device managers
        when attaching to a domain

    Parameters
    ----------
    domain_dict : dict
        Dictionary of domain specs.  The key will be the domain name.
        The supported fields include:
            devices_managers : list
    """
    active_domains = redhawk.scan()

    for domain in domain_dict:
        # extract potential list of device managers
        dev_mgrs = domain_dict[domain].get("device_managers", [])

        # -----------------------  setup domain instance  -------------------
        if domain in active_domains:
            # attach to active domain
            dom = redhawk.attach(domain)

        else:
            # kick start domain
            if dev_mgrs:
                dom = redhawk.kickDomain(domain, device_managers=dev_mgrs)
            else:
                # no device managers.. just launch domain
                dom = redhawk.kickDomain(domain, kick_device_managers=False)

            # allow delay x number of device managers to load
            time.sleep(delay * len(dev_mgrs))

        # -----------------------  check device managers  -------------------
        if dev_mgrs:
            # check if device managers have been loaded
            for dev_mgr in dev_mgrs:
                if dev_mgr not in dom.devMgrs:
                    warnings.warn("Have not implemented setting up device"+\
                        " managers on an active domain")
Example #15
0
 def _getMessagesForDomainListing(self, change='add'):
     msgs = []
     
     try:
         names = redhawk.scan()
         for name in names:
             d = redhawk.attach(name)
             id = d._get_identifier()
             msgs.append(RH_Message(change = change, 
                                    rhtype = 'domain', 
                                    rhid   = id, 
                                    rhname = name))
     except Exception as e:
         print("Caught exception while scanning REDHAWK CORE...never good.")
         print("---> Forcing a reset of the RH_Gateway."); sys.stdout.flush()
         self.close()
         
     finally:
         return msgs
Example #16
0
    def _getMessagesForDomainListing(self, change='add'):
        msgs = []

        try:
            names = redhawk.scan()
            for name in names:
                d = redhawk.attach(name)
                id = d._get_identifier()
                msgs.append(
                    RH_Message(change=change,
                               rhtype='domain',
                               rhid=id,
                               rhname=name))
        except Exception as e:
            print("Caught exception while scanning REDHAWK CORE...never good.")
            print("---> Forcing a reset of the RH_Gateway.")
            sys.stdout.flush()
            self.close()

        finally:
            return msgs
Example #17
0
#!/usr/bin/env python
"""
Start this in interactive mode by running 'python -i py_debug.py'
This will start you out in an interactive session with objects already
created for the domain and nodes.
"""

from ossie.utils import redhawk

dom = redhawk.attach(redhawk.scan()[0])
print("\nAttached to Domain '%s'" % dom.name)
print("\nAvailable Nodes and Devices:")
nodes = dom.devMgrs
for num, node in enumerate(dom.devMgrs):
    print("%d.  %s" % (num, node.name))
    for dnum, dev in enumerate(node.devs):
        print("\t%d.  %s" % (dnum, dev.name))
print("\nWaveforms launched:")
wfs = dom.apps
for num, wf in enumerate(dom.apps):
    print("%d.  %s" % (num, wf.name))
    for cnum, comp in enumerate(wf.comps):
        print("\t%d.  %s" % (cnum, comp.name))
print
try:
    del (num, node, dnum, dev, wf, cnum, comp)
except NameError:
    pass