Skip to content

Commit

Permalink
Initial commit of Java API using JNA
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Renouf <[email protected]>
  • Loading branch information
mrenouf authored and qdot committed Dec 12, 2010
1 parent 5246d36 commit 060978c
Show file tree
Hide file tree
Showing 13 changed files with 553 additions and 0 deletions.
4 changes: 4 additions & 0 deletions wrappers/java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.classpath
.project
.settings/
target/
57 changes: 57 additions & 0 deletions wrappers/java/pom.xml
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 wrappers/java/src/main/java/org/openkinect/freenect/Context.java
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();
}
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;
}
}
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 wrappers/java/src/main/java/org/openkinect/freenect/Device.java
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();
}
Loading

0 comments on commit 060978c

Please sign in to comment.