libfreenect  0.1-beta
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 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #define FREENECT_COUNTS_PER_G 819
38 
39 #define FREENECT_DEPTH_MM_MAX_VALUE 10000
40 
41 #define FREENECT_DEPTH_MM_NO_VALUE 0
42 
43 #define FREENECT_DEPTH_RAW_MAX_VALUE 2048
44 
45 #define FREENECT_DEPTH_RAW_NO_VALUE 2047
46 
52 typedef enum {
57 
64  const char* camera_serial;
65 };
66 
71 typedef enum {
77 
80 typedef enum {
88  FREENECT_VIDEO_DUMMY = 2147483647,
90 
93 typedef enum {
100  FREENECT_DEPTH_DUMMY = 2147483647,
102 
106 typedef struct {
107  uint32_t reserved;
109  union {
110  int32_t dummy;
113  };
114  int32_t bytes;
115  int16_t width;
116  int16_t height;
119  int8_t framerate;
120  int8_t is_valid;
122 
125 typedef enum {
126  LED_OFF = 0,
127  LED_GREEN = 1,
128  LED_RED = 2,
131  // 5 is same as 4, LED blink Green
134 
135 
137 typedef enum {
142 
144 typedef struct {
145  int16_t accelerometer_x;
146  int16_t accelerometer_y;
147  int16_t accelerometer_z;
148  int8_t tilt_angle;
151 
152 struct _freenect_context;
153 typedef struct _freenect_context freenect_context;
155 struct _freenect_device;
156 typedef struct _freenect_device freenect_device;
158 // usb backend specific section
159 #ifdef _WIN32
160  /* frees Windows users of the burden of specifying the path to <libusb-1.0/libusb.h> */
161  typedef void freenect_usb_context;
162 #else
163  #include <libusb-1.0/libusb.h>
164  typedef libusb_context freenect_usb_context;
165 #endif
166 //
167 
169 #ifndef _WIN32
170  #define FREENECTAPI
171 #else
172 
173  #ifdef __cplusplus
174  #define FREENECTAPI extern "C" __declspec(dllexport)
175  #else
176  // this is required when building from a Win32 port of gcc without being
177  // forced to compile all of the library files (.c) with g++...
178  #define FREENECTAPI __declspec(dllexport)
179  #endif
180 #endif
181 
183 typedef enum {
193 
203 FREENECTAPI int freenect_init(freenect_context **ctx, freenect_usb_context *usb_ctx);
204 
213 
215 typedef void (*freenect_log_cb)(freenect_context *dev, freenect_loglevel level, const char *msg);
216 
224 
233 
242 
253 FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval* timeout);
254 
264 
275 
282 
292 
304 
317 
329 FREENECTAPI int freenect_open_device_by_camera_serial(freenect_context *ctx, freenect_device **dev, const char* camera_serial);
330 
339 
347 FREENECTAPI void freenect_set_user(freenect_device *dev, void *user);
348 
357 
359 typedef void (*freenect_depth_cb)(freenect_device *dev, void *depth, uint32_t timestamp);
361 typedef void (*freenect_video_cb)(freenect_device *dev, void *video, uint32_t timestamp);
362 
370 
378 
390 
402 
411 
420 
429 
438 
449 
458 
467 
480 FREENECTAPI int freenect_set_tilt_degs(freenect_device *dev, double angle);
481 
491 
502 
514 FREENECTAPI void freenect_get_mks_accel(freenect_raw_tilt_state *state, double* x, double* y, double* z);
515 
522 
532 
542 
553 
567 
574 
584 
594 
605 
616 
617 #ifdef __cplusplus
618 }
619 #endif
620 
621 #endif //
622