ioio.lib.impl
Class DigitalInputImpl

java.lang.Object
  extended by ioio.lib.impl.AbstractResource
      extended by ioio.lib.impl.AbstractPin
          extended by ioio.lib.impl.DigitalInputImpl
All Implemented Interfaces:
Closeable, DigitalInput

public class DigitalInputImpl
extends AbstractPin
implements DigitalInput


Nested Class Summary
 
Nested classes/interfaces inherited from interface ioio.lib.api.DigitalInput
DigitalInput.Spec
 
Method Summary
 void close()
           
 void disconnected()
           
 boolean read()
          Read the value sensed on the pin.
 void setValue(int value)
           
 void waitForValue(boolean value)
          Block until a desired logical level is sensed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setValue

public void setValue(int value)

waitForValue

public void waitForValue(boolean value)
                  throws java.lang.InterruptedException,
                         ConnectionLostException
Description copied from interface: DigitalInput
Block until a desired logical level is sensed. The calling thread can be interrupted for aborting this operation.

Specified by:
waitForValue in interface DigitalInput
Parameters:
value - The desired logical level. true for "HIGH", false for "LOW".
Throws:
java.lang.InterruptedException - The calling thread has been interrupted.
ConnectionLostException - The connection with the IOIO has been lost.

close

public void close()
Specified by:
close in interface Closeable
Overrides:
close in class AbstractPin

read

public boolean read()
             throws java.lang.InterruptedException,
                    ConnectionLostException
Description copied from interface: DigitalInput
Read the value sensed on the pin. May block for a few milliseconds if called right after creation of the instance. If this is a problem, the calling thread may be interrupted.

Specified by:
read in interface DigitalInput
Returns:
True for logical "HIGH", false for logical "LOW".
Throws:
java.lang.InterruptedException - The calling thread has been interrupted.
ConnectionLostException - The connection with the IOIO has been lost.

disconnected

public void disconnected()
Overrides:
disconnected in class AbstractResource