tuioxide
A Rust implementation of the TUIO protocol by Martin Kaltenbrunner, supporting both TUIO 1.1 and TUIO 2.0. Built on top of rosc for OSC packet encoding and decoding.
TUIO is an open framework that defines a common protocol and API for tangible multitouch surfaces. It allows applications to receive touch, tangible object, and gesture data from interactive surfaces and trackers.
Features
- TUIO 1.1 — Cursors (
/tuio/2Dcur), Objects (/tuio/2Dobj), Blobs (/tuio/2Dblb) - TUIO 2.0 — Pointers (
/tuio2/ptr), Tokens (/tuio2/tok), Bounds (/tuio2/bnd), Symbols (/tuio2/sym) - UDP transport (always available)
- WebSocket transport (optional feature flag)
- Event-driven API — receive
Add,Update, andRemoveevents for each entity type - Generic client — plug in any transport that implements
OscReceiver
Roadmap
- Tuio 1.1
- Tuio 2.0
- Client (Udp/WebSocket)
- Server (Udp/WebSocket)
Installation
Add tuioxide to your Cargo.toml:
[]
= { = "0.2" }
To enable WebSocket support, enable the websocket feature:
[]
= { = "0.2", = ["websocket"] }
Usage
All clients listen in a blocking loop and return a batch of events each time update() is called. By default, the client connects to 127.0.0.1:3333.
TUIO 1.1 over UDP
use ;
TUIO 2.0 over UDP
use ;
WebSocket transport
Enable the websocket feature and pass a WebsocketOscReceiver to the client:
use ;
Custom transport
Implement the OscReceiver trait to use any transport layer:
use ;
use OscPacket;
use OscReceiver;
Then pass it to any client:
let mut client = new;
Examples
All examples connect to 127.0.0.1:3333. Run them with cargo run:
# TUIO 1.1 over UDP
# TUIO 1.1 over WebSocket
# TUIO 2.0 over UDP
# TUIO 2.0 over WebSocket
License
This project is licensed under the MIT License.
Acknowledgements
- TUIO specification by Martin Kaltenbrunner
- rosc — Rust OSC library