Class: UVC::ClassSpecificVCInterfaceDescriptor
- Inherits:
-
Object
- Object
- UVC::ClassSpecificVCInterfaceDescriptor
- Defined in:
- lib/uvc.rb
Direct Known Subclasses
EncodingUnitDescriptor, ExtensionUnitDescriptor, InputTerminalDescriptor, OutputTerminalDescriptor, ProcessingUnitDescriptor, SelectorUnitDescriptor, VCInterfaceHeaderDescriptor
Instance Attribute Summary collapse
-
#bDescriptorSubType ⇒ Object
readonly
Returns the value of attribute bDescriptorSubType.
-
#bDescriptorType ⇒ Object
readonly
Returns the value of attribute bDescriptorType.
-
#rest ⇒ Object
readonly
Returns the value of attribute rest.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(bDescriptorType, bDescriptorSubType, rest = nil) ⇒ ClassSpecificVCInterfaceDescriptor
constructor
A new instance of ClassSpecificVCInterfaceDescriptor.
- #short_inspect ⇒ Object
Constructor Details
#initialize(bDescriptorType, bDescriptorSubType, rest = nil) ⇒ ClassSpecificVCInterfaceDescriptor
Returns a new instance of ClassSpecificVCInterfaceDescriptor.
265 266 267 268 269 |
# File 'lib/uvc.rb', line 265 def initialize(bDescriptorType, bDescriptorSubType, rest=nil) @bDescriptorType = bDescriptorType @bDescriptorSubType = bDescriptorSubType @rest = nil end |
Instance Attribute Details
#bDescriptorSubType ⇒ Object (readonly)
Returns the value of attribute bDescriptorSubType.
229 230 231 |
# File 'lib/uvc.rb', line 229 def bDescriptorSubType @bDescriptorSubType end |
#bDescriptorType ⇒ Object (readonly)
Returns the value of attribute bDescriptorType.
228 229 230 |
# File 'lib/uvc.rb', line 228 def bDescriptorType @bDescriptorType end |
#rest ⇒ Object (readonly)
Returns the value of attribute rest.
230 231 232 |
# File 'lib/uvc.rb', line 230 def rest @rest end |
Class Method Details
.parse(bytes) ⇒ Object
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/uvc.rb', line 243 def self.parse(bytes) bDescriptorType, bDescriptorSubType, rest = *bytes.unpack("cca*") case [bDescriptorType, bDescriptorSubType] when [CS_INTERFACE, VC_HEADER] VCInterfaceHeaderDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) when [CS_INTERFACE, VC_INPUT_TERMINAL] InputTerminalDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) when [CS_INTERFACE, VC_OUTPUT_TERMINAL] OutputTerminalDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) when [CS_INTERFACE, VC_SELECTOR_UNIT] SelectorUnitDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) when [CS_INTERFACE, VC_PROCESSING_UNIT] ProcessingUnitDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) when [CS_INTERFACE, VC_ENCODING_UNIT] EncodingUnitDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) when [CS_INTERFACE, VC_EXTENSION_UNIT] ExtensionUnitDescriptor.parse(bDescriptorType, bDescriptorSubType, rest) else self.new(bDescriptorType, bDescriptorSubType, rest) end end |
.parse_array(extra) ⇒ Object
232 233 234 235 236 237 238 239 240 241 |
# File 'lib/uvc.rb', line 232 def self.parse_array(extra) extra = StringIO.new(extra, 'r') descs = [] until extra.eof? len = extra.read(1).ord desc = ClassSpecificVCInterfaceDescriptor.parse(extra.read(len-1)) descs << desc end descs end |
Instance Method Details
#short_inspect ⇒ Object
271 272 273 274 275 |
# File 'lib/uvc.rb', line 271 def short_inspect "%s" % [ self.class.name.sub(/Descriptor$/, ''), ] end |