ioio.lib.util
Class BaseIOIOLooper

java.lang.Object
  extended by ioio.lib.util.BaseIOIOLooper
All Implemented Interfaces:
IOIOLooper

public class BaseIOIOLooper
extends java.lang.Object
implements IOIOLooper

A convenience implementation of IOIOLooper. This base class provides no-op implementations for all methods and provides the ioio_ field for subclasses.


Constructor Summary
BaseIOIOLooper()
           
 
Method Summary
 void disconnected()
          Subclasses should override this method for performing operations to be done once as soon as IOIO communication is lost or closed.
 void incompatible()
          Subclasses should override this method for performing operations to be done if an incompatible IOIO firmware is detected.
 void loop()
          Subclasses should override this method for performing operations to be done repetitively as long as IOIO communication persists.
 void setup(IOIO ioio)
          Subclasses should override this method for performing operations to be done once as soon as IOIO communication is established.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseIOIOLooper

public BaseIOIOLooper()
Method Detail

setup

public final void setup(IOIO ioio)
                 throws ConnectionLostException,
                        java.lang.InterruptedException
Description copied from interface: IOIOLooper
Subclasses should override this method for performing operations to be done once as soon as IOIO communication is established.

Specified by:
setup in interface IOIOLooper
Throws:
ConnectionLostException
java.lang.InterruptedException

loop

public void loop()
          throws ConnectionLostException,
                 java.lang.InterruptedException
Description copied from interface: IOIOLooper
Subclasses should override this method for performing operations to be done repetitively as long as IOIO communication persists. Typically, this will be the main logic of the application, processing inputs and producing outputs.

Specified by:
loop in interface IOIOLooper
Throws:
ConnectionLostException
java.lang.InterruptedException

disconnected

public void disconnected()
Description copied from interface: IOIOLooper
Subclasses should override this method for performing operations to be done once as soon as IOIO communication is lost or closed. Typically, this will include GUI changes corresponding to the change. This method will only be called if setup() has been called. The ioio argument passed to IOIOLooper.setup(IOIO) must not be used from within this method - it is invalid. This method should not block for long, since it may cause an ANR.

Specified by:
disconnected in interface IOIOLooper

incompatible

public void incompatible()
Description copied from interface: IOIOLooper
Subclasses should override this method for performing operations to be done if an incompatible IOIO firmware is detected. The ioio argument passed to IOIOLooper.setup(IOIO) must not be used from within this method - it is invalid. This method will only be called once, until a compatible IOIO is connected (i.e. IOIOLooper.setup(IOIO) gets called).

Specified by:
incompatible in interface IOIOLooper