Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ obj/
_ReSharper*/
[Tt]est[Rr]esult*
build
/results/
1 change: 1 addition & 0 deletions README.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ directory for them:
- python
- actionscript
- C#
- Java (JNA)

=== Licensing

Expand Down
1 change: 1 addition & 0 deletions wrappers/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/test/
3 changes: 3 additions & 0 deletions wrappers/java/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.project
.settings/
target/
/freenect.iml
/freenect.ipr
/freenect.iws
26 changes: 25 additions & 1 deletion wrappers/java/src/main/java/org/openkinect/freenect/Context.java
Original file line number Diff line number Diff line change
@@ -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 Context {
Expand All @@ -6,4 +30,4 @@ public interface Context {
void setLogLevel(LogLevel level);
Device openDevice(int index);
void shutdown();
}
}
Original file line number Diff line number Diff line change
@@ -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;


Expand Down Expand Up @@ -29,4 +53,4 @@ public int getHeight() {
public int getFrameSize() {
return frameSize;
}
}
}
Original file line number Diff line number Diff line change
@@ -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;*/
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
/**
* 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;

public interface DepthHandler {
void onFrameReceived(DepthFormat format, ByteBuffer frame, int timestamp);
}
}
31 changes: 28 additions & 3 deletions wrappers/java/src/main/java/org/openkinect/freenect/Device.java
Original file line number Diff line number Diff line change
@@ -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();
Expand All @@ -9,7 +31,10 @@ public interface Device {
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);
Expand Down
51 changes: 51 additions & 0 deletions wrappers/java/src/main/java/org/openkinect/freenect/Flags.java
Original file line number Diff line number Diff line change
@@ -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;*/
Loading