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)
-
#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.
Constructor Details
#initialize(configuration, *args) ⇒ Interface
Returns a new instance of Interface.
25 26 27 28 |
# File 'lib/libusb/interface.rb', line 25 def initialize(configuration, *args) @configuration = configuration super(*args) end |
Instance Attribute Details
#configuration ⇒ Configuration (readonly)
Returns the configuration this interface belongs to.
31 32 33 |
# File 'lib/libusb/interface.rb', line 31 def configuration @configuration end |
Instance Method Details
#<=>(o) ⇒ Object
47 48 49 |
# File 'lib/libusb/interface.rb', line 47 def <=>(o) configuration<=>o.configuration end |
#alt_settings ⇒ Object Also known as: settings
33 34 35 36 37 38 39 |
# File 'lib/libusb/interface.rb', line 33 def alt_settings ifs = [] self[:num_altsetting].times do |i| ifs << Setting.new(self, self[:altsetting] + i*Setting.size) end return ifs end |
#device ⇒ Object
The Device this Interface belongs to.
43 |
# File 'lib/libusb/interface.rb', line 43 def device() self.configuration.device end |
#endpoints ⇒ Object
Return all endpoints of all alternative settings as Array of Endpoints.
45 |
# File 'lib/libusb/interface.rb', line 45 def endpoints() self.alt_settings.map {|d| d.endpoints }.flatten end |