ioio.lib.api
Class IOIOFactory

java.lang.Object
  extended by ioio.lib.api.IOIOFactory

public class IOIOFactory
extends java.lang.Object

Factory class for creating instances of the IOIO interface.

This class acts as the single entry-point to the IOIO API. It creates the bootstrapping between a specific implementation of the IOIO interface and any dependencies it might have, such as the underlying connection logic.

Typical usage:

 IOIO ioio = IOIOFactory.create();
 try {
   ioio.waitForConnect();
   ...
   ioio.disconnect();
 } catch (ConnectionLostException e) {
 } finally {
   ioio.waitForDisconnect();
 }
 


Constructor Summary
IOIOFactory()
           
 
Method Summary
static IOIO create()
          Create a IOIO instance.
static IOIO create(IOIOConnection connection)
          Create a IOIO instance with a user-provided underlying connection class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOIOFactory

public IOIOFactory()
Method Detail

create

public static IOIO create()
Create a IOIO instance. This specific implementation creates a IOIO instance which works with the actual IOIO board connected via a TCP connection (typically over a wired USB connection).

Returns:
The IOIO instance.

create

public static IOIO create(IOIOConnection connection)
Create a IOIO instance with a user-provided underlying connection class. This method should be used for establishing a non-standard connection to the IOIO board.

Parameters:
connection - An instance of a IOIO connection.
Returns:
The IOIO instance.