TUIO
Class TuioClient

java.lang.Object
  extended by TUIO.TuioClient
All Implemented Interfaces:
com.illposed.osc.OSCListener

public class TuioClient
extends java.lang.Object
implements com.illposed.osc.OSCListener

The TuioClient class is the central TUIO protocol decoder component. It provides a simple callback infrastructure using the TuioListener interface. In order to receive and decode TUIO messages an instance of TuioClient needs to be created. The TuioClient instance then generates TUIO events which are broadcasted to all registered classes that implement the TuioListener interface.

TuioClient client = new TuioClient();
client.addTuioListener(myTuioListener);
client.connect();


Constructor Summary
TuioClient()
          The default constructor creates a client that listens to the default TUIO port 3333
TuioClient(int port)
          This constructor creates a client that listens to the provided port
 
Method Summary
 void acceptMessage(java.util.Date date, com.illposed.osc.OSCMessage message)
          The OSC callback method where all TUIO messages are received and decoded and where the TUIO event callbacks are dispatched
 void addTuioListener(TuioListener listener)
          Adds the provided TuioListener to the list of registered TUIO event listeners
 void connect()
          The TuioClient starts listening to TUIO messages on the configured UDP port All reveived TUIO messages are decoded and the resulting TUIO events are broadcasted to all registered TuioListeners
 void disconnect()
          The TuioClient stops listening to TUIO messages on the configured UDP port
 TuioCursor getTuioCursor(long s_id)
          Returns the TuioCursor corresponding to the provided Session ID or NULL if the Session ID does not refer to an active TuioCursor
 java.util.Vector<TuioCursor> getTuioCursors()
          Returns a Vector of all currently active TuioCursors
 TuioObject getTuioObject(long s_id)
          Returns the TuioObject corresponding to the provided Session ID or NULL if the Session ID does not refer to an active TuioObject
 java.util.Vector<TuioObject> getTuioObjects()
          Returns a Vector of all currently active TuioObjects
 boolean isConnected()
          Returns true if this TuioClient is currently connected.
 void removeAllTuioListeners()
          Removes all TuioListener from the list of registered TUIO event listeners
 void removeTuioListener(TuioListener listener)
          Removes the provided TuioListener from the list of registered TUIO event listeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TuioClient

public TuioClient()
The default constructor creates a client that listens to the default TUIO port 3333


TuioClient

public TuioClient(int port)
This constructor creates a client that listens to the provided port

Parameters:
port - the listening port number
Method Detail

connect

public void connect()
The TuioClient starts listening to TUIO messages on the configured UDP port All reveived TUIO messages are decoded and the resulting TUIO events are broadcasted to all registered TuioListeners


disconnect

public void disconnect()
The TuioClient stops listening to TUIO messages on the configured UDP port


isConnected

public boolean isConnected()
Returns true if this TuioClient is currently connected.

Returns:
true if this TuioClient is currently connected

addTuioListener

public void addTuioListener(TuioListener listener)
Adds the provided TuioListener to the list of registered TUIO event listeners

Parameters:
listener - the TuioListener to add

removeTuioListener

public void removeTuioListener(TuioListener listener)
Removes the provided TuioListener from the list of registered TUIO event listeners

Parameters:
listener - the TuioListener to remove

removeAllTuioListeners

public void removeAllTuioListeners()
Removes all TuioListener from the list of registered TUIO event listeners


getTuioObjects

public java.util.Vector<TuioObject> getTuioObjects()
Returns a Vector of all currently active TuioObjects

Returns:
a Vector of all currently active TuioObjects

getTuioCursors

public java.util.Vector<TuioCursor> getTuioCursors()
Returns a Vector of all currently active TuioCursors

Returns:
a Vector of all currently active TuioCursors

getTuioObject

public TuioObject getTuioObject(long s_id)
Returns the TuioObject corresponding to the provided Session ID or NULL if the Session ID does not refer to an active TuioObject

Returns:
an active TuioObject corresponding to the provided Session ID or NULL

getTuioCursor

public TuioCursor getTuioCursor(long s_id)
Returns the TuioCursor corresponding to the provided Session ID or NULL if the Session ID does not refer to an active TuioCursor

Returns:
an active TuioCursor corresponding to the provided Session ID or NULL

acceptMessage

public void acceptMessage(java.util.Date date,
                          com.illposed.osc.OSCMessage message)
The OSC callback method where all TUIO messages are received and decoded and where the TUIO event callbacks are dispatched

Specified by:
acceptMessage in interface com.illposed.osc.OSCListener
Parameters:
date - the time stamp of the OSC bundle
message - the received OSC message