Class: LIBUSB::Bos::PlatformDescriptor

Inherits:
FFI::Struct
  • Object
show all
Includes:
GenericMethods
Defined in:
lib/libusb/bos.rb

Overview

A structure representing a Platform descriptor. This descriptor is documented in section 9.6.2.4 of the USB 3.2 specification.

Instance Method Summary collapse

Methods included from GenericMethods

#bDescriptorType, #bDevCapabilityType, #bLength, #dev_capability_data

Constructor Details

#initialize(ctx, *args) ⇒ PlatformDescriptor

Returns a new instance of PlatformDescriptor.



246
247
248
249
250
# File 'lib/libusb/bos.rb', line 246

def initialize(ctx, *args)
  super(*args)

  register_context(ctx, :libusb_free_platform_descriptor)
end

Instance Method Details

#bReservedObject

Reserved field



253
254
255
# File 'lib/libusb/bos.rb', line 253

def bReserved
  self[:bReserved]
end

#capabilityDataString

This is a variable-length field containing data associated with the platform specific capability. This field may be zero bytes in length.

Returns:

  • (String)


265
266
267
# File 'lib/libusb/bos.rb', line 265

def capabilityData
  self[:CapabilityData].to_ptr.read_bytes(bLength - 20)
end

#inspectObject



269
270
271
# File 'lib/libusb/bos.rb', line 269

def inspect
  "\#<#{self.class} #{platformCapabilityUUID.unpack1("H*")} (#{capabilityData.unpack1("H*")})>"
end

#platformCapabilityUUIDString

Returns 128 bit UUID.

Returns:

  • (String)

    128 bit UUID



258
259
260
# File 'lib/libusb/bos.rb', line 258

def platformCapabilityUUID
  self[:PlatformCapabilityUUID].to_ptr.read_bytes(16)
end