Commit 1e031195 authored by Pony's avatar Pony

Changes to connect the kinnect messages to the TUI app

parent b2556811
......@@ -528,6 +528,10 @@ public class TangibleObject implements Cloneable {
@Override
public TangibleObject clone() {
clientJava a = new clientJava(getObjectId(), ((int) getPosition().toScreenCoordinates().getX()), ((int) getPosition().toScreenCoordinates().getY()), getState().toString());
a.run();
return new TangibleObjectBuilder(objectId, Type.OBJECT, 0, 0)
.withSeconds(seconds)
.withMicroSeconds(microSeconds)
......
/**
* Copyright Luxembourg Institute of Science and Technology, 2016. All rights reserved.
*
* This file is part of TULIP.
*
* TULIP is free software: you can redistribute it and/or modify it under the terms of the GNU
* Lesser General Public License as published by the Free Software Foundation, version 3 of the
* License.
*
* TULIP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
* General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with TULIP. If
* not, see <http://www.gnu.org/licenses/lgpl-3.0.html>.
*/
package lu.list.itis.dkd.tui.adapter;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
/**
* @author fal
* @since [major].[minor]
* @version [major].[minor].[micro]
*/
class clientJava extends Thread {
protected int objId;
protected int objX;
protected int objY;
protected String c;
public clientJava(int id, int x, int y, String s) {
this.objX = x;
this.objY = y;
this.objId = id;
this.c = s;
}
public void setXY(int x, int y) {
this.objX = x;
this.objY = y;
}
public void setOBJID(int a) {
this.objId = a;
}
public void run() {
try {
DatagramSocket socket = new DatagramSocket();
InetAddress IPAddress = InetAddress.getByName("192.168.0.50");
byte[] senddata = new byte[1024];
String s = (objId + "*" + objX + "*" + objY + "*" + c);
senddata = s.getBytes();
DatagramPacket sendPacket = new DatagramPacket(senddata, senddata.length, IPAddress, 13000);
socket.send(sendPacket);
socket.close();
System.out.println("Sent to 168.192.0.50:13000");
} catch (Exception e) {
e.printStackTrace();
}
try {
this.finalize();
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment