ioio.lib.util
Class AbstractIOIOActivity
java.lang.Object
Activity
ioio.lib.util.AbstractIOIOActivity
public abstract class AbstractIOIOActivity
- extends Activity
A convenience class for easy creation of IOIO-based applications.
It is used by creating a concrete Activity in your application, which extends
this class. This class then takes care of proper creation and abortion of the
IOIO connection and of a dedicated thread for IOIO communication.
In the basic usage the client should extend this class and implement
createIOIOThread()
, which should return an implementation of the
IOIOThread
abstract class. In this implementation, the client
implements the IOIOThread#setup()
method, which gets called as soon
as communication with the IOIO is established, and the #loop()
method, which gets called repetitively as long as the IOIO is
connected. Both methods should access the IOIOThread#ioio_
field for
controlling the IOIO.
In addition, the IOIOThread#disconnected()
method may be overridden
in order to execute logic as soon as a disconnection occurs for whichever
reason. The IOIOThread#incompatible()
method may be overridden in
order to take action in case where a IOIO whose firmware is incompatible with
the IOIOLib version that application is built with.
In a more advanced use case, more than one IOIO is available. In this case, a
thread will be created for each IOIO, whose semantics are as defined above.
If the client needs to be able to distinguish between them, it is possible to
override createIOIOThread(String, Object[])
instead of
createIOIOThread()
. The first argument provided will contain the
connection class name, such as ioio.lib.impl.SocketIOIOConnection for a
connection established over a TCP socket (which is used over ADB). The second
argument will contain information specific to the connection type. For
example, in the case of SocketIOIOConnection, the array will contain an
Integer
representing the local port number.
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractIOIOActivity
public AbstractIOIOActivity()