Class: Phidgets::InterfaceKit::InterfaceKitInputs
- Inherits:
- 
      Object
      
        - Object
- Phidgets::InterfaceKit::InterfaceKitInputs
 
- Defined in:
- lib/phidgets-ffi/interface_kit.rb
Overview
This class represents an digital input for a PhidgetInterfaceKit. All the properties of an digital input are stored in this class.
Constant Summary collapse
- Klass =
- Phidgets::FFI::CPhidgetInterfaceKit 
Instance Method Summary collapse
- 
  
    
      #index  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    Returns index of the digital input, or raises an error. 
- 
  
    
      #inspect  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Displays data for the digital input. 
- 
  
    
      #off  ⇒ Boolean 
    
    
      (also: #off?)
    
  
  
  
  
  
  
  
  
  
    Returns true if the state is off. 
- 
  
    
      #on  ⇒ Boolean 
    
    
      (also: #on?)
    
  
  
  
  
  
  
  
  
  
    Returns true if the state is true. 
- 
  
    
      #state  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns state of the digital input, or raises an error. 
Instance Method Details
#index ⇒ Integer
Returns index of the digital input, or raises an error.
| 124 125 126 | # File 'lib/phidgets-ffi/interface_kit.rb', line 124 def index @index end | 
#inspect ⇒ Object
Displays data for the digital input
| 119 120 121 | # File 'lib/phidgets-ffi/interface_kit.rb', line 119 def inspect "#<#{self.class} @index=#{index}, @state=#{state}>" end | 
#off ⇒ Boolean Also known as: off?
Returns true if the state is off.
| 142 143 144 | # File 'lib/phidgets-ffi/interface_kit.rb', line 142 def off !on end | 
#on ⇒ Boolean Also known as: on?
Returns true if the state is true.
| 136 137 138 | # File 'lib/phidgets-ffi/interface_kit.rb', line 136 def on state == true end | 
#state ⇒ Boolean
Returns state of the digital input, or raises an error.
| 129 130 131 132 133 | # File 'lib/phidgets-ffi/interface_kit.rb', line 129 def state ptr = ::FFI::MemoryPointer.new(:int) Klass.getInputState(@handle, @index, ptr) (ptr.get_int(0) == 0) ? false : true end |