Class: UVC::ExtensionUnitDescriptor

Inherits:
ClassSpecificVCInterfaceDescriptor show all
Defined in:
lib/uvc.rb

Instance Attribute Summary collapse

Attributes inherited from ClassSpecificVCInterfaceDescriptor

#bDescriptorSubType, #bDescriptorType, #rest

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ClassSpecificVCInterfaceDescriptor

parse_array

Constructor Details

#initialize(bDescriptorType, bDescriptorSubType, bUnitID, guidExtensionCode, bNumControls, bNrInPins, baSourceID, bControlSize, bmControls, iExtension) ⇒ ExtensionUnitDescriptor

Returns a new instance of ExtensionUnitDescriptor.



627
628
629
630
631
632
633
634
635
636
637
# File 'lib/uvc.rb', line 627

def initialize(bDescriptorType, bDescriptorSubType, bUnitID, guidExtensionCode, bNumControls, bNrInPins, baSourceID, bControlSize, bmControls, iExtension)
	super(bDescriptorType, bDescriptorSubType)
	@bUnitID = bUnitID
	@guidExtensionCode = guidExtensionCode
	@bNumControls = bNumControls
	@bNrInPins = bNrInPins
	@baSourceID = baSourceID
	@bControlSize = bControlSize
	@bmControls = bmControls
	@iExtension = iExtension
end

Instance Attribute Details

#baSourceIDObject (readonly)

Returns the value of attribute baSourceID.



611
612
613
# File 'lib/uvc.rb', line 611

def baSourceID
  @baSourceID
end

#bControlSizeObject (readonly)

Returns the value of attribute bControlSize.



612
613
614
# File 'lib/uvc.rb', line 612

def bControlSize
  @bControlSize
end

#bmControlsObject (readonly)

Returns the value of attribute bmControls.



613
614
615
# File 'lib/uvc.rb', line 613

def bmControls
  @bmControls
end

#bNrInPinsObject (readonly)

Returns the value of attribute bNrInPins.



610
611
612
# File 'lib/uvc.rb', line 610

def bNrInPins
  @bNrInPins
end

#bNumControlsObject (readonly)

Returns the value of attribute bNumControls.



609
610
611
# File 'lib/uvc.rb', line 609

def bNumControls
  @bNumControls
end

#bUnitIDObject (readonly)

Returns the value of attribute bUnitID.



607
608
609
# File 'lib/uvc.rb', line 607

def bUnitID
  @bUnitID
end

#guidExtensionCodeObject (readonly)

Returns the value of attribute guidExtensionCode.



608
609
610
# File 'lib/uvc.rb', line 608

def guidExtensionCode
  @guidExtensionCode
end

#iExtensionObject (readonly)

Returns the value of attribute iExtension.



614
615
616
# File 'lib/uvc.rb', line 614

def iExtension
  @iExtension
end

Class Method Details

.parse(bDescriptorType, bDescriptorSubType, rest) ⇒ Object



616
617
618
619
620
621
622
623
624
625
# File 'lib/uvc.rb', line 616

def self.parse(bDescriptorType, bDescriptorSubType, rest)
	bUnitID, guidExtensionCode, bNumControls, bNrInPins, rest = *rest.unpack("ca16cca*")
	*baSourceID, rest = *rest.unpack("c#{bNrInPins}a*")
	bControlSize, rest = *rest.unpack("ca*")
	bmControls, iExtension = *rest.unpack("B#{bControlSize*8}c")

	guidExtensionCode = guidExtensionCode.unpack("H8 H4 H4 H4 H12").join("-")

	self.new(bDescriptorType, bDescriptorSubType, bUnitID, guidExtensionCode, bNumControls, bNrInPins, baSourceID, bControlSize, bmControls, iExtension)
end

Instance Method Details

#short_inspectObject



639
640
641
642
643
644
645
# File 'lib/uvc.rb', line 639

def short_inspect
	"%s bUnitID=%d\n  %s" % [
		self.class.name.sub(/Descriptor$/, ''),
		self.bUnitID,
		self.guidExtensionCode
	]
end