def get_firmware_version(cls, fcp: Hinawa.FwFcp): data = bytearray() data.extend(cls.__PREFIX) data.append(VendorCmd.FIRMWARE_VER.value) data.append(0xff) resp = AvcGeneral.get_vendor_dependent(fcp, cls.__OUI, data) # The response frame includes wrong __OUI and __PREFIX. return resp[4]
def command_get_param(self, cmd): deps = bytearray() deps.append(0x46) deps.append(0x49) deps.append(0x31) deps.append(cmd) deps.append(0xff) params = AvcGeneral.get_vendor_dependent(self.fcp, self.company_ids, deps) return params[4]
def __command_get(cls, fcp, cmd, name): data = bytearray() data.extend(cls.__PREFIX) data.append(cmd.value) data.append(0xff) resp = AvcGeneral.get_vendor_dependent(fcp, cls.__OUI, data) # The response frame includes wrong __OUI and __PREFIX. for key, val in cls.__PARAMS[cmd].items(): if val == resp[4]: return key raise OSError('Invalid argument for {0}.'.format(name))
def get_stream_detection(cls, fcp, company_ids, dir, ext_plug): if dir not in cls.ADDR_DIR: raise ValueError('Invalid argument for address direction') if ext_plug >= 255: raise ValueError('Invalid argument for external plug number') args = bytearray() args.append(0x00) args.append(cls.ADDR_DIR.index(dir)) args.append(ext_plug) args.append(0xff) params = AvcGeneral.get_vendor_dependent(fcp, company_ids, args) if params[0] != args[0] or params[1] != args[1] or params[2] != args[2]: raise OSError('Unexpected value in response') if params[3] == 0x00: return False return True