oc.ProcessingTUIO.1.1.0.source-code.TuioDump Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ProcessingTUIO Show documentation
Show all versions of ProcessingTUIO Show documentation
Tuio Processing, PapARt version.
The newest version!
/*
TUIO Java Console Example
Copyright (c) 2005-2014 Martin Kaltenbrunner
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import TUIO.*;
public class TuioDump implements TuioListener {
public void addTuioObject(TuioObject tobj) {
System.out.println("add obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
}
public void updateTuioObject(TuioObject tobj) {
System.out.println("set obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()+" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
}
public void removeTuioObject(TuioObject tobj) {
System.out.println("del obj "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
}
public void addTuioCursor(TuioCursor tcur) {
System.out.println("add cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY());
}
public void updateTuioCursor(TuioCursor tcur) {
System.out.println("set cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+") "+tcur.getX()+" "+tcur.getY()+" "+tcur.getMotionSpeed()+" "+tcur.getMotionAccel());
}
public void removeTuioCursor(TuioCursor tcur) {
System.out.println("del cur "+tcur.getCursorID()+" ("+tcur.getSessionID()+")");
}
public void addTuioBlob(TuioBlob tblb) {
System.out.println("add blb "+tblb.getBlobID()+" ("+tblb.getSessionID()+") "+tblb.getX()+" "+tblb.getY()+" "+tblb.getAngle()+" "+tblb.getWidth()+" "+tblb.getHeight()+" "+tblb.getArea());
}
public void updateTuioBlob(TuioBlob tblb) {
System.out.println("set blb "+tblb.getBlobID()+" ("+tblb.getSessionID()+") "+tblb.getX()+" "+tblb.getY()+" "+tblb.getAngle()+" "+tblb.getWidth()+" "+tblb.getHeight()+" "+tblb.getArea()+" "+tblb.getMotionSpeed()+" "+tblb.getRotationSpeed()+" "+tblb.getMotionAccel()+" "+tblb.getRotationAccel());
}
public void removeTuioBlob(TuioBlob tblb) {
System.out.println("del blb "+tblb.getBlobID()+" ("+tblb.getSessionID()+")");
}
public void refresh(TuioTime frameTime) {
System.out.println("frame "+frameTime.getFrameID()+" "+frameTime.getTotalMilliseconds());
}
public static void main(String argv[]) {
int port = 3333;
if (argv.length==1) {
try { port = Integer.parseInt(argv[0]); }
catch (Exception e) { System.out.println("usage: java TuioDump [port]"); }
} else if (argv.length>1) System.out.println("usage: java TuioDump [port]");
TuioDump dump = new TuioDump();
TuioClient client = new TuioClient(port);
System.out.println("listening to TUIO messages at port "+port);
client.addTuioListener(dump);
client.connect();
}
}