Skip to content

Commit f714534

Browse files
committed
Adding Multi-Leap to GitHub
1 parent 92a01c2 commit f714534

File tree

117 files changed

+11020
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+11020
-0
lines changed

.classpath

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src"/>
4+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
5+
<classpathentry kind="lib" path="libraries/jetty-distribution-9.2.3.v20140905/lib/jetty-io-9.2.3.v20140905.jar"/>
6+
<classpathentry kind="lib" path="libraries/jetty-distribution-9.2.3.v20140905/lib/jetty-util-9.2.3.v20140905.jar"/>
7+
<classpathentry kind="lib" path="libraries/jetty-distribution-9.2.3.v20140905/lib/websocket/websocket-api-9.2.3.v20140905.jar"/>
8+
<classpathentry kind="lib" path="libraries/jetty-distribution-9.2.3.v20140905/lib/websocket/websocket-client-9.2.3.v20140905.jar"/>
9+
<classpathentry kind="lib" path="libraries/jetty-distribution-9.2.3.v20140905/lib/websocket/websocket-common-9.2.3.v20140905.jar"/>
10+
<classpathentry kind="lib" path="libraries/JSON.simple/json-simple-1.1.1.jar"/>
11+
<classpathentry kind="lib" path="libraries/json-simpler/json-simpler-2.1b2.jar"/>
12+
<classpathentry kind="lib" path="libraries/Leap Motion/LeapJava.jar"/>
13+
<classpathentry kind="output" path="bin"/>
14+
</classpath>

.project

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>MultiLeap</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>

.settings/org.eclipse.jdt.core.prefs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.source=1.8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.26 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5.36 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1.38 KB
Binary file not shown.
23.2 KB
Binary file not shown.

libraries/Leap Motion/Leap.dll

2.36 MB
Binary file not shown.

libraries/Leap Motion/LeapJava.dll

194 KB
Binary file not shown.

libraries/Leap Motion/LeapJava.jar

73.7 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
JETTY
3+
=====
4+
The Jetty project is a 100% Java HTTP Server, HTTP Client
5+
and Servlet Container from the eclipse foundation
6+
7+
http://www.eclipse.org/jetty/
8+
9+
Jetty is open source and is dual licensed using the Apache 2.0 and
10+
Eclipse Public License 1.0. You may choose either license when
11+
distributing Jetty.

libraries/jetty-distribution-9.2.3.v20140905/VERSION.txt

+7,924
Large diffs are not rendered by default.
Binary file not shown.

libraries/jetty-distribution-9.2.3.v20140905/lib/ext/.donotdelete

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4.14 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package com.erikpaluka.multileap.input;
2+
3+
import java.io.IOException;
4+
5+
import org.eclipse.jetty.websocket.api.Session;
6+
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
7+
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
8+
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
9+
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
10+
import org.json.simple.parser.ParseException;
11+
12+
import com.erikpaluka.multileap.leap.FrameObj;
13+
14+
@WebSocket
15+
public class ClientSocket {
16+
public LeapParser parser;
17+
18+
public Session session;
19+
20+
public boolean connected = false;
21+
public boolean receivingData = false;
22+
public boolean receivingLeapData = false;
23+
public String lastMsg = "";
24+
public FrameObj lastFrame;
25+
public ControllerObj controller;
26+
27+
public boolean sessionFailed = false;
28+
29+
public ClientSocket(LeapParser leapParser, ControllerObj c) {
30+
parser = leapParser;
31+
controller = c;
32+
}
33+
34+
@OnWebSocketClose
35+
public void onClose(int statusCode, String reason) {
36+
System.out.println("WebSocket client: connection closed. Status :" + statusCode + ". Reason: " + reason);
37+
session.close();
38+
this.session = null;
39+
connected = false;
40+
41+
receivingData = false;
42+
receivingLeapData = false;
43+
lastMsg = "";
44+
lastFrame = null;
45+
controller = null;
46+
47+
if (statusCode == 1008) {
48+
sessionFailed = true;
49+
}
50+
}
51+
52+
@OnWebSocketConnect
53+
public void onConnect(Session session) throws IOException {
54+
System.out.println("WebSocket client: connected: " + session);
55+
this.session = session;
56+
connected = true;
57+
}
58+
59+
@OnWebSocketMessage
60+
public void onMessage(String msg) throws ParseException {
61+
//System.out.println("Received msg: " + msg);
62+
63+
if(msg != null) {
64+
65+
receivingData = true;
66+
lastMsg = msg;
67+
lastFrame = parser.parse(msg, controller);
68+
69+
if (lastFrame != null) {
70+
//System.out.println(msg);
71+
receivingLeapData = true;
72+
}
73+
} else {
74+
receivingData = false;
75+
receivingLeapData = false;
76+
}
77+
78+
}
79+
80+
public FrameObj getFrame() {
81+
return lastFrame;
82+
}
83+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package com.erikpaluka.multileap.input;
2+
3+
import java.util.ArrayList;
4+
import java.util.Iterator;
5+
6+
public class ControllerList implements Iterable<ControllerObj> {
7+
8+
public ArrayList<ControllerObj> controllers;
9+
10+
public ControllerList() {
11+
controllers = new ArrayList<ControllerObj>();
12+
}
13+
14+
15+
public ControllerObj getMainController() {
16+
17+
for (ControllerObj c : controllers) {
18+
19+
if (!c.externalLeap) {
20+
return c;
21+
}
22+
}
23+
24+
return null;
25+
}
26+
27+
public ControllerObj getExtController() {
28+
29+
for (ControllerObj c : controllers) {
30+
31+
if (c.externalLeap) {
32+
return c;
33+
}
34+
}
35+
36+
System.err.println("No external controller.");
37+
return null;
38+
}
39+
40+
public void addController(ControllerObj c) {
41+
controllers.add(c);
42+
}
43+
44+
public void update() {
45+
for (ControllerObj c : controllers) {
46+
c.updateController();
47+
}
48+
}
49+
50+
public void stopAll() {
51+
for (ControllerObj c : controllers) {
52+
c.stopClient();
53+
}
54+
}
55+
56+
@Override
57+
public Iterator<ControllerObj> iterator() {
58+
return controllers.iterator();
59+
}
60+
61+
}

0 commit comments

Comments
 (0)