# TUIO::TuioClient Class Reference

`#include <TuioClient.h>`

List of all members.

## Public Member Functions

| TuioClient (int port=3333)
| ~TuioClient ()
void | connect (bool lock=false)
void | disconnect ()
bool | isConnected ()
void | addTuioListener (TuioListener *listener)
void | removeTuioListener (TuioListener *listener)
void | removeAllTuioListeners ()
std::list< TuioObject * > | getTuioObjects ()
std::list< TuioCursor * > | getTuioCursors ()
TuioObject * | getTuioObject (long s_id)
TuioCursor * | getTuioCursor (long s_id)
void | lockObjectList ()
void | unlockObjectList ()
void | lockCursorList ()
void | unlockCursorList ()
void | ProcessPacket (const char *data, int size, const IpEndpointName &remoteEndpoint)

## Public Attributes

UdpListeningReceiveSocket * | socket

## Protected Member Functions

void | ProcessBundle (const ReceivedBundle &b, const IpEndpointName &remoteEndpoint)
void | ProcessMessage (const ReceivedMessage &message, const IpEndpointName &remoteEndpoint)

## Detailed Description

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();
`

Author:
  Martin Kaltenbrunner

Version:
  1.4

## Constructor & Destructor Documentation

TuioClient::TuioClient | ( | int | port = `3333` | ) |

This constructor creates a TuioClient that listens to the provided port

Parameters:

  | port | the incoming TUIO UDP port number, defaults to 3333 if no argument is provided

TuioClient::~TuioClient | ( |  | ) |

The destructor is doing nothing in particular.

## Member Function Documentation

void TuioClient::connect | ( | bool | lock = `false` | ) |

The TuioClient starts listening to TUIO messages on the configured UDP port All received TUIO messages are decoded and the resulting TUIO events are broadcasted to all registered TuioListeners

Parameters:

  | lock | running in the background if set to false (default)

void TuioClient::disconnect | ( |  | ) |

The TuioClient stops listening to TUIO messages on the configured UDP port

bool TUIO::TuioClient::isConnected | ( |  | ) | `[inline]`

Returns true if this TuioClient is currently connected.

Returns:
  true if this TuioClient is currently connected

void TuioClient::addTuioListener | ( | TuioListener * | listener | ) |

Adds the provided TuioListener to the list of registered TUIO event listeners

Parameters:

  | listener | the TuioListener to add

void TuioClient::removeTuioListener | ( | TuioListener * | listener | ) |

Removes the provided TuioListener from the list of registered TUIO event listeners

Parameters:

  | listener | the TuioListener to remove

void TUIO::TuioClient::removeAllTuioListeners | ( |  | ) | `[inline]`

Removes all TuioListener from the list of registered TUIO event listeners

std::list< TuioObject * > TuioClient::getTuioObjects | ( |  | ) |

Returns a List of all currently active TuioObjects

Returns:
  a List of all currently active TuioObjects

std::list< TuioCursor * > TuioClient::getTuioCursors | ( |  | ) |

Returns a List of all currently active TuioCursors

Returns:
  a List of all currently active TuioCursors

TuioObject * TuioClient::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 * TuioClient::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

void TuioClient::lockObjectList | ( |  | ) |

Locks the TuioObject list in order to avoid updates during access

void TuioClient::unlockObjectList | ( |  | ) |

Releases the lock of the TuioObject list

void TuioClient::lockCursorList | ( |  | ) |

Locks the TuioCursor list in order to avoid updates during access

void TuioClient::unlockCursorList | ( |  | ) |

Releases the lock of the TuioCursor list

void TuioClient::ProcessMessage | ( | const ReceivedMessage & | message,
|  | const IpEndpointName & | remoteEndpoint |
| ) |  |  | `[protected]`

The OSC callback method where all TUIO messages are received and decoded and where the TUIO event callbacks are dispatched

Parameters:

  | message | the received OSC message
  | remoteEndpoint | the received OSC message origin

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

- TuioClient.h
- TuioClient.cpp