Public Member Functions

TUIO::TuioServer Class Reference

#include <TuioServer.h>

List of all members.

Public Member Functions

 TuioServer ()
 TuioServer (const char *host, int port)
 TuioServer (const char *host, int port, int size)
 ~TuioServer ()
TuioObjectaddTuioObject (int sym, float xp, float yp, float a)
void updateTuioObject (TuioObject *tobj, float xp, float yp, float a)
void removeTuioObject (TuioObject *tobj)
void addExternalTuioObject (TuioObject *tobj)
void updateExternalTuioObject (TuioObject *tobj)
void removeExternalTuioObject (TuioObject *tobj)
TuioCursoraddTuioCursor (float xp, float yp)
void updateTuioCursor (TuioCursor *tcur, float xp, float yp)
void removeTuioCursor (TuioCursor *tcur)
void addExternalTuioCursor (TuioCursor *tcur)
void updateExternalTuioCursor (TuioCursor *tcur)
void removeExternalTuioCursor (TuioCursor *tcur)
void initFrame (TuioTime ttime)
void commitFrame ()
long getSessionID ()
long getFrameID ()
TuioTime getFrameTime ()
void sendFullMessages ()
void enablePeriodicMessages (int interval=1)
void disablePeriodicMessages ()
void enableFullUpdate ()
void disableFullUpdate ()
bool periodicMessagesEnabled ()
int getUpdateInterval ()
std::list< TuioObject * > getUntouchedObjects ()
std::list< TuioCursor * > getUntouchedCursors ()
void stopUntouchedMovingObjects ()
void stopUntouchedMovingCursors ()
void removeUntouchedStoppedObjects ()
void removeUntouchedStoppedCursors ()
std::list< TuioObject * > getTuioObjects ()
std::list< TuioCursor * > getTuioCursors ()
TuioObjectgetTuioObject (long s_id)
TuioCursorgetTuioCursor (long s_id)
TuioObjectgetClosestTuioObject (float xp, float yp)
TuioCursorgetClosestTuioCursor (float xp, float yp)
bool isConnected ()
void setVerbose (bool verbose)

Detailed Description

The TuioServer class is the central TUIO protocol encoder component. In order to encode and send TUIO messages an instance of TuioServer needs to be created. The TuioServer instance then generates TUIO messaged which are sent via OSC over UDP to the configured IP address and port.

During runtime the each frame is marked with the initFrame and commitFrame methods, while the currently present TuioObjects are managed by the server with ADD, UPDATE and REMOVE methods in analogy to the TuioClient's TuioListener interface.

TuioClient *server = new TuioServer();
...
server->initFrame(TuioTime::getSessionTime());
TuioObject *tobj = server->addTuioObject(xpos,ypos, angle);
TuioCursor *tcur = server->addTuioObject(xpos,ypos);
server->commitFrame();
...
server->initFrame(TuioTime::getSessionTime());
server->updateTuioObject(tobj, xpos,ypos, angle);
server->updateTuioCursor(tcur, xpos,ypos);
server->commitFrame();
...
server->initFrame(TuioTime::getSessionTime());
server->removeTuioObject(tobj);
server->removeTuioCursor(tcur);
server->commitFrame();

Author:
Martin Kaltenbrunner
Version:
1.4

Constructor & Destructor Documentation

TuioServer::TuioServer (  )

The default constructor creates a TuioServer that sends to the default TUIO port 3333 on localhost using the maximum packet size of 65536 bytes to use single packets on the loopback device

TuioServer::TuioServer ( const char *  host,
int  port 
)

This constructor creates a TuioServer that sends to the provided port on the the given host using a default packet size of 1492 bytes to deliver unfragmented UDP packets on a LAN

Parameters:
hostthe receiving host name
portthe outgoing TUIO UDP port number
TuioServer::TuioServer ( const char *  host,
int  port,
int  size 
)

This constructor creates a TuioServer that sends to the provided port on the the given host the packet UDP size can be set to a value between 576 and 65536 bytes

Parameters:
hostthe receiving host name
portthe outgoing TUIO UDP port number
sizethe maximum UDP packet size
TuioServer::~TuioServer (  )

The destructor is doing nothing in particular.


Member Function Documentation

void TuioServer::addExternalTuioCursor ( TuioCursor tcur )

Updates an externally managed TuioCursor

Parameters:
tcurthe TuioCursor to update
void TuioServer::addExternalTuioObject ( TuioObject tobj )

Adds an externally managed TuioObject to the TuioServer's internal list of active TuioObjects

Parameters:
tobjthe TuioObject to add
TuioCursor * TuioServer::addTuioCursor ( float  xp,
float  yp 
)

Creates a new TuioCursor based on the given arguments. The new TuioCursor is added to the TuioServer's internal list of active TuioCursors and a reference is returned to the caller.

Parameters:
xpthe X coordinate to assign
ypthe Y coordinate to assign
Returns:
reference to the created TuioCursor
TuioObject * TuioServer::addTuioObject ( int  sym,
float  xp,
float  yp,
float  a 
)

Creates a new TuioObject based on the given arguments. The new TuioObject is added to the TuioServer's internal list of active TuioObjects and a reference is returned to the caller.

Parameters:
symthe Symbol ID to assign
xpthe X coordinate to assign
ypthe Y coordinate to assign
athe angle to assign
Returns:
reference to the created TuioObject
void TuioServer::commitFrame (  )

Commits the current frame. Generates and sends TUIO messages of all currently active and updated TuioObjects and TuioCursors.

void TUIO::TuioServer::disableFullUpdate (  ) [inline]

Disables the full update of all currently active and inactive TuioObjects and TuioCursors

void TuioServer::disablePeriodicMessages (  )

Disables the periodic full update of all currently active and inactive TuioObjects and TuioCursors

void TUIO::TuioServer::enableFullUpdate (  ) [inline]

Enables the full update of all currently active and inactive TuioObjects and TuioCursors

void TuioServer::enablePeriodicMessages ( int  interval = 1 )

Disables the periodic full update of all currently active TuioObjects and TuioCursors

Parameters:
intervalupdate interval in seconds, defaults to one second
TuioCursor * TuioServer::getClosestTuioCursor ( float  xp,
float  yp 
)

Returns the TuioCursor closest to the provided coordinates or NULL if there isn't any active TuioCursor

Returns:
the closest TuioCursor corresponding to the provided coordinates or NULL
TuioObject * TuioServer::getClosestTuioObject ( float  xp,
float  yp 
)

Returns the TuioObject closest to the provided coordinates or NULL if there isn't any active TuioObject

Returns:
the closest TuioObject to the provided coordinates or NULL
long TuioServer::getFrameID (  )

Returns the current frame ID for external use.

Returns:
the current frame ID for external use
TuioTime TuioServer::getFrameTime (  )

Returns the current frame ID for external use.

Returns:
the current frame ID for external use
long TuioServer::getSessionID (  )

Returns the next available Session ID for external use.

Returns:
the next available Session ID for external use
TuioCursor * TuioServer::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
std::list< TuioCursor * > TuioServer::getTuioCursors (  )

Returns a List of all currently active TuioCursors

Returns:
a List of all currently active TuioCursors
TuioObject * TuioServer::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
std::list< TuioObject * > TuioServer::getTuioObjects (  )

Returns a List of all currently active TuioObjects

Returns:
a List of all currently active TuioObjects
std::list< TuioCursor * > TuioServer::getUntouchedCursors (  )

Returns a List of all currently inactive TuioCursors

Returns:
a List of all currently inactive TuioCursors
std::list< TuioObject * > TuioServer::getUntouchedObjects (  )

Returns a List of all currently inactive TuioObjects

Returns:
a List of all currently inactive TuioObjects
int TUIO::TuioServer::getUpdateInterval (  ) [inline]

Returns the periodic update interval in seconds.

Returns:
the periodic update interval in seconds
void TuioServer::initFrame ( TuioTime  ttime )

Initializes a new frame with the given TuioTime

Parameters:
ttimethe frame time
bool TUIO::TuioServer::isConnected (  ) [inline]

Returns true if this TuioServer is currently connected.

Returns:
true if this TuioServer is currently connected
bool TUIO::TuioServer::periodicMessagesEnabled (  ) [inline]

Returns true if the periodic full update of all currently active TuioObjects and TuioCursors is enabled.

Returns:
true if the periodic full update of all currently active TuioObjects and TuioCursors is enabled
void TuioServer::removeExternalTuioCursor ( TuioCursor tcur )

Removes an externally managed TuioCursor from the TuioServer's internal list of TuioCursor The referenced TuioCursor is not deleted

Parameters:
tcurthe TuioCursor to remove
void TuioServer::removeExternalTuioObject ( TuioObject tobj )

Removes an externally managed TuioObject from the TuioServer's internal list of TuioObjects The referenced TuioObject is not deleted

Parameters:
tobjthe TuioObject to remove
void TuioServer::removeTuioCursor ( TuioCursor tcur )

Removes the referenced TuioCursor from the TuioServer's internal list of TuioCursors and deletes the referenced TuioCursor afterwards

Parameters:
tcurthe TuioCursor to remove
void TuioServer::removeTuioObject ( TuioObject tobj )

Removes the referenced TuioObject from the TuioServer's internal list of TuioObjects and deletes the referenced TuioObject afterwards

Parameters:
tobjthe TuioObject to remove
void TuioServer::removeUntouchedStoppedCursors (  )

Removes all currently inactive TuioCursors from the TuioServer's internal list of TuioCursors

void TuioServer::removeUntouchedStoppedObjects (  )

Removes all currently inactive TuioObjects from the TuioServer's internal list of TuioObjects

void TuioServer::sendFullMessages (  )

Generates and sends TUIO messages of all currently active TuioObjects and TuioCursors.

void TUIO::TuioServer::setVerbose ( bool  verbose ) [inline]

The TuioServer prints verbose TUIO event messages to the console if set to true.

Parameters:
verboseverbose message output if set to true
void TuioServer::stopUntouchedMovingCursors (  )

Calculates speed and acceleration values for all currently inactive TuioCursors

void TuioServer::stopUntouchedMovingObjects (  )

Calculates speed and acceleration values for all currently inactive TuioObjects

void TuioServer::updateExternalTuioCursor ( TuioCursor tcur )

Updates an externally managed TuioCursor

Parameters:
tcurthe TuioCursor to update
void TuioServer::updateExternalTuioObject ( TuioObject tobj )

Updates an externally managed TuioObject

Parameters:
tobjthe TuioObject to update
void TuioServer::updateTuioCursor ( TuioCursor tcur,
float  xp,
float  yp 
)

Updates the referenced TuioCursor based on the given arguments.

Parameters:
tcurthe TuioObject to update
xpthe X coordinate to assign
ypthe Y coordinate to assign
void TuioServer::updateTuioObject ( TuioObject tobj,
float  xp,
float  yp,
float  a 
)

Updates the referenced TuioObject based on the given arguments.

Parameters:
tobjthe TuioObject to update
xpthe X coordinate to assign
ypthe Y coordinate to assign
athe angle to assign

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines