def get_subunit_plug_info(cls, fcp): subunits = {} for page in range(AvcGeneral.MAXIMUM_SUBUNIT_PAGE + 1): try: info = AvcGeneral.get_subunit_info(fcp, page) except Exception: break for entry in info: subunit_type = entry['type'] maximum_id = entry['maximum-id'] for subunit_id in range(maximum_id + 1): try: data = AvcConnection.get_subunit_plug_info( fcp, subunit_type, subunit_id) except Exception: continue id = (subunit_type, subunit_id) if id not in subunits: subunits[id] = {} for direction, count in data.items(): subunits[id][direction] = count return subunits
def __parse_subunit_plugs(self): subunit_plugs = {} for page in range(AvcGeneral.MAXIMUM_SUBUNIT_PAGE + 1): try: subunits = AvcGeneral.get_subunit_info(self.fcp, page) except: break for entry in subunits: type = entry['type'] maximum_id = entry['maximum-id'] if type not in subunit_plugs: subunit_plugs[type] = {} for id in range(maximum_id + 1): if id not in subunit_plugs[type]: subunit_plugs[type][id] = {} subunit_plugs[type][id]['output'] = {} subunit_plugs[type][id]['input'] = {} info = AvcConnection.get_subunit_plug_info(self.fcp, type, 0) for dir, num in info.items(): for i in range(num): plug = self.__parse_subunit_plug(dir, type, 0, i) subunit_plugs[type][id][dir][i] = plug return subunit_plugs
def __get_clock_plugs(self): plugs = {} info = AvcConnection.get_subunit_plug_info(self.fcp, 'music', 0) for direction in ('input', 'output'): for i in range(info[direction]): addr = BcoPlugInfo.get_subunit_addr(direction, 'music', 0, i) plug_type = BcoPlugInfo.get_plug_type(self.fcp, addr) if plug_type == 'Sync': plugs[direction] = \ AvcCcm.get_subunit_signal_addr('music', 0, i) break else: raise OSError('Unexpected state of device for clock source.') return plugs
def _parse_subunit_plugs(self): subunit_plugs = {} subunits = BcoSubunitInfo.get_subunits(self.fcp) for subunit in subunits: type = subunit['type'] id = subunit['id'] if type not in subunit_plugs: subunit_plugs[type] = {} if id not in subunit_plugs[type]: subunit_plugs[type][id] = {} subunit_plugs[type][id]['output'] = {} subunit_plugs[type][id]['input'] = {} info = AvcConnection.get_subunit_plug_info(self.fcp, type, 0) for dir, num in info.items(): for i in range(num): plug = self._parse_subunit_plug(dir, type, 0, i) subunit_plugs[type][id][dir][i] = plug return subunit_plugs