def superClasses(softpkg): if softpkg.type() == ComponentTypes.RESOURCE: name = 'Resource' package = 'ossie.resource' elif softpkg.type() == ComponentTypes.DEVICE: name = 'Device' package = 'ossie.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 = 'ossie.device' elif softpkg.type() == ComponentTypes.EXECUTABLEDEVICE: name = 'ExecutableDevice' package = 'ossie.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': 'ossie.device'}) return classes
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
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
def _mapComponent(self, softpkg): pycomp = {} pycomp['userclass'] = self.userClass(softpkg) idl = IDLInterface(softpkg.descriptor().repid().repid) pycomp['interface'] = idl.interface() pycomp['operations'] = idl.operations() pycomp['attributes'] = idl.attributes() module = python.idlModule(idl.namespace()) poamod = python.poaModule(idl.namespace()) pycomp['imports'] = (module, poamod) pycomp['baseclass'] = poamod.split('.')[-1] + '.' + idl.interface() return pycomp
def getImplementedInterfaces(softpkg): additionalinfo = set() 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() additionalinfo.add(interface) for parent in inherits.get(interface, []): additionalinfo.add(parent) return additionalinfo
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 = { '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
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
def match(self, port): interface = IDLInterface(port.repid()) if interface.namespace() != self.NAMESPACE: return False return interface.interface().startswith('data')
def hasProvidesPushPacket(self, softpkg): for port in softpkg.providesPorts(): idl = IDLInterface(port.repid()) if idl.namespace() == 'BULKIO' and idl.interface().startswith('data'): return True return False