Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix the java wrapper

Signed-off-by: Erwan Daubert <erwan.daubert@gmail.com>
  • Loading branch information...
commit 53e8aa28939d35b2a69bd76bbc40f551afef774e 1 parent ed5081f
@edaubert edaubert authored zarvox committed
View
1  .gitignore
@@ -29,3 +29,4 @@ obj/
_ReSharper*/
[Tt]est[Rr]esult*
build
+/results/
View
1  wrappers/.gitignore
@@ -0,0 +1 @@
+/test/
View
3  wrappers/java/.gitignore
@@ -2,3 +2,6 @@
.project
.settings/
target/
+/freenect.iml
+/freenect.ipr
+/freenect.iws
View
89 wrappers/java/src/main/java/org/openkinect/freenect/DepthFrameMode.java
@@ -0,0 +1,89 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
+package org.openkinect.freenect;
+
+import com.sun.jna.Structure;
+
+
+/**
+ * User: Erwan Daubert - erwan.daubert@gmail.com
+ * Date: 12/08/11
+ * Time: 13:46
+ */
+public class DepthFrameMode extends Structure {
+ public int reserved;
+ public int resolution;
+// public DepthFormat format;
+ public int bytes;
+ public short width;
+ public short height;
+ public short dataBitsPerPixel;
+ public short paddingBitsPerPixel;
+ public short framerate;
+ public short valid;
+
+ public DepthFrameMode () {
+ }
+
+ public DepthFrameMode (int reserved, int resolution/*, DepthFormat format*/, int bytes, short width,
+ short height,
+ short dataBitsPerPixel, short paddingBitsPerPixel, short framerate, short valid) {
+ this.reserved = reserved;
+ this.resolution = resolution;
+// this.format = format;
+ this.bytes = bytes;
+ this.width = width;
+ this.height = height;
+ this.dataBitsPerPixel = dataBitsPerPixel;
+ this.paddingBitsPerPixel = paddingBitsPerPixel;
+ this.framerate = framerate;
+ this.valid = valid;
+ }
+
+
+ public static class DepthFrameModeByReference extends DepthFrameMode implements Structure.ByReference {
+
+ }
+ public static class DepthFrameModeByValue extends DepthFrameMode implements Structure.ByValue {
+
+ }
+}
+
+/*typedef struct {
+ uint32_t reserved; *//**< unique ID used internally. The meaning of values may change without notice. Don't touch or depend on the contents of this field. We mean it. *//*
+ freenect_resolution resolution; *//**< Resolution this freenect_frame_mode describes, should you want to find it again with freenect_find_*_frame_mode(). *//*
+ union {
+ int32_t dummy;
+ freenect_video_format video_format;
+ freenect_depth_format depth_format;
+ }; *//**< The video or depth format that this freenect_frame_mode describes. The caller should know which of video_format or depth_format to use, since they called freenect_get_*_frame_mode() *//*
+ int32_t bytes; *//**< Total buffer size in bytes to hold a single frame of data. Should be equivalent to width * height * (data_bits_per_pixel+padding_bits_per_pixel) / 8 *//*
+ int16_t width; *//**< Width of the frame, in pixels *//*
+ int16_t height; *//**< Height of the frame, in pixels *//*
+ int8_t data_bits_per_pixel; *//**< Number of bits of information needed for each pixel *//*
+ int8_t padding_bits_per_pixel; *//**< Number of bits of padding for alignment used for each pixel *//*
+ int8_t framerate; *//**< Approximate expected frame rate, in Hz *//*
+ int8_t is_valid; *//**< If 0, this freenect_frame_mode is invalid and does not describe a supported mode. Otherwise, the frame_mode is valid. *//*
+} freenect_frame_mode;*/
View
31 wrappers/java/src/main/java/org/openkinect/freenect/Device.java
@@ -1,6 +1,28 @@
-package org.openkinect.freenect;
-
-
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
+ package org.openkinect.freenect;
public interface Device {
double[] getAccel();
@@ -9,7 +31,10 @@
double getTiltAngle();
int setTiltAngle(double angle);
TiltStatus getTiltStatus();
+ void setResolution(Resolution res);
+ //void setDepthFormat(DepthFrameMode mode);
void setDepthFormat(DepthFormat fmt);
+ //void setVideoFormat(VideoFrameMode mode);
void setVideoFormat(VideoFormat fmt);
int startDepth(DepthHandler handler);
int startVideo(VideoHandler handler);
View
51 wrappers/java/src/main/java/org/openkinect/freenect/Flags.java
@@ -0,0 +1,51 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
+package org.openkinect.freenect;
+
+/**
+ * User: Erwan Daubert - erwan.daubert@gmail.com
+ * Date: 12/08/11
+ * Time: 13:40
+ */
+public enum Flags {
+ FREENECT_DEVICE_MOTOR(0x01),
+ FREENECT_DEVICE_CAMERA(0x02),
+ FREENECT_DEVICE_AUDIO(0x04),;
+
+ private int value;
+
+ Flags (int value) {
+ this.value = value;
+ }
+
+ public int getValue () {
+ return value;
+ }
+}
+/*typedef enum {
+ FREENECT_DEVICE_MOTOR = 0x01,
+ FREENECT_DEVICE_CAMERA = 0x02,
+ FREENECT_DEVICE_AUDIO = 0x04,
+} freenect_device_flags;*/
View
756 wrappers/java/src/main/java/org/openkinect/freenect/Freenect.java
@@ -1,339 +1,433 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
+import com.sun.jna.*;
+import com.sun.jna.ptr.PointerByReference;
+
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
-import com.sun.jna.Callback;
-import com.sun.jna.Library;
-import com.sun.jna.Native;
-import com.sun.jna.NativeLibrary;
-import com.sun.jna.Pointer;
-import com.sun.jna.PointerType;
-import com.sun.jna.ptr.PointerByReference;
-
public class Freenect implements Library {
- static {
- try {
- NativeLibrary.addSearchPath("freenect", "../../build/lib");
- NativeLibrary.addSearchPath("freenect", "/usr/local/lib");
- NativeLibrary instance = NativeLibrary.getInstance("freenect");
- System.err.println("Loaded " + instance.getName() + " from " + instance.getFile().getCanonicalPath());
- Native.register(instance);
- } catch (IOException e) {
- throw new AssertionError(e);
- }
- }
-
- // constants from libfreenect.h
- static final int FREENECT_FRAME_W = 640;
- static final int FREENECT_FRAME_H = 480;
- static final int FREENECT_FRAME_PIX = (FREENECT_FRAME_H * FREENECT_FRAME_W);
- static final int FREENECT_IR_FRAME_W = 640;
- static final int FREENECT_IR_FRAME_H = 488;
- static final int FREENECT_IR_FRAME_PIX = (FREENECT_IR_FRAME_H * FREENECT_IR_FRAME_W);
- static final int FREENECT_VIDEO_RGB_SIZE = (FREENECT_FRAME_PIX * 3);
- static final int FREENECT_VIDEO_BAYER_SIZE = (FREENECT_FRAME_PIX);
- static final int FREENECT_VIDEO_YUV_SIZE = (FREENECT_FRAME_PIX * 2);
- static final int FREENECT_VIDEO_IR_8BIT_SIZE = (FREENECT_IR_FRAME_PIX);
- static final int FREENECT_VIDEO_IR_10BIT_SIZE = (FREENECT_IR_FRAME_PIX * 2);
- static final int FREENECT_VIDEO_IR_10BIT_PACKED_SIZE = 390400;
- static final int FREENECT_DEPTH_11BIT_SIZE = (FREENECT_FRAME_PIX * 2);
- static final int FREENECT_DEPTH_10BIT_SIZE = FREENECT_DEPTH_11BIT_SIZE;
- static final int FREENECT_DEPTH_11BIT_PACKED_SIZE = 422400;
- static final int FREENECT_DEPTH_10BIT_PACKED_SIZE = 384000;
-
- protected Freenect() {}
-
- public static Context createContext() {
- PointerByReference ctxPtr = new PointerByReference();
- int rval = freenect_init(ctxPtr, Pointer.NULL);
- if (rval == 0) {
- NativeContext ctx = new NativeContext(ctxPtr.getValue());
- ctx.startEventThread();
- return ctx;
- }
- throw new IllegalStateException("init() returned " + rval);
- }
-
- protected static class NativeContext extends PointerType implements Context {
- private EventThread eventThread;
-
- public NativeContext() {}
-
- private LogHandler logHandler;
- private final NativeLogCallback logCallback = new NativeLogCallback() {
- @Override
- public void callback(NativeDevice dev, int level, String msg) {
- logHandler.onMessage(dev, LogLevel.fromInt(level), msg);
- }
- };
-
- protected NativeContext(Pointer ptr) {
- super(ptr);
- }
-
- @Override
- public void setLogHandler(LogHandler handler) {
- this.logHandler = handler;
- if (logHandler == null) {
- freenect_set_log_callback(this, null);
- } else {
- freenect_set_log_callback(this, logCallback);
- }
- }
-
- @Override
- public void setLogLevel(LogLevel level) {
- freenect_set_log_level(this, level.intValue());
- }
-
- @Override
- public int numDevices() {
- return freenect_num_devices(this);
- }
-
- @Override
- public Device openDevice(int index) {
- PointerByReference devicePtr = new PointerByReference();
- int rval = freenect_open_device(this, devicePtr, index);
- if (rval != 0) {
- throw new IllegalStateException("freenect_open_device() returned " + rval);
- }
- return new NativeDevice(devicePtr.getValue(), index);
- }
-
- protected void processEvents() {
- freenect_process_events(this);
- }
-
- protected void startEventThread() {
- if (eventThread == null || !eventThread.isAlive()) {
- eventThread = new EventThread(this);
- eventThread.start();
- }
- }
-
- protected void stopEventThread() {
- if (eventThread != null) {
- eventThread.kill();
- eventThread = null;
- }
- }
-
- @Override
- public void shutdown() {
- stopEventThread();
- freenect_shutdown(this);
- }
- }
-
- protected static class NativeDevice extends PointerType implements Device {
- private VideoFormat videoFormat;
- private ByteBuffer videoBuffer;
- private DepthFormat depthFormat;
- private ByteBuffer depthBuffer;
- private final DoubleBuffer accelX = DoubleBuffer.allocate(1);
- private final DoubleBuffer accelY = DoubleBuffer.allocate(1);
- private final DoubleBuffer accelZ = DoubleBuffer.allocate(1);
- private VideoHandler videoHandler;
- private DepthHandler depthHandler;
- private int index;
-
- private TiltState rawTiltState;
- private TiltStatus tiltStatus;
- private double tiltAngle;
- private double[] accel;
-
- private final NativeVideoCallback videoCallback = new NativeVideoCallback() {
- @Override
- public void callback(Pointer dev, Pointer depth, int timestamp) {
- videoHandler.onFrameReceived(videoFormat, videoBuffer, timestamp);
- }
- };
-
- private final NativeDepthCallback depthCallback = new NativeDepthCallback() {
- @Override
- public void callback(Pointer dev, Pointer depth, int timestamp) {
- depthHandler.onFrameReceived(depthFormat, depthBuffer, timestamp);
- }
- };
-
- public NativeDevice() {}
-
- protected NativeDevice(Pointer ptr, int index) {
- super(ptr);
- this.index = index;
- this.rawTiltState = freenect_get_tilt_state(this);
- this.accel = new double[3];
- refreshTiltState();
- setVideoFormat(VideoFormat.RGB);
- setDepthFormat(DepthFormat.D11BIT);
- }
-
- protected void setDeviceIndex(int index) {
- this.index = index;
- }
-
- @Override
- public int getDeviceIndex() {
- return index;
- }
-
- public void close() {
- freenect_close_device(this);
- }
-
- @Override
- public void setDepthFormat(DepthFormat fmt) {
- freenect_set_depth_format(this, fmt.intValue());
- depthBuffer = ByteBuffer.allocateDirect(fmt.getFrameSize());
- freenect_set_depth_buffer(this, depthBuffer);
- this.depthFormat = fmt;
- }
-
- @Override
- public void setVideoFormat(VideoFormat fmt) {
- freenect_set_video_format(this, fmt.intValue());
- videoBuffer = ByteBuffer.allocateDirect(fmt.getFrameSize());
- freenect_set_video_buffer(this, videoBuffer);
- this.videoFormat = fmt;
- }
-
- @Override
- public int setLed(LedStatus status) {
- return freenect_set_led(this, status.intValue());
- }
-
- @Override
- public void refreshTiltState() {
- freenect_update_tilt_state(this);
- this.rawTiltState = freenect_get_tilt_state(this);
- this.tiltAngle = freenect_get_tilt_degs(rawTiltState);
- this.tiltStatus = TiltStatus.fromInt(freenect_get_tilt_status(rawTiltState));
- freenect_get_mks_accel(rawTiltState, accelX, accelY, accelZ);
- this.accel[0] = accelX.get(0);
- this.accel[1] = accelY.get(0);
- this.accel[2] = accelZ.get(0);
- }
-
- @Override
- public double getTiltAngle() {
- return tiltAngle;
- }
-
- @Override
- public int setTiltAngle(double angle) {
- return freenect_set_tilt_degs(this, angle);
- }
-
- @Override
- public TiltStatus getTiltStatus() {
- return tiltStatus;
- }
-
- @Override
- public double[] getAccel() {
- return new double[] { accelX.get(0), accelY.get(0), accelZ.get(0) };
- }
-
- @Override
- public int startVideo(VideoHandler handler) {
- this.videoHandler = handler;
- freenect_set_video_callback(this, videoCallback);
- return freenect_start_video(this);
- }
-
- @Override
- public int stopVideo() {
- int rval = freenect_stop_video(this);
- freenect_set_video_callback(this, null);
- this.videoHandler = null;
- return rval;
- }
-
- @Override
- public int startDepth(DepthHandler handler) {
- this.depthHandler = handler;
- freenect_set_depth_callback(this, depthCallback);
- return freenect_start_depth(this);
- }
-
- @Override
- public int stopDepth() {
- int rval = freenect_stop_depth(this);
- freenect_set_depth_callback(this, null);
- this.depthHandler = null;
- return rval;
- }
- }
-
- private static class EventThread extends Thread {
- private final NativeContext ctx;
- private volatile boolean alive = true;
-
- public EventThread(NativeContext ctx) {
- this.ctx = ctx;
- setDaemon(true);
- setName("FreenectEventThread");
- }
-
- public void kill() {
- this.alive = false;
- }
-
- @Override
- public void run() {
- while (alive) {
- freenect_process_events(ctx);
- }
- }
- };
-
- protected static class TiltState extends PointerType {
- public TiltState() {}
- }
-
- // function prototypes from libfreenect.h
- // These must match the names used in the library!
-
- public interface NativeLogCallback extends Callback {
- void callback(NativeDevice dev, int logLevel, String msg);
- }
-
- private interface NativeDepthCallback extends Callback {
- void callback(Pointer dev, Pointer depth, int timestamp);
- };
-
- private interface NativeVideoCallback extends Callback {
- void callback(Pointer dev, Pointer frame, int timestamp);
- };
-
- private static native int freenect_init(PointerByReference ctx, Pointer usb_ctx);
- private static native int freenect_shutdown(NativeContext ctx);
- private static native void freenect_set_log_level(NativeContext ctx, int level);
- private static native void freenect_set_log_callback(NativeContext ctx, NativeLogCallback cb);
- private static native int freenect_process_events(NativeContext ctx);
- private static native int freenect_num_devices(NativeContext ctx);
- private static native int freenect_open_device(NativeContext ctx, PointerByReference dev, int index);
- private static native int freenect_close_device(NativeDevice dev);
- private static native void freenect_set_user(NativeDevice dev, Pointer user);
- private static native Pointer freenect_get_user(NativeDevice dev);
- private static native void freenect_set_depth_callback(NativeDevice dev, NativeDepthCallback cb);
- private static native void freenect_set_video_callback(NativeDevice dev, NativeVideoCallback cb);
- private static native int freenect_set_depth_format(NativeDevice dev, int i);
- private static native int freenect_set_video_format(NativeDevice dev, int i);
- private static native int freenect_set_depth_buffer(NativeDevice dev, ByteBuffer buf);
- private static native int freenect_set_video_buffer(NativeDevice dev, ByteBuffer buf);
- private static native int freenect_start_depth(NativeDevice dev);
- private static native int freenect_start_video(NativeDevice dev);
- private static native int freenect_stop_depth(NativeDevice dev);
- private static native int freenect_stop_video(NativeDevice dev);
- private static native int freenect_update_tilt_state(NativeDevice dev);
- private static native TiltState freenect_get_tilt_state(NativeDevice dev);
- private static native byte freenect_get_tilt_status(TiltState tiltState);
- private static native double freenect_get_tilt_degs(TiltState tiltState);
- private static native int freenect_set_tilt_degs(NativeDevice dev, double angle);
- private static native int freenect_set_led(NativeDevice dev, int option);
- private static native void freenect_get_mks_accel(TiltState tiltState, DoubleBuffer x, DoubleBuffer y, DoubleBuffer z);
+ static {
+ try {
+ NativeLibrary.addSearchPath("freenect", "/home/edaubert/tmp/kinect/libfreenect/results/lib/");
+ NativeLibrary.addSearchPath("freenect", "/usr/local/lib");
+ NativeLibrary instance = NativeLibrary.getInstance("freenect");
+ System.err.println("Loaded " + instance.getName() + " from " + instance.getFile().getCanonicalPath());
+ Native.register(instance);
+ } catch (IOException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ // constants from libfreenect.h
+ static final int FREENECT_FRAME_W = 640;
+ static final int FREENECT_FRAME_H = 480;
+ static final int FREENECT_FRAME_PIX = (FREENECT_FRAME_H * FREENECT_FRAME_W);
+ static final int FREENECT_IR_FRAME_W = 640;
+ static final int FREENECT_IR_FRAME_H = 488;
+ static final int FREENECT_IR_FRAME_PIX = (FREENECT_IR_FRAME_H * FREENECT_IR_FRAME_W);
+ static final int FREENECT_VIDEO_RGB_SIZE = (FREENECT_FRAME_PIX * 3);
+ static final int FREENECT_VIDEO_BAYER_SIZE = (FREENECT_FRAME_PIX);
+ static final int FREENECT_VIDEO_YUV_SIZE = (FREENECT_FRAME_PIX * 2);
+ static final int FREENECT_VIDEO_IR_8BIT_SIZE = (FREENECT_IR_FRAME_PIX);
+ static final int FREENECT_VIDEO_IR_10BIT_SIZE = (FREENECT_IR_FRAME_PIX * 2);
+ static final int FREENECT_VIDEO_IR_10BIT_PACKED_SIZE = 390400;
+ static final int FREENECT_DEPTH_11BIT_SIZE = (FREENECT_FRAME_PIX * 2);
+ static final int FREENECT_DEPTH_10BIT_SIZE = FREENECT_DEPTH_11BIT_SIZE;
+ static final int FREENECT_DEPTH_11BIT_PACKED_SIZE = 422400;
+ static final int FREENECT_DEPTH_10BIT_PACKED_SIZE = 384000;
+
+ protected Freenect () {
+ }
+
+ public static Context createContext () {
+ PointerByReference ctxPtr = new PointerByReference();
+ int rval = freenect_init(ctxPtr, Pointer.NULL);
+ if (rval == 0) {
+ NativeContext ctx = new NativeContext(ctxPtr.getValue());
+ ctx.startEventThread();
+ return ctx;
+ }
+ throw new IllegalStateException("init() returned " + rval);
+ }
+
+ protected static class NativeContext extends PointerType implements Context {
+ private EventThread eventThread;
+
+ public NativeContext () {
+ }
+
+ private LogHandler logHandler;
+ private final NativeLogCallback logCallback = new NativeLogCallback() {
+ @Override
+ public void callback (NativeDevice dev, int level, String msg) {
+ logHandler.onMessage(dev, LogLevel.fromInt(level), msg);
+ }
+ };
+
+ protected NativeContext (Pointer ptr) {
+ super(ptr);
+ }
+
+ @Override
+ public void setLogHandler (LogHandler handler) {
+ this.logHandler = handler;
+ if (logHandler == null) {
+ freenect_set_log_callback(this, null);
+ } else {
+ freenect_set_log_callback(this, logCallback);
+ }
+ }
+
+ @Override
+ public void setLogLevel (LogLevel level) {
+ freenect_set_log_level(this, level.intValue());
+ }
+
+ @Override
+ public int numDevices () {
+ return freenect_num_devices(this);
+ }
+
+ @Override
+ public Device openDevice (int index) {
+ PointerByReference devicePtr = new PointerByReference();
+ int rval = freenect_open_device(this, devicePtr, index);
+ if (rval != 0) {
+ throw new IllegalStateException("freenect_open_device() returned " + rval);
+ }
+ return new NativeDevice(devicePtr.getValue(), index);
+ }
+
+ protected void processEvents () {
+ freenect_process_events(this);
+ }
+
+ protected void startEventThread () {
+ if (eventThread == null || !eventThread.isAlive()) {
+ eventThread = new EventThread(this);
+ eventThread.start();
+ }
+ }
+
+ protected void stopEventThread () {
+ if (eventThread != null) {
+ eventThread.kill();
+ eventThread = null;
+ }
+ }
+
+ @Override
+ public void shutdown () {
+ stopEventThread();
+ freenect_shutdown(this);
+ }
+ }
+
+ protected static class NativeDevice extends PointerType implements Device {
+ private Resolution resolution = Resolution.FREENECT_RESOLUTION_MEDIUM;
+ private VideoFormat videoFormat;
+ private ByteBuffer videoBuffer;
+ private DepthFormat depthFormat;
+ private ByteBuffer depthBuffer;
+ private final DoubleBuffer accelX = DoubleBuffer.allocate(1);
+ private final DoubleBuffer accelY = DoubleBuffer.allocate(1);
+ private final DoubleBuffer accelZ = DoubleBuffer.allocate(1);
+ private VideoHandler videoHandler;
+ private DepthHandler depthHandler;
+ private int index;
+
+ private TiltState rawTiltState;
+ private TiltStatus tiltStatus;
+ private double tiltAngle;
+ private double[] accel;
+
+ private final NativeVideoCallback videoCallback = new NativeVideoCallback() {
+ @Override
+ public void callback (Pointer dev, Pointer depth, int timestamp) {
+ videoHandler.onFrameReceived(videoFormat, videoBuffer, timestamp);
+ }
+ };
+
+ private final NativeDepthCallback depthCallback = new NativeDepthCallback() {
+ @Override
+ public void callback (Pointer dev, Pointer depth, int timestamp) {
+ depthHandler.onFrameReceived(depthFormat, depthBuffer, timestamp);
+ }
+ };
+
+ public NativeDevice () {
+ }
+
+ protected NativeDevice (Pointer ptr, int index) {
+ super(ptr);
+ this.index = index;
+ this.rawTiltState = freenect_get_tilt_state(this);
+ this.accel = new double[3];
+ refreshTiltState();
+ setVideoFormat(VideoFormat.RGB);
+ setDepthFormat(DepthFormat.D10BIT);
+ }
+
+ protected void setDeviceIndex (int index) {
+ this.index = index;
+ }
+
+ @Override
+ public int getDeviceIndex () {
+ return index;
+ }
+
+ public void close () {
+ freenect_close_device(this);
+ }
+
+ @Override
+ public void setDepthFormat (DepthFormat fmt) {
+// Native.setProtected(true);
+ DepthFrameMode.DepthFrameModeByValue mode = freenect_find_depth_mode(resolution.getValue(), fmt.intValue());
+ if (mode.valid != 0) {
+ freenect_set_depth_mode(this, mode);
+
+ //freenect_set_depth_format(this, fmt.intValue());
+ depthBuffer = ByteBuffer.allocateDirect(fmt.getFrameSize());
+ freenect_set_depth_buffer(this, depthBuffer);
+ this.depthFormat = fmt;
+ }
+ }
+
+ @Override
+ public void setVideoFormat (VideoFormat fmt) {
+// Native.setProtected(true);
+ VideoFrameMode.VideoFrameModeByValue mode = freenect_find_video_mode(resolution.getValue(), fmt.intValue());
+ if (mode.valid != 0) {
+ freenect_set_video_mode(this, mode);
+ //freenect_set_video_format(this, fmt.intValue());
+ videoBuffer = ByteBuffer.allocateDirect(fmt.getFrameSize());
+ freenect_set_video_buffer(this, videoBuffer);
+ this.videoFormat = fmt;
+ }
+ }
+
+ @Override
+ public int setLed (LedStatus status) {
+ return freenect_set_led(this, status.intValue());
+ }
+
+ @Override
+ public void refreshTiltState () {
+ freenect_update_tilt_state(this);
+ this.rawTiltState = freenect_get_tilt_state(this);
+ this.tiltAngle = freenect_get_tilt_degs(rawTiltState);
+ this.tiltStatus = TiltStatus.fromInt(freenect_get_tilt_status(rawTiltState));
+ freenect_get_mks_accel(rawTiltState, accelX, accelY, accelZ);
+ this.accel[0] = accelX.get(0);
+ this.accel[1] = accelY.get(0);
+ this.accel[2] = accelZ.get(0);
+ }
+
+ @Override
+ public double getTiltAngle () {
+ return tiltAngle;
+ }
+
+ @Override
+ public int setTiltAngle (double angle) {
+ return freenect_set_tilt_degs(this, angle);
+ }
+
+ @Override
+ public TiltStatus getTiltStatus () {
+ return tiltStatus;
+ }
+
+ @Override
+ public void setResolution (Resolution res) {
+ this.resolution = res;
+ }
+
+ @Override
+ public double[] getAccel () {
+ return new double[]{accelX.get(0), accelY.get(0), accelZ.get(0)};
+ }
+
+ @Override
+ public int startVideo (VideoHandler handler) {
+ this.videoHandler = handler;
+ freenect_set_video_callback(this, videoCallback);
+ return freenect_start_video(this);
+ }
+
+ @Override
+ public int stopVideo () {
+ int rval = freenect_stop_video(this);
+ freenect_set_video_callback(this, null);
+ this.videoHandler = null;
+ return rval;
+ }
+
+ @Override
+ public int startDepth (DepthHandler handler) {
+ this.depthHandler = handler;
+ freenect_set_depth_callback(this, depthCallback);
+ return freenect_start_depth(this);
+ }
+
+ @Override
+ public int stopDepth () {
+ int rval = freenect_stop_depth(this);
+ freenect_set_depth_callback(this, null);
+ this.depthHandler = null;
+ return rval;
+ }
+ }
+
+ private static class EventThread extends Thread {
+ private final NativeContext ctx;
+ private volatile boolean alive = true;
+
+ public EventThread (NativeContext ctx) {
+ this.ctx = ctx;
+ setDaemon(true);
+ setName("FreenectEventThread");
+ }
+
+ public void kill () {
+ this.alive = false;
+ }
+
+ @Override
+ public void run () {
+ while (alive) {
+ freenect_process_events(ctx);
+ }
+ }
+ }
+
+ ;
+
+ protected static class TiltState extends PointerType {
+ public TiltState () {
+ }
+ }
+
+ // function prototypes from libfreenect.h
+ // These must match the names used in the library!
+
+ public interface NativeLogCallback extends Callback {
+ void callback (NativeDevice dev, int logLevel, String msg);
+ }
+
+ private interface NativeDepthCallback extends Callback {
+ void callback (Pointer dev, Pointer depth, int timestamp);
+ }
+
+ ;
+
+ private interface NativeVideoCallback extends Callback {
+ void callback (Pointer dev, Pointer frame, int timestamp);
+ }
+
+ ;
+
+ private static native int freenect_init (PointerByReference ctx, Pointer usb_ctx);
+
+ private static native int freenect_shutdown (NativeContext ctx);
+
+ private static native void freenect_set_log_level (NativeContext ctx, int level);
+
+ private static native void freenect_set_log_callback (NativeContext ctx, NativeLogCallback cb);
+
+ private static native int freenect_process_events (NativeContext ctx);
+
+ private static native int freenect_num_devices (NativeContext ctx);
+
+ private static native int freenect_open_device (NativeContext ctx, PointerByReference dev, int index);
+
+ private static native int freenect_close_device (NativeDevice dev);
+
+ private static native void freenect_set_user (NativeDevice dev, Pointer user);
+
+ private static native Pointer freenect_get_user (NativeDevice dev);
+
+ private static native void freenect_set_depth_callback (NativeDevice dev, NativeDepthCallback cb);
+
+ private static native void freenect_set_video_callback (NativeDevice dev, NativeVideoCallback cb);
+
+ // private static native int freenect_set_depth_format(NativeDevice dev, int i);
+// private static native int freenect_set_video_format(NativeDevice dev, int i);
+ private static native int freenect_set_depth_buffer (NativeDevice dev, ByteBuffer buf);
+
+ private static native int freenect_set_video_buffer (NativeDevice dev, ByteBuffer buf);
+
+ private static native int freenect_start_depth (NativeDevice dev);
+
+ private static native int freenect_start_video (NativeDevice dev);
+
+ private static native int freenect_stop_depth (NativeDevice dev);
+
+ private static native int freenect_stop_video (NativeDevice dev);
+
+ private static native int freenect_update_tilt_state (NativeDevice dev);
+
+ private static native TiltState freenect_get_tilt_state (NativeDevice dev);
+
+ private static native byte freenect_get_tilt_status (TiltState tiltState);
+
+ private static native double freenect_get_tilt_degs (TiltState tiltState);
+
+ private static native int freenect_set_tilt_degs (NativeDevice dev, double angle);
+
+ private static native int freenect_set_led (NativeDevice dev, int option);
+
+ private static native void freenect_get_mks_accel (TiltState tiltState, DoubleBuffer x, DoubleBuffer y,
+ DoubleBuffer z);
+
+ private static native int freenect_select_subdevices (NativeContext ctx, int flag);
+
+ private static native int freenect_get_video_mode_count ();
+
+ private static native VideoFrameMode.VideoFrameModeByValue freenect_get_video_mode (int mode_num);
+
+ private static native VideoFrameMode.VideoFrameModeByValue freenect_get_current_video_mode (NativeDevice dev);
+
+ private static native VideoFrameMode.VideoFrameModeByValue freenect_find_video_mode (int res, int fmt);
+
+ private static native int freenect_set_video_mode (NativeDevice dev, VideoFrameMode.VideoFrameModeByValue mode);
+
+ private static native int freenect_get_depth_mode_count ();
+
+ private static native DepthFrameMode.DepthFrameModeByValue freenect_get_depth_mode (int mode_num);
+
+ private static native DepthFrameMode.DepthFrameModeByValue freenect_get_current_depth_mode (NativeDevice dev);
+
+ private static native DepthFrameMode.DepthFrameModeByValue freenect_find_depth_mode (int res, int fmt);
+
+ private static native int freenect_set_depth_mode (NativeDevice dev, DepthFrameMode.DepthFrameModeByValue mode);
+
}
View
24 wrappers/java/src/main/java/org/openkinect/freenect/LedStatus.java
@@ -1,3 +1,27 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
public enum LedStatus {
View
24 wrappers/java/src/main/java/org/openkinect/freenect/LogHandler.java
@@ -1,3 +1,27 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
public interface LogHandler {
View
24 wrappers/java/src/main/java/org/openkinect/freenect/LogLevel.java
@@ -1,3 +1,27 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
import java.util.HashMap;
View
54 wrappers/java/src/main/java/org/openkinect/freenect/Resolution.java
@@ -0,0 +1,54 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
+ package org.openkinect.freenect;
+
+/**
+ * User: Erwan Daubert - erwan.daubert@gmail.com
+ * Date: 12/08/11
+ * Time: 13:48
+ */
+public enum Resolution {
+ FREENECT_RESOLUTION_LOW (0),
+ FREENECT_RESOLUTION_MEDIUM (1),
+ FREENECT_RESOLUTION_HIGH (2),
+ FREENECT_RESOLUTION_DUMMY (2147483647);
+
+ private int value;
+
+ Resolution (int value) {
+ this.value = value;
+ }
+
+ public int getValue () {
+ return value;
+ }
+}
+
+/*typedef enum {
+ FREENECT_RESOLUTION_LOW = 0, *//**< QVGA - 320x240 *//*
+ FREENECT_RESOLUTION_MEDIUM = 1, *//**< VGA - 640x480 *//*
+ FREENECT_RESOLUTION_HIGH = 2, *//**< SXGA - 1280x1024 *//*
+ FREENECT_RESOLUTION_DUMMY = 2147483647, *//**< Dummy value to force enum to be 32 bits wide *//*
+} freenect_resolution;*/
View
24 wrappers/java/src/main/java/org/openkinect/freenect/TiltStatus.java
@@ -1,3 +1,27 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
import java.util.HashMap;
View
24 wrappers/java/src/main/java/org/openkinect/freenect/VideoFormat.java
@@ -1,3 +1,27 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
View
96 wrappers/java/src/main/java/org/openkinect/freenect/VideoFrameMode.java
@@ -0,0 +1,96 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
+package org.openkinect.freenect;
+
+import com.sun.jna.Structure;
+
+
+/**
+ * User: Erwan Daubert - erwan.daubert@gmail.com
+ * Date: 12/08/11
+ * Time: 13:46
+ */
+public class VideoFrameMode extends Structure {
+ public int reserved;
+ public int resolution;
+// private UnionFormat format;
+ public int bytes;
+ public short width;
+ public short height;
+ public short dataBitsPerPixel;
+ public short paddingBitsPerPixel;
+ public short framerate;
+ public short valid;
+
+ /*private class UnionFormat extends Union {
+ private int dummy;
+ private VideoFormat video_format;
+ private DepthFormat depth_format;
+
+
+ }*/
+
+ public VideoFrameMode () {
+ }
+
+ public VideoFrameMode (int reserved, int resolution/*, UnionFormat format*/, int bytes, short width, short height,
+ short dataBitsPerPixel, short paddingBitsPerPixel, short framerate, short valid) {
+ this.reserved = reserved;
+ this.resolution = resolution;
+// this.format = format;
+ this.bytes = bytes;
+ this.width = width;
+ this.height = height;
+ this.dataBitsPerPixel = dataBitsPerPixel;
+ this.paddingBitsPerPixel = paddingBitsPerPixel;
+ this.framerate = framerate;
+ this.valid = valid;
+ }
+
+
+ public static class VideoFrameModeByReference extends VideoFrameMode implements Structure.ByReference {
+
+ }
+ public static class VideoFrameModeByValue extends VideoFrameMode implements Structure.ByValue {
+
+ }
+}
+
+/*typedef struct {
+ uint32_t reserved; *//**< unique ID used internally. The meaning of values may change without notice. Don't touch or depend on the contents of this field. We mean it. *//*
+ freenect_resolution resolution; *//**< Resolution this freenect_frame_mode describes, should you want to find it again with freenect_find_*_frame_mode(). *//*
+ union {
+ int32_t dummy;
+ freenect_video_format video_format;
+ freenect_depth_format depth_format;
+ }; *//**< The video or depth format that this freenect_frame_mode describes. The caller should know which of video_format or depth_format to use, since they called freenect_get_*_frame_mode() *//*
+ int32_t bytes; *//**< Total buffer size in bytes to hold a single frame of data. Should be equivalent to width * height * (data_bits_per_pixel+padding_bits_per_pixel) / 8 *//*
+ int16_t width; *//**< Width of the frame, in pixels *//*
+ int16_t height; *//**< Height of the frame, in pixels *//*
+ int8_t data_bits_per_pixel; *//**< Number of bits of information needed for each pixel *//*
+ int8_t padding_bits_per_pixel; *//**< Number of bits of padding for alignment used for each pixel *//*
+ int8_t framerate; *//**< Approximate expected frame rate, in Hz *//*
+ int8_t is_valid; *//**< If 0, this freenect_frame_mode is invalid and does not describe a supported mode. Otherwise, the frame_mode is valid. *//*
+} freenect_frame_mode;*/
View
24 wrappers/java/src/main/java/org/openkinect/freenect/VideoHandler.java
@@ -1,3 +1,27 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect;
import java.nio.ByteBuffer;
View
32 wrappers/java/src/main/java/org/openkinect/freenect/util/Jdk14LogHandler.java
@@ -1,13 +1,37 @@
+/**
+ * This file is part of the OpenKinect Project. http://www.openkinect.org
+ *
+ * Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
+ * for details.
+ *
+ * This code is licensed to you under the terms of the Apache License, version
+ * 2.0, or, at your option, the terms of the GNU General Public License,
+ * version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
+ * or the following URLs:
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.gnu.org/licenses/gpl-2.0.txt
+ *
+ * If you redistribute this file in source form, modified or unmodified,
+ * you may:
+ * 1) Leave this header intact and distribute it under the same terms,
+ * accompanying it with the APACHE20 and GPL20 files, or
+ * 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
+ * 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
+ * In all cases you must keep the copyright notice intact and include a copy
+ * of the CONTRIB file.
+ * Binary distributions must follow the binary distribution requirements of
+ * either License.
+ */
package org.openkinect.freenect.util;
-import java.util.EnumMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.openkinect.freenect.Device;
import org.openkinect.freenect.LogHandler;
import org.openkinect.freenect.LogLevel;
+import java.util.EnumMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
public class Jdk14LogHandler implements LogHandler {
private final Logger logger = Logger.getLogger("freenect");
Please sign in to comment.
Something went wrong with that request. Please try again.