forked from OpenKinect/libfreenect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of Java API using JNA
Signed-off-by: Mark Renouf <[email protected]>
- Loading branch information
Showing
13 changed files
with
553 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.classpath | ||
.project | ||
.settings/ | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.openkinect</groupId> | ||
<artifactId>freenect</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<repositories> | ||
<repository> | ||
<id>nativelibs4java-repo</id> | ||
<name>NativeLibs4Java Maven Repository</name> | ||
<url>http://nativelibs4java.sourceforge.net/maven</url> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>nativelibs4java-pluginRepo</id> | ||
<url>http://nativelibs4java.sourceforge.net/maven</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.java.dev.jna</groupId> | ||
<artifactId>jna</artifactId> | ||
<version>3.2.3</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.8.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-library</artifactId> | ||
<version>1.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<!-- http://maven.apache.org/plugins/maven-compiler-plugin/ --> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
wrappers/java/src/main/java/org/openkinect/freenect/Context.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.openkinect.freenect; | ||
|
||
public interface Context { | ||
int numDevices(); | ||
void setLogHandler(LogHandler handler); | ||
void setLogLevel(LogLevel level); | ||
Device openDevice(int index); | ||
void processEvents(); | ||
void processEventsBackground(); | ||
void closeDevice(Device device); | ||
void stopEventThread(); | ||
} |
32 changes: 32 additions & 0 deletions
32
wrappers/java/src/main/java/org/openkinect/freenect/DepthFormat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.openkinect.freenect; | ||
|
||
|
||
public enum DepthFormat { | ||
D11BIT(0, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_11BIT_SIZE), | ||
D10BIT(1, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_10BIT_SIZE), | ||
D11BIT_PACKED(2, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_11BIT_PACKED_SIZE), | ||
D10BIT_PACKED(3, Freenect.FREENECT_FRAME_W, Freenect.FREENECT_FRAME_H, Freenect.FREENECT_DEPTH_10BIT_PACKED_SIZE); | ||
private int value; | ||
private int frameSize; | ||
private int width; | ||
private int height; | ||
|
||
private DepthFormat(int value, int width, int height, int frameSize) { | ||
this.value = value; | ||
this.width = width; | ||
this.height = height; | ||
this.frameSize = frameSize; | ||
} | ||
public int intValue() { | ||
return value; | ||
} | ||
public int getWidth() { | ||
return width; | ||
} | ||
public int getHeight() { | ||
return height; | ||
} | ||
public int getFrameSize() { | ||
return frameSize; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
wrappers/java/src/main/java/org/openkinect/freenect/DepthHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.openkinect.freenect; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
public interface DepthHandler { | ||
void onFrameReceived(DepthFormat format, ByteBuffer frame, int timestamp); | ||
} |
18 changes: 18 additions & 0 deletions
18
wrappers/java/src/main/java/org/openkinect/freenect/Device.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.openkinect.freenect; | ||
|
||
|
||
|
||
public interface Device { | ||
double[] getAccel(); | ||
int setLed(LedStatus status); | ||
void refreshTitleState(); | ||
double getTiltAngle(); | ||
int setTiltAngle(double angle); | ||
TiltStatus getTiltStatus(); | ||
void setDepthFormat(DepthFormat fmt); | ||
void setVideoFormat(VideoFormat fmt); | ||
int startDepth(DepthHandler handler); | ||
int startVideo(VideoHandler handler); | ||
int stopDepth(); | ||
int stopVideo(); | ||
} |
Oops, something went wrong.