本文整理汇总了Python中ta1394.general.AvcGeneral.command_status方法的典型用法代码示例。如果您正苦于以下问题:Python AvcGeneral.command_status方法的具体用法?Python AvcGeneral.command_status怎么用?Python AvcGeneral.command_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ta1394.general.AvcGeneral
的用法示例。
在下文中一共展示了AvcGeneral.command_status方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_formats
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_formats(unit, direction, plug):
if AvcGeneral.plug_direction.count(direction) == 0:
raise ValueError('Invalid argument for plug direction')
if plug > 255:
raise ValueError('Invalid argument for plug number')
fmts = []
args = bytearray()
args.append(0x01)
args.append(0xff)
args.append(0xbf)
args.append(0xc1)
args.append(AvcGeneral.plug_direction.index(direction))
args.append(0x00)
args.append(0x00)
args.append(plug)
args.append(0xff)
args.append(0xff)
args.append(0x00)
args.append(0xff)
for i in range(255):
args[10] = i
try:
fmt = AvcGeneral.command_status(unit, args)
fmts.append(fmt)
except:
break
return fmts
示例2: get_plug_clusters
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_clusters(unit, addr):
if addr[1] != BcoPlugInfo.addr_mode.index('unit') or \
addr[2] != BcoPlugInfo.addr_unit_type.index('isoc'):
raise ValueError('Isochronous unit plugs just support this')
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x03) # Info type is 'channel position data'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(unit, args)
data = params[10:]
pos = 0
clusters = [[] for i in range(data[pos])]
pos += 1
for cls in range(len(clusters)):
num = data[pos]
pos += 1
if num == 0:
break;
clusters[cls] = [[0, 0] for j in range(num)]
for e in range(len(clusters[cls])):
clusters[cls][e][0] = data[pos];
clusters[cls][e][1] = data[pos + 1];
pos += 2
return clusters
示例3: get_processing_mixer_state_all
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_processing_mixer_state_all(unit, subunit_id, attr, fb_id, in_fb):
attrs = ('current', 'minimum', 'maximum', 'resolution', 'default')
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attrs.count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if in_fb > 255:
raise ValueError('Invalid argument for input function block ID')
args = bytearray()
args.append(0x01)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x82) # Processing function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x04) # Selector length is 4
args.append(in_fb)
args.append(0xff)
args.append(0xff)
args.append(0x03) # Mixer control
args.append(0xff) # The length of control data in response
params = AvcGeneral.command_status(unit, args)
count = params[11] // 2
status = []
for i in range(count):
status.append((params[12 + i * 2] << 8) | params[13 + i * 2])
return status
示例4: get_processing_mixer_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_processing_mixer_state(unit, subunit_id, attr, fb_id, in_fb,
in_ch, out_ch):
attrs = ('current', 'minimum', 'maximum', 'resolution', 'default')
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attrs.count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if in_fb > 255:
raise ValueError('Invalid argument for input function block ID')
if in_ch > 255:
raise ValueError('Invalid argument for input channel number')
if out_ch > 255:
raise ValueError('Invalid argument for output channel number')
args = bytearray()
args.append(0x01)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x82) # Processing function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x04) # Selector length is 4
args.append(in_fb)
args.append(in_ch)
args.append(out_ch)
args.append(0x03) # Mixer control
args.append(0x02) # Control data is 2
args.append(0xff) # Higher part of setting
args.append(0xff) # Lower part of setting
params = AvcGeneral.command_status(unit, args)
return (params[12] << 8) | params[13]
示例5: get_feature_mute_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_feature_mute_state(unit, subunit_id, attr, fb_id, ch):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if attr is not 'current':
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if ch > 255:
raise ValueError('Invalid argument for channel number')
args = bytearray()
args.append(0x01)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x81) # Feature function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attr])
args.append(0x02) # Selector length is 2
args.append(ch)
args.append(0x01) # Mute control
args.append(0x01) # Control data length is 1
args.append(0xff) # Status
params = AvcGeneral.command_status(unit, args)
if params[10] == 0x70:
return True
elif params[10] == 0x60:
return False
else:
raise OSError('Unexpected value in response')
示例6: get_entry_list
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_entry_list(cls, fcp, addr):
fmts = []
for i in range(0xff):
# DM1500 tends to cause timeout.
time.sleep(0.1)
try:
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x2f) # Bco stream format support
args.append(0xc1) # List request
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0xff)
args.append(i)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
fmts.append(cls._parse_format(params[11:]))
except OSError as e:
if str(e) != 'Rejected':
raise
else:
break
return fmts
示例7: get_plug_clusters
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_clusters(cls, fcp, addr):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x03) # Info type is 'channel position data'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
data = params[10:]
pos = 0
clusters = [[] for i in range(data[pos])]
pos += 1
for cls in range(len(clusters)):
num = data[pos]
pos += 1
if num == 0:
break;
clusters[cls] = [[0, 0] for j in range(num)]
for e in range(len(clusters[cls])):
clusters[cls][e][0] = data[pos];
clusters[cls][e][1] = data[pos + 1];
pos += 2
return clusters
示例8: get_signal_source
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_signal_source(unit, dst):
args = bytearray()
args.append(0x01)
args.append(0xff)
args.append(0x1a)
args.append(0xff)
args.append(0xff)
args.append(0xfe)
args.append(dst[0])
args.append(dst[1])
params = AvcGeneral.command_status(unit, args)
return AvcCcm.parse_signal_addr(params[6:])
示例9: get_signal_source
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_signal_source(cls, fcp, dst):
args = bytearray()
args.append(0x01)
args.append(0xff)
args.append(0x1a)
args.append(0xff)
args.append(0xff)
args.append(0xfe)
args.append(dst[0])
args.append(dst[1])
params = AvcGeneral.command_status(fcp, args)
src = params[4:6]
return cls.parse_signal_addr(src)
示例10: get_plug_input
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_input(cls, fcp, addr):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x05) # Info type is 'input data'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
return cls.parse_plug_addr(params[10:])
示例11: get_plug_channels
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_channels(cls, fcp, addr):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x02) # Info type is 'the number of channels'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
return params[10]
示例12: get_plug_cluster_info
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_cluster_info(cls, fcp, addr, cluster):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x07) # Info type is 'cluster info'
args.append(cluster)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
length = params[12]
return params[13:13+length].decode()
示例13: get_plug_ch_name
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_ch_name(cls, fcp, addr, pos):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x04) # Info type is 'channel position name'
args.append(pos)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
length = params[11]
return params[12:12+length].decode()
示例14: get_plug_type
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_type(cls, fcp, addr):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x00) # Info type is 'type'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
if params[10] > len(cls.plug_type):
raise OSError('Unexpected value in response')
return cls.plug_type[params[10]]
示例15: get_plug_name
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_status [as 别名]
def get_plug_name(cls, fcp, addr):
args = bytearray()
args.append(0x01)
args.append(addr[5])
args.append(0x02) # Plug info command
args.append(0xc0) # Bco plug info subcommand
args.append(addr[0])
args.append(addr[1])
args.append(addr[2])
args.append(addr[3])
args.append(addr[4])
args.append(0x01) # Info type is 'name'
args.append(0xff)
args.append(0xff)
params = AvcGeneral.command_status(fcp, args)
length = params[10]
if length == 0:
return ""
return params[11:11 + length].decode()