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 #pragma once
28 
29 #include <stdint.h>
30 
31 /* We need struct timeval */
32 #ifdef _WIN32
33 #include <winsock.h>
34 #else
35 #include <sys/time.h>
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 #define FREENECT_COUNTS_PER_G 819
44 #define FREENECT_DEPTH_MM_MAX_VALUE 10000
46 #define FREENECT_DEPTH_MM_NO_VALUE 0
48 #define FREENECT_DEPTH_RAW_MAX_VALUE 2048
50 #define FREENECT_DEPTH_RAW_NO_VALUE 2047
52 
58 typedef enum {
63 
70  const char* camera_serial;
71 };
72 
77 typedef enum {
83 
86 typedef enum {
94  FREENECT_VIDEO_DUMMY = 2147483647,
96 
99 typedef enum {
106  FREENECT_DEPTH_DUMMY = 2147483647,
108 
110 typedef enum {
111  // values written to the CMOS register
115  // registers to be written with 0 or 1
118 } freenect_flag;
119 
121 typedef enum {
125 
129 typedef struct {
130  uint32_t reserved;
132  union {
133  int32_t dummy;
136  };
137  int32_t bytes;
138  int16_t width;
139  int16_t height;
142  int8_t framerate;
143  int8_t is_valid;
145 
148 typedef enum {
149  LED_OFF = 0,
150  LED_GREEN = 1,
151  LED_RED = 2,
154  // 5 is same as 4, LED blink Green
157 
158 
160 typedef enum {
165 
167 typedef struct {
168  int16_t accelerometer_x;
169  int16_t accelerometer_y;
170  int16_t accelerometer_z;
171  int8_t tilt_angle;
174 
175 struct _freenect_context;
176 typedef struct _freenect_context freenect_context;
178 struct _freenect_device;
179 typedef struct _freenect_device freenect_device;
181 // usb backend specific section
182 typedef void freenect_usb_context;
183 //
184 
186 #ifndef _WIN32
187  #define FREENECTAPI
188 #else
189 
190  #ifdef __cplusplus
191  #define FREENECTAPI extern "C" __declspec(dllexport)
192  #else
193  // this is required when building from a Win32 port of gcc without being
194  // forced to compile all of the library files (.c) with g++...
195  #define FREENECTAPI __declspec(dllexport)
196  #endif
197 #endif
198 
200 typedef enum {
210 
220 FREENECTAPI int freenect_init(freenect_context **ctx, freenect_usb_context *usb_ctx);
221 
230 
232 typedef void (*freenect_log_cb)(freenect_context *dev, freenect_loglevel level, const char *msg);
233 
241 
250 
259 
270 FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval* timeout);
271 
281 
292 
299 
309 
321 
330 
343 
355 FREENECTAPI int freenect_open_device_by_camera_serial(freenect_context *ctx, freenect_device **dev, const char* camera_serial);
356 
365 
373 FREENECTAPI void freenect_set_user(freenect_device *dev, void *user);
374 
383 
385 typedef void (*freenect_depth_cb)(freenect_device *dev, void *depth, uint32_t timestamp);
387 typedef void (*freenect_video_cb)(freenect_device *dev, void *video, uint32_t timestamp);
388 
396 
404 
416 
428 
437 
446 
455 
464 
475 
484 
493 
506 FREENECTAPI int freenect_set_tilt_degs(freenect_device *dev, double angle);
507 
517 
528 
540 FREENECTAPI void freenect_get_mks_accel(freenect_raw_tilt_state *state, double* x, double* y, double* z);
541 
548 
558 
568 
579 
593 
600 
610 
620 
631 
642 
652 
653 #ifdef __cplusplus
654 }
655 #endif