Skip to content

Commit 53e8aa2

Browse files
edaubertzarvox
authored andcommitted
Fix the java wrapper
Signed-off-by: Erwan Daubert <[email protected]>
1 parent ed5081f commit 53e8aa2

16 files changed

+920
-338
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ obj/
2929
_ReSharper*/
3030
[Tt]est[Rr]esult*
3131
build
32+
/results/

wrappers/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/test/

wrappers/java/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
.project
33
.settings/
44
target/
5+
/freenect.iml
6+
/freenect.ipr
7+
/freenect.iws
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* This file is part of the OpenKinect Project. http://www.openkinect.org
3+
*
4+
* Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
5+
* for details.
6+
*
7+
* This code is licensed to you under the terms of the Apache License, version
8+
* 2.0, or, at your option, the terms of the GNU General Public License,
9+
* version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
10+
* or the following URLs:
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
* http://www.gnu.org/licenses/gpl-2.0.txt
13+
*
14+
* If you redistribute this file in source form, modified or unmodified,
15+
* you may:
16+
* 1) Leave this header intact and distribute it under the same terms,
17+
* accompanying it with the APACHE20 and GPL20 files, or
18+
* 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
19+
* 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
20+
* In all cases you must keep the copyright notice intact and include a copy
21+
* of the CONTRIB file.
22+
* Binary distributions must follow the binary distribution requirements of
23+
* either License.
24+
*/
25+
package org.openkinect.freenect;
26+
27+
import com.sun.jna.Structure;
28+
29+
30+
/**
31+
* User: Erwan Daubert - [email protected]
32+
* Date: 12/08/11
33+
* Time: 13:46
34+
*/
35+
public class DepthFrameMode extends Structure {
36+
public int reserved;
37+
public int resolution;
38+
// public DepthFormat format;
39+
public int bytes;
40+
public short width;
41+
public short height;
42+
public short dataBitsPerPixel;
43+
public short paddingBitsPerPixel;
44+
public short framerate;
45+
public short valid;
46+
47+
public DepthFrameMode () {
48+
}
49+
50+
public DepthFrameMode (int reserved, int resolution/*, DepthFormat format*/, int bytes, short width,
51+
short height,
52+
short dataBitsPerPixel, short paddingBitsPerPixel, short framerate, short valid) {
53+
this.reserved = reserved;
54+
this.resolution = resolution;
55+
// this.format = format;
56+
this.bytes = bytes;
57+
this.width = width;
58+
this.height = height;
59+
this.dataBitsPerPixel = dataBitsPerPixel;
60+
this.paddingBitsPerPixel = paddingBitsPerPixel;
61+
this.framerate = framerate;
62+
this.valid = valid;
63+
}
64+
65+
66+
public static class DepthFrameModeByReference extends DepthFrameMode implements Structure.ByReference {
67+
68+
}
69+
public static class DepthFrameModeByValue extends DepthFrameMode implements Structure.ByValue {
70+
71+
}
72+
}
73+
74+
/*typedef struct {
75+
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. *//*
76+
freenect_resolution resolution; *//**< Resolution this freenect_frame_mode describes, should you want to find it again with freenect_find_*_frame_mode(). *//*
77+
union {
78+
int32_t dummy;
79+
freenect_video_format video_format;
80+
freenect_depth_format depth_format;
81+
}; *//**< 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() *//*
82+
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 *//*
83+
int16_t width; *//**< Width of the frame, in pixels *//*
84+
int16_t height; *//**< Height of the frame, in pixels *//*
85+
int8_t data_bits_per_pixel; *//**< Number of bits of information needed for each pixel *//*
86+
int8_t padding_bits_per_pixel; *//**< Number of bits of padding for alignment used for each pixel *//*
87+
int8_t framerate; *//**< Approximate expected frame rate, in Hz *//*
88+
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. *//*
89+
} freenect_frame_mode;*/

wrappers/java/src/main/java/org/openkinect/freenect/Device.java

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1-
package org.openkinect.freenect;
2-
3-
1+
/**
2+
* This file is part of the OpenKinect Project. http://www.openkinect.org
3+
*
4+
* Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
5+
* for details.
6+
*
7+
* This code is licensed to you under the terms of the Apache License, version
8+
* 2.0, or, at your option, the terms of the GNU General Public License,
9+
* version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
10+
* or the following URLs:
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
* http://www.gnu.org/licenses/gpl-2.0.txt
13+
*
14+
* If you redistribute this file in source form, modified or unmodified,
15+
* you may:
16+
* 1) Leave this header intact and distribute it under the same terms,
17+
* accompanying it with the APACHE20 and GPL20 files, or
18+
* 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
19+
* 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
20+
* In all cases you must keep the copyright notice intact and include a copy
21+
* of the CONTRIB file.
22+
* Binary distributions must follow the binary distribution requirements of
23+
* either License.
24+
*/
25+
package org.openkinect.freenect;
426

527
public interface Device {
628
double[] getAccel();
@@ -9,7 +31,10 @@ public interface Device {
931
double getTiltAngle();
1032
int setTiltAngle(double angle);
1133
TiltStatus getTiltStatus();
34+
void setResolution(Resolution res);
35+
//void setDepthFormat(DepthFrameMode mode);
1236
void setDepthFormat(DepthFormat fmt);
37+
//void setVideoFormat(VideoFrameMode mode);
1338
void setVideoFormat(VideoFormat fmt);
1439
int startDepth(DepthHandler handler);
1540
int startVideo(VideoHandler handler);
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* This file is part of the OpenKinect Project. http://www.openkinect.org
3+
*
4+
* Copyright (c) 2010 individual OpenKinect contributors. See the CONTRIB file
5+
* for details.
6+
*
7+
* This code is licensed to you under the terms of the Apache License, version
8+
* 2.0, or, at your option, the terms of the GNU General Public License,
9+
* version 2.0. See the APACHE20 and GPL20 files for the text of the licenses,
10+
* or the following URLs:
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
* http://www.gnu.org/licenses/gpl-2.0.txt
13+
*
14+
* If you redistribute this file in source form, modified or unmodified,
15+
* you may:
16+
* 1) Leave this header intact and distribute it under the same terms,
17+
* accompanying it with the APACHE20 and GPL20 files, or
18+
* 2) Delete the Apache 2.0 clause and accompany it with the GPL20 file, or
19+
* 3) Delete the GPL v2.0 clause and accompany it with the APACHE20 file
20+
* In all cases you must keep the copyright notice intact and include a copy
21+
* of the CONTRIB file.
22+
* Binary distributions must follow the binary distribution requirements of
23+
* either License.
24+
*/
25+
package org.openkinect.freenect;
26+
27+
/**
28+
* User: Erwan Daubert - [email protected]
29+
* Date: 12/08/11
30+
* Time: 13:40
31+
*/
32+
public enum Flags {
33+
FREENECT_DEVICE_MOTOR(0x01),
34+
FREENECT_DEVICE_CAMERA(0x02),
35+
FREENECT_DEVICE_AUDIO(0x04),;
36+
37+
private int value;
38+
39+
Flags (int value) {
40+
this.value = value;
41+
}
42+
43+
public int getValue () {
44+
return value;
45+
}
46+
}
47+
/*typedef enum {
48+
FREENECT_DEVICE_MOTOR = 0x01,
49+
FREENECT_DEVICE_CAMERA = 0x02,
50+
FREENECT_DEVICE_AUDIO = 0x04,
51+
} freenect_device_flags;*/

0 commit comments

Comments
 (0)