Ejemplo n.º 1
0
 def hasAnalogTunerProvidesPorts(self, softpkg):
     for port in softpkg.providesPorts():
         idl = IDLInterface(port.repid())
         if idl.namespace() == 'FRONTEND':
             if idl.interface().find('AnalogTuner') != -1:
                 return True
     return False
Ejemplo n.º 2
0
 def __init__(self, port):
     self.idl = IDLInterface(port.repid())
     self.namespace = self.idl.namespace()
     self.interface = self.idl.interface()
     if port.isProvides():
         self.direction = 'provides'
     else:
         self.direction = 'uses'
Ejemplo n.º 3
0
 def getInterfaceNamespaces(self, softpkg):
     if not softpkg.descriptor():
         return
     # The CF interfaces are already assumed as part of SCA
     seen = set(['CF', 'ExtendedCF', 'ExtendedEvent'])
     for interface in softpkg.descriptor().interfaces():
         namespace = IDLInterface(interface.repid).namespace()
         # Assume that omg.org interfaces are available as part of the ORB.
         if namespace in seen or namespace.startswith('omg.org/Cos'):
             continue
         seen.add(namespace)
         yield namespace
         if namespace == 'FRONTEND':
             if 'BULKIO' not in seen:
                 seen.add('BULKIO')
                 yield 'BULKIO'
Ejemplo n.º 4
0
 def superClasses(softpkg):
     if softpkg.type() == ComponentTypes.RESOURCE:
         name = 'Resource'
         package = 'sca.resource'
     elif softpkg.type() == ComponentTypes.DEVICE:
         name = 'Device'
         package = 'sca.device'
         for port in softpkg.providesPorts():
             idl = IDLInterface(port.repid())
             if idl.namespace() == 'FRONTEND':
                 if idl.interface().find('DigitalTuner') != -1 or \
                    idl.interface().find('AnalogTuner') != -1 or \
                    idl.interface().find('FrontendTuner') != -1:
                     name = 'frontend.FrontendTunerDevice'
     elif softpkg.type() == ComponentTypes.LOADABLEDEVICE:
         name = 'LoadableDevice'
         package = 'sca.device'
     elif softpkg.type() == ComponentTypes.EXECUTABLEDEVICE:
         name = 'ExecutableDevice'
         package = 'sca.device'
     else:
         raise ValueError, 'Unsupported software component type', softpkg.type(
         )
     classes = [{'name': name, 'package': package}]
     if softpkg.descriptor().supports('IDL:CF/AggregateDevice:1.0'):
         classes.append({
             'name': 'AggregateDevice',
             'package': 'sca.device'
         })
     return classes
Ejemplo n.º 5
0
    def getImplementedInterfaces(softpkg):
        deviceinfo = set()

        # Ensure that parent interfaces also gets added (so, e.g., a device
        # with a DigitalTuner should also report that it's an AnalogTuner
        # and FrontendTuner)
        inherits = { 'DigitalScanningTuner': ('ScanningTuner', 'DigitalTuner', 'AnalogTuner', 'FrontendTuner'),
                     'AnalogScanningTuner': ('ScanningTuner', 'AnalogTuner', 'FrontendTuner'),
                     'DigitalTuner': ('AnalogTuner', 'FrontendTuner'),
                     'AnalogTuner': ('FrontendTuner',) }

        for port in softpkg.providesPorts():
            idl = IDLInterface(port.repid())
            # Ignore non-FRONTEND intefaces
            if idl.namespace() != 'FRONTEND':
                continue
            interface = idl.interface()
            deviceinfo.add(interface)
            for parent in inherits.get(interface, []):
                deviceinfo.add(parent)
        
        return deviceinfo
Ejemplo n.º 6
0
class PortGenerator(object):
    @classmethod
    def match(cls, port):
        return False

    @classmethod
    def generator(cls, port):
        return cls(port)

    def __init__(self, port):
        self.idl = IDLInterface(port.repid())
        self.namespace = self.idl.namespace()
        self.interface = self.idl.interface()
        if port.isProvides():
            self.direction = 'provides'
        else:
            self.direction = 'uses'

    def get_template(self, template):
        loader = self.loader()
        env = CodegenEnvironment(loader=loader, **template.options())
        env.filters.update(template.filters())
        return env.get_template(template.template)

    def loader(self):
        raise NotImplementedError, self.__class__.__name__ + '.loader'

    def hasImplementation(self):
        return self._implementation() is not None

    def implementation(self):
        template = self._implementation()
        return self.get_template(template)

    def _implementation(self):
        return None
Ejemplo n.º 7
0
 def match(self, port):
     return IDLInterface(port.repid()).namespace() == self.NAMESPACE
Ejemplo n.º 8
0
 def generator(self, port):
     interface = IDLInterface(port.repid()).interface()
     return FrontendPortGenerator(port)
Ejemplo n.º 9
0
 def match(self, port):
     interface = IDLInterface(port.repid())
     if interface.namespace() != self.NAMESPACE:
         return False
     return interface.interface().startswith('data')