libfreenect  0.1.2
libfreenect.h
Go to the documentation of this file.
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 GPL2 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, you
15  * 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 GPL2 file, or
19  * 3) Delete the GPL v2 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  *
23  * Binary distributions must follow the binary distribution requirements of
24  * either License.
25  */
26 
27 #ifndef LIBFREENECT_H
28 #define LIBFREENECT_H
29 
30 #include <stdint.h>
31 
32 /* We need struct timeval */
33 #ifdef _WIN32
34 #include <winsock.h>
35 #else
36 #include <sys/time.h>
37 #endif
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #define FREENECT_COUNTS_PER_G 819
45 
46 #define FREENECT_DEPTH_MM_MAX_VALUE 10000
47 
48 #define FREENECT_DEPTH_MM_NO_VALUE 0
49 
50 #define FREENECT_DEPTH_RAW_MAX_VALUE 2048
51 
52 #define FREENECT_DEPTH_RAW_NO_VALUE 2047
53 
59 typedef enum {
64 
71  const char* camera_serial;
72 };
73 
78 typedef enum {
84 
87 typedef enum {
95  FREENECT_VIDEO_DUMMY = 2147483647,
97 
100 typedef enum {
107  FREENECT_DEPTH_DUMMY = 2147483647,
109 
113 typedef struct {
114  uint32_t reserved;
116  union {
117  int32_t dummy;
120  };
121  int32_t bytes;
122  int16_t width;
123  int16_t height;
126  int8_t framerate;
127  int8_t is_valid;
129 
132 typedef enum {
133  LED_OFF = 0,
134  LED_GREEN = 1,
135  LED_RED = 2,
138  // 5 is same as 4, LED blink Green
141 
142 
144 typedef enum {
149 
151 typedef struct {
152  int16_t accelerometer_x;
153  int16_t accelerometer_y;
154  int16_t accelerometer_z;
155  int8_t tilt_angle;
158 
159 struct _freenect_context;
160 typedef struct _freenect_context freenect_context;
162 struct _freenect_device;
163 typedef struct _freenect_device freenect_device;
165 // usb backend specific section
166 typedef void freenect_usb_context;
167 //
168 
170 #ifndef _WIN32
171  #define FREENECTAPI
172 #else
173 
174  #ifdef __cplusplus
175  #define FREENECTAPI extern "C" __declspec(dllexport)
176  #else
177  // this is required when building from a Win32 port of gcc without being
178  // forced to compile all of the library files (.c) with g++...
179  #define FREENECTAPI __declspec(dllexport)
180  #endif
181 #endif
182 
184 typedef enum {
194 
204 FREENECTAPI int freenect_init(freenect_context **ctx, freenect_usb_context *usb_ctx);
205 
214 
216 typedef void (*freenect_log_cb)(freenect_context *dev, freenect_loglevel level, const char *msg);
217 
225 
234 
243 
254 FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval* timeout);
255 
265 
276 
283 
293 
305 
318 
330 FREENECTAPI int freenect_open_device_by_camera_serial(freenect_context *ctx, freenect_device **dev, const char* camera_serial);
331 
340 
348 FREENECTAPI void freenect_set_user(freenect_device *dev, void *user);
349 
358 
360 typedef void (*freenect_depth_cb)(freenect_device *dev, void *depth, uint32_t timestamp);
362 typedef void (*freenect_video_cb)(freenect_device *dev, void *video, uint32_t timestamp);
363 
371 
379 
391 
403 
412 
421 
430 
439 
450 
459 
468 
481 FREENECTAPI int freenect_set_tilt_degs(freenect_device *dev, double angle);
482 
492 
503 
515 FREENECTAPI void freenect_get_mks_accel(freenect_raw_tilt_state *state, double* x, double* y, double* z);
516 
523 
533 
543 
554 
568 
575 
585 
595 
606 
617 
618 #ifdef __cplusplus
619 }
620 #endif
621 
622 #endif //
623