Class: LIBUSB::Interface
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- LIBUSB::Interface
- Includes:
- Comparable
- Defined in:
- lib/libusb/interface.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Configuration
readonly
The configuration this interface belongs to.
Instance Method Summary collapse
- #<=>(o) ⇒ Object
- #alt_settings ⇒ Object (also: #settings)
-
#bInterfaceNumber ⇒ Object
Number of this interface.
-
#device ⇒ Object
The Device this Interface belongs to.
-
#endpoints ⇒ Object
Return all endpoints of all alternative settings as Array of Endpoints.
-
#initialize(configuration, *args) ⇒ Interface
constructor
A new instance of Interface.
- #inspect ⇒ Object
Constructor Details
#initialize(configuration, *args) ⇒ Interface
Returns a new instance of Interface.
30 31 32 33 |
# File 'lib/libusb/interface.rb', line 30 def initialize(configuration, *args) @configuration = configuration super(*args) end |
Instance Attribute Details
#configuration ⇒ Configuration (readonly)
Returns the configuration this interface belongs to.
36 37 38 |
# File 'lib/libusb/interface.rb', line 36 def configuration @configuration end |
Instance Method Details
#<=>(o) ⇒ Object
56 57 58 |
# File 'lib/libusb/interface.rb', line 56 def <=>(o) configuration<=>o.configuration end |
#alt_settings ⇒ Object Also known as: settings
38 39 40 41 42 43 44 |
# File 'lib/libusb/interface.rb', line 38 def alt_settings ifs = [] self[:num_altsetting].times do |i| ifs << Setting.new(self, self[:altsetting] + i*Setting.size) end return ifs end |
#bInterfaceNumber ⇒ Object
Number of this interface.
26 27 28 |
# File 'lib/libusb/interface.rb', line 26 def bInterfaceNumber settings.first.bInterfaceNumber end |
#device ⇒ Object
The Device this Interface belongs to.
52 |
# File 'lib/libusb/interface.rb', line 52 def device() self.configuration.device end |
#endpoints ⇒ Object
Return all endpoints of all alternative settings as Array of Endpoints.
54 |
# File 'lib/libusb/interface.rb', line 54 def endpoints() self.alt_settings.map {|d| d.endpoints }.flatten end |
#inspect ⇒ Object
47 48 49 |
# File 'lib/libusb/interface.rb', line 47 def inspect "\#<#{self.class} #{bInterfaceNumber}>" end |