TUIO::TuioServer Class Reference

#include <TuioServer.h>

List of all members.

Public Member Functions

 TuioServer ()
 TuioServer (char *host, int port)
 TuioServer (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 ()
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)
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 ( 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:
host the receiving host name
port the outgoing TUIO UDP port number

TuioServer::TuioServer ( 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:
host the receiving host name
port the outgoing TUIO UDP port number
size the maximum UDP packet size

TuioServer::~TuioServer (  ) 

The destructor is doing nothing in particular.


Member Function Documentation

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:
sym the Symbol ID to assign
xp the X coordinate to assign
yp the Y coordinate to assign
a the angle to assign
Returns:
reference to the created TuioObject

void TuioServer::updateTuioObject ( TuioObject tobj,
float  xp,
float  yp,
float  a 
)

Updates the referenced TuioObject based on the given arguments.

Parameters:
tobj the TuioObject to update
xp the X coordinate to assign
yp the Y coordinate to assign
a the angle to assign

void TuioServer::removeTuioObject ( TuioObject tobj  ) 

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

Parameters:
tobj the TuioObject to remove

void TuioServer::addExternalTuioObject ( TuioObject tobj  ) 

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

Parameters:
tobj the TuioObject to add

void TuioServer::updateExternalTuioObject ( TuioObject tobj  ) 

Updates an externally managed TuioObject

Parameters:
tobj the TuioObject to update

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:
tobj the TuioObject to remove

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:
xp the X coordinate to assign
yp the Y coordinate to assign
Returns:
reference to the created TuioCursor

void TuioServer::updateTuioCursor ( TuioCursor tcur,
float  xp,
float  yp 
)

Updates the referenced TuioCursor based on the given arguments.

Parameters:
tcur the TuioObject to update
xp the X coordinate to assign
yp the Y coordinate to assign

void TuioServer::removeTuioCursor ( TuioCursor tcur  ) 

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

Parameters:
tcur the TuioCursor to remove

void TuioServer::addExternalTuioCursor ( TuioCursor tcur  ) 

Updates an externally managed TuioCursor

Parameters:
tcur the TuioCursor to update

void TuioServer::updateExternalTuioCursor ( TuioCursor tcur  ) 

Updates an externally managed TuioCursor

Parameters:
tcur the TuioCursor to update

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:
tcur the TuioCursor to remove

void TuioServer::initFrame ( TuioTime  ttime  ) 

Initializes a new frame with the given TuioTime

Parameters:
ttime the frame time

void TuioServer::commitFrame (  ) 

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

long TuioServer::getSessionID (  ) 

Returns the next available Session ID for external use.

Returns:
the next available Session ID for external use

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

void TuioServer::sendFullMessages (  ) 

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

void TuioServer::enablePeriodicMessages ( int  interval = 1  ) 

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

Parameters:
interval update interval in seconds, defaults to one second

void TuioServer::disablePeriodicMessages (  ) 

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

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

int TUIO::TuioServer::getUpdateInterval (  )  [inline]

Returns the periodic update interval in seconds.

Returns:
the periodic update interval in seconds

std::list< TuioObject * > TuioServer::getUntouchedObjects (  ) 

Returns a List of all currently inactive TuioObjects

Returns:
a List of all currently inactive TuioObjects

std::list< TuioCursor * > TuioServer::getUntouchedCursors (  ) 

Returns a List of all currently inactive TuioCursors

Returns:
a List of all currently inactive TuioCursors

void TuioServer::stopUntouchedMovingObjects (  ) 

Calculates speed and acceleration values for all currently inactive TuioObjects

void TuioServer::stopUntouchedMovingCursors (  ) 

Calculates speed and acceleration values for all currently inactive TuioCursors

void TuioServer::removeUntouchedStoppedObjects (  ) 

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

void TuioServer::removeUntouchedStoppedCursors (  ) 

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

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::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

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

bool TUIO::TuioServer::isConnected (  )  [inline]

Returns true if this TuioServer is currently connected.

Returns:
true if this TuioServer is currently connected

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

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

Parameters:
verbose verbose message output if set to true


The documentation for this class was generated from the following files:

Generated on Thu Mar 12 00:21:51 2009 for TUIO C++ Developer API by  doxygen 1.5.6