TUIO is an open framework that defines a common protocol and API for tangible multitouch surfaces. The TUIO protocol allows the transmission of an abstract description of interactive surfaces, including touch events and tangible object states. This protocol encodes control data from a tracker application (e.g. based on computer vision) and sends it to any client application that is capable of decoding the protocol.
As the above said, we use TUIO for communication with client applications. For doing that, there is a TUIO class in CCV and 2 addons for openFrameworks:
- ofxOsc (by Damian Stewart, which wraps oscpack to allow you to communicate to and from an openframeworks application using the OSC protocol)
- ofxNetwrok (by Theo Watson and Ars Electronica Futurelab, which contains cross platform network code for UDP and TCP communication, as well as multicast.)
We can see them in the header file of TUIO class:
#include "ofxOsc.h" #include "ofxNetwork.h"
And the fields of them:
// TCP Network ofxTCPServer m_tcpServer; // OSC Network ofxOscSender TUIOSocket;
Okay, there are three methods of TUIO class:
- setup() (Set the host-address, OSC port and TCP port)
- setMode() (Set the modes (bool type): fingers, objects and fiducials)
- sendTUIO() (Send out the messages)
In the sendTUIO() method, the messages will be sent by three modes:
- OSC Mode (In this mode, it can sends messages about fingers/objects/fiducials. And it uses the
TUIOSocket.sendBundle()method for sending them.)
- TCP Mode (In this mode, it can sends messages about fingers/objects/fiducials too! And it uses the
m_tcpServer.sendToAll()method for sending them by using XML string.)
- Binary Mode (But in this mode, it can just sends messages about fingers, objects and fiducials are not implemented. And it uses the
m_tcpServer.sendRawBytesToAll()method for sending fingers messages.)
That’s all about TUIO.