TUIO C++ Developer API
TUIO::TuioServer Class Reference

#include <TuioServer.h>

Inheritance diagram for TUIO::TuioServer:
TUIO::TuioManager TUIO::TuioDispatcher

Public Member Functions

 TuioServer ()
 
 TuioServer (const char *host, int port)
 
 TuioServer (OscSender *sender)
 
 ~TuioServer ()
 
void sendFullMessages ()
 
void enableFullUpdate ()
 
void disableFullUpdate ()
 
bool fullUpdateEnabled ()
 
void enablePeriodicMessages (int interval=1)
 
void disablePeriodicMessages ()
 
bool periodicMessagesEnabled ()
 
int getUpdateInterval ()
 
void commitFrame ()
 
void setSourceName (const char *name)
 
void setSourceName (const char *name, const char *ip)
 
void addOscSender (OscSender *sender)
 
void enableObjectProfile (bool flag)
 
void enableCursorProfile (bool flag)
 
void enableBlobProfile (bool flag)
 
- Public Member Functions inherited from TUIO::TuioManager
 TuioManager ()
 
 ~TuioManager ()
 
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)
 
TuioBlobaddTuioBlob (float xp, float yp, float angle, float width, float height, float area)
 
void updateTuioBlob (TuioBlob *tblb, float xp, float yp, float angle, float width, float height, float area)
 
void removeTuioBlob (TuioBlob *tblb)
 
void addExternalTuioBlob (TuioBlob *tblb)
 
void updateExternalTuioBlob (TuioBlob *tblb)
 
void removeExternalTuioBlob (TuioBlob *tblb)
 
void initFrame (TuioTime ttime)
 
void commitFrame ()
 
long getSessionID ()
 
long getFrameID ()
 
TuioTime getFrameTime ()
 
std::list< TuioObject * > getUntouchedObjects ()
 
std::list< TuioCursor * > getUntouchedCursors ()
 
std::list< TuioBlob * > getUntouchedBlobs ()
 
void stopUntouchedMovingObjects ()
 
void stopUntouchedMovingCursors ()
 
void stopUntouchedMovingBlobs ()
 
void removeUntouchedStoppedObjects ()
 
void removeUntouchedStoppedCursors ()
 
void removeUntouchedStoppedBlobs ()
 
TuioObjectgetClosestTuioObject (float xp, float yp)
 
TuioCursorgetClosestTuioCursor (float xp, float yp)
 
TuioBlobgetClosestTuioBlob (float xp, float yp)
 
void setVerbose (bool verbose)
 
bool isVerbose ()
 
void setInversion (bool ix, bool iy, bool ia)
 
void setInvertXpos (bool ix)
 
void setInvertYpos (bool iy)
 
void setInvertAngle (bool ia)
 
bool getInvertXpos ()
 
bool getInvertYpos ()
 
bool getInvertAngle ()
 
void resetTuioObjects ()
 
void resetTuioCursors ()
 
void resetTuioBlobs ()
 
- Public Member Functions inherited from TUIO::TuioDispatcher
 TuioDispatcher ()
 
 ~TuioDispatcher ()
 
void addTuioListener (TuioListener *listener)
 
void removeTuioListener (TuioListener *listener)
 
void removeAllTuioListeners ()
 
std::list< TuioObject * > getTuioObjects ()
 
std::list< TuioObjectcopyTuioObjects ()
 
std::list< TuioCursor * > getTuioCursors ()
 
std::list< TuioCursorcopyTuioCursors ()
 
std::list< TuioBlob * > getTuioBlobs ()
 
std::list< TuioBlobcopyTuioBlobs ()
 
TuioObjectgetTuioObject (long s_id)
 
TuioCursorgetTuioCursor (long s_id)
 
TuioBlobgetTuioBlob (long s_id)
 
void lockObjectList ()
 
void unlockObjectList ()
 
void lockCursorList ()
 
void unlockCursorList ()
 
void lockBlobList ()
 
void unlockBlobList ()
 

Additional Inherited Members

- Protected Attributes inherited from TUIO::TuioManager
std::list< TuioCursor * > freeCursorList
 
std::list< TuioCursor * > freeCursorBuffer
 
std::list< TuioBlob * > freeBlobList
 
std::list< TuioBlob * > freeBlobBuffer
 
TuioTime currentFrameTime
 
long currentFrame
 
int maxCursorID
 
int maxBlobID
 
long sessionID
 
bool updateObject
 
bool updateCursor
 
bool updateBlob
 
bool verbose
 
bool invert_x
 
bool invert_y
 
bool invert_a
 
- Protected Attributes inherited from TUIO::TuioDispatcher
std::list< TuioListener * > listenerList
 
std::list< TuioObject * > objectList
 
std::list< TuioCursor * > cursorList
 
std::list< TuioBlob * > blobList
 
pthread_mutex_t objectMutex
 
pthread_mutex_t cursorMutex
 
pthread_mutex_t blobMutex
 

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 messages which are deliverered by the provided OSCSender. The shown UDPSender send OSC to UDP port 3333 on localhost or to the configured host 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.

See the SimpleSimulator example project for further hints on how to use the TuioServer class and its various methods.

OscSender *sender = new UDPSender(); TuioServer *server = new TuioServer(sender);
server->setSourceName("MyTuioSource"); // optional for TUIO 1.1
...
server->initFrame(TuioTime::getSessionTime());
TuioObject *tobj = server->addTuioObject(xpos,ypos,angle);
TuioCursor *tcur = server->addTuiCursor(xpos,ypos);
TuioBlob *tblb = server->addTuioBlob(xpos,ypos,angle,width,height, area);
server->commitFrame();
...
server->initFrame(TuioTime::getSessionTime());
server->updateTuioObject(tobj,xpos,ypos,angle);
server->updateTuioCursor(tcur,xpos,ypos);
server->updateTuioBlob(tblb,xpos,ypos,angle,width,height,area);
server->commitFrame();
...
server->initFrame(TuioTime::getSessionTime());
server->removeTuioObject(tobj);
server->removeTuioCursor(tcur);
server->removeTuioBlob(tblb);
server->commitFrame();

Author
Martin Kaltenbrunner
Version
1.1.6

Constructor & Destructor Documentation

◆ TuioServer() [1/3]

TuioServer::TuioServer ( )

This constructor creates a TuioServer that uses an internal UdpSender delivering the OSC data via UDP port 3333 on localhost

◆ TuioServer() [2/3]

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

This constructor creates a TuioServer that uses an internal UdpSender delivering the OSC data via the provided UDP port on the provided host

Parameters
hostthe host name for UDP deleivery
portthe UDP port number on the provided host

◆ TuioServer() [3/3]

TuioServer::TuioServer ( OscSender sender)

This constructor creates a TuioServer that sends OSC data using the provided OscSender

Parameters
senderthe OscSender used for OSC data delivery

◆ ~TuioServer()

TuioServer::~TuioServer ( )

The destructor is doing nothing in particular.

Member Function Documentation

◆ commitFrame()

void TuioServer::commitFrame ( )

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

◆ disableFullUpdate()

void TUIO::TuioServer::disableFullUpdate ( )
inline

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

◆ disablePeriodicMessages()

void TUIO::TuioServer::disablePeriodicMessages ( )
inline

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

◆ enableFullUpdate()

void TUIO::TuioServer::enableFullUpdate ( )
inline

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

◆ enablePeriodicMessages()

void TUIO::TuioServer::enablePeriodicMessages ( int  interval = 1)
inline

Enables the periodic full update of all currently active TuioObjects TuioObjects, TuioCursors and TuioBlobs

Parameters
intervalupdate interval in seconds, defaults to one second

◆ fullUpdateEnabled()

bool TUIO::TuioServer::fullUpdateEnabled ( )
inline

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

Returns
true if the full update of all currently active TuioObjects, TuioCursors and TuioBlobs is enabled

◆ getUpdateInterval()

int TUIO::TuioServer::getUpdateInterval ( )
inline

Returns the periodic update interval in seconds.

Returns
the periodic update interval in seconds

◆ periodicMessagesEnabled()

bool TUIO::TuioServer::periodicMessagesEnabled ( )
inline

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

Returns
true if the periodic update of all currently active TuioObjects, TuioCursors and TuioBlobs is enabled

◆ sendFullMessages()

void TuioServer::sendFullMessages ( )

Generates and sends TUIO messages of all currently active TuioObjects, TuioCursors and TuioBlobs

◆ setSourceName() [1/2]

void TuioServer::setSourceName ( const char *  name)

Commits the current frame. Generates and sends TUIO messages of all currently active and updated TuioObjects, TuioCursors and TuioBlobs. Defines the name of this TUIO source, which is transmitted within the /tuio/[profile] source message.

Parameters
namethe desired name of this TUIO source

◆ setSourceName() [2/2]

void TuioServer::setSourceName ( const char *  name,
const char *  ip 
)

Defines the name and IP address of this TUIO source, which is transmitted within the /tuio/[profile] source message.

Parameters
namethe desired name of this TUIO source
ipthe local IP address

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