本文整理汇总了Python中ta1394.general.AvcGeneral.command_control方法的典型用法代码示例。如果您正苦于以下问题:Python AvcGeneral.command_control方法的具体用法?Python AvcGeneral.command_control怎么用?Python AvcGeneral.command_control使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ta1394.general.AvcGeneral
的用法示例。
在下文中一共展示了AvcGeneral.command_control方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_processing_mixer_state_all
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_processing_mixer_state_all(unit, subunit_id, attr, fb_id, in_fb,
states):
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')
data_count = len(states) // 2
args = bytearray()
args.append(0x00)
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(data_count) # The length of control data
for i in range(data_count):
args.append((states[i * 2] << 8) | states[i * 2 + 1])
AvcGeneral.command_control(unit, args)
示例2: set_feature_mute_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_feature_mute_state(unit, subunit_id, attr, fb_id, ch, mute):
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')
if mute:
mute = 0x70
else:
mute = 0x80
args = bytearray()
args.append(0x00)
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(mute)
AvcGeneral.command_control(unit, args)
示例3: set_digital_channel_status
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_digital_channel_status(cls, fcp, spec, name, values):
if spec is 'con':
attrs = BcoVendorDependent.supported_con_status
subcmds = BcoVendorDependent._con_subcmds
elif spec is 'pro':
attrs = BcoVendorDependent.supported_pro_status
subcmds = BcoVendorDependent._pro_subcmds
else:
raise ValueError('Invalid argument for specification name')
if name not in attrs:
raise ValueError('Invalid argument for attribute name')
if attrs[name] != 1:
if type(values) is not 'list' or len(values) != attrs[name]:
raise ValueError('Invalid argument for attribute value length')
args = bytearray(0xff for i in range(10))
args[0] = 0x00
args[1] = 0xff
args[2] = 0x00
args[3] = BcoVendorDependent.supported_spec.index(spec)
args[4] = subcmds[name]
args[5] = attrs[name]
if attrs[name] == 1:
args[6] = values
else:
for i in range(len(values)):
args[6 + i] = values[i]
AvcGeneral.command_control(fcp, args)
示例4: set_processing_mixer_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_processing_mixer_state(unit, subunit_id, attr, fb_id, in_fb,
in_ch, out_ch, setting):
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(0x00)
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(setting >> 8) # Higher part of setting
args.append(setting & 0xff) # Lower part of setting
AvcGeneral.command_control(unit, args)
示例5: set_format
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_format(cls, fcp, direction, plug, fmt):
args = bytearray()
args.append(0x00) # Control
args.append(0xff) # Addressing to unit
args.append(0xbf) # Extended stream format information command
args.append(0xc0) # SINGLE subfunction
args.append(cls.plug_direction.index(direction))
args.append(0x00)
args.append(0x00)
args.append(plug)
args.append(0xff)
args.append(0xff)
args.extend(cls._build_format(fmt))
AvcGeneral.command_control(fcp, args)
示例6: set_selector_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_selector_state(unit, subunit_id, attr, fb_id, value):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if ('current', 'minimum', 'maximum', 'default').count(attr) == 0:
raise ValueError('Invalid argument for attribute')
if fb_id > 255:
raise ValueError('Invalid argument for function block ID')
if value > 255:
raise ValueError('Invalid argument for selector value')
args = bytearray()
args.append(0x00)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x80) # Selector function block
args.append(fb_id)
args.append(AvcAudio.attribute_values[attribute])
args.append(0x02) # Selector length is 2
args.append(value)
args.append(0x01) # Selector control
AvcGeneral.command_control(unit, args)
示例7: set_signal_source
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_signal_source(cls, fcp, src, dst):
args = bytearray()
args.append(0x00)
args.append(0xff)
args.append(0x1a)
args.append(0x0f)
args.append(src[0])
args.append(src[1])
args.append(dst[0])
args.append(dst[1])
return AvcGeneral.command_control(fcp, args)
示例8: set_signal_souarce
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_signal_souarce(unit, src, dst):
args = bytearray()
args.append(0x01)
args.append(0xff)
args.append(0x1a)
args.append(0x0f)
args.append(src[0])
args.append(src[1])
args.append(dst[0])
args.append(dst[1])
return AvcGeneral.command_control(unit, args)
示例9: set_feature_lr_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_feature_lr_state(unit, subunit_id, attr, fb_id, ch, balance):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if AvcAudio.attributes.count(attr) == 0:
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(0x00)
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(0x03) # LR control
args.append(0x02) # Control data length is 2
args.append(balance >> 8) # Higher part of balance
args.append(balance & 0xff) # Lower part of balance
AvcGeneral.command_control(unit, args)
示例10: set_feature_volume_state
# 需要导入模块: from ta1394.general import AvcGeneral [as 别名]
# 或者: from ta1394.general.AvcGeneral import command_control [as 别名]
def set_feature_volume_state(cls, fcp, subunit_id, attr, fb_id, ch, vol):
if subunit_id > 0x07:
raise ValueError('Invalid argument for subunit ID')
if cls.attributes.count(attr) == 0:
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(0x00)
args.append(0x08 | (subunit_id & 0x07))
args.append(0xb8)
args.append(0x81) # Feature function block
args.append(fb_id)
args.append(cls.attribute_values[attr])
args.append(0x02) # Selector length is 2
args.append(ch)
args.append(0x02) # Volume control
args.append(0x02) # Control data length is 2
args.append(vol >> 8) # Higher part of volume
args.append(vol & 0xff) # Lower part of volume
AvcGeneral.command_control(fcp, args)