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 
68 {
69  struct freenect_device_attributes *next; // Next device in the linked list
70  const char* camera_serial; // Serial number of camera or audio subdevice
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  // arbitrary bitfields to support flag combination
118 } freenect_flag;
119 
121 typedef enum {
125 
129 typedef struct {
132  union {
136  };
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 {
174 
175 struct _freenect_context;
178 struct _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 
240 FREENECTAPI void freenect_set_log_level(freenect_context *ctx, freenect_loglevel level);
241 
250 
259 
270 FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval* timeout);
271 
281 
292 
299 
309 
321 
330 
343 
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);
389 typedef void (*freenect_chunk_cb)(void *buffer, void *pkt_data, int pkt_num, int datalen, void *user_data);
390 
391 
399 
407 
415 
423 
435 
447 
456 
465 
474 
483 
494 
503 
512 
525 FREENECTAPI int freenect_set_tilt_degs(freenect_device *dev, double angle);
526 
536 
547 
559 FREENECTAPI void freenect_get_mks_accel(freenect_raw_tilt_state *state, double* x, double* y, double* z);
560 
567 
577 
587 
598 
612 
619 
629 
639 
650 
661 
671 
672 
680 FREENECTAPI void freenect_set_fw_address_nui(freenect_context * ctx, unsigned char * fw_ptr, unsigned int num_bytes);
681 
689 FREENECTAPI void freenect_set_fw_address_k4w(freenect_context * ctx, unsigned char * fw_ptr, unsigned int num_bytes);
690 
691 
692 #ifdef __cplusplus
693 }
694 #endif
FREENECTAPI int freenect_set_video_mode(freenect_device *dev, freenect_frame_mode mode)
Definition: fakenect.c:246
FREENECTAPI void freenect_set_log_level(freenect_context *ctx, freenect_loglevel level)
Definition: fakenect.c:401
FREENECTAPI int freenect_set_tilt_degs(freenect_device *dev, double angle)
Definition: fakenect.c:410
FREENECTAPI int freenect_set_depth_buffer(freenect_device *dev, void *buf)
Definition: fakenect.c:343
FREENECTAPI int freenect_open_device(freenect_context *ctx, freenect_device **dev, int index)
Definition: fakenect.c:314
FREENECTAPI int freenect_update_tilt_state(freenect_device *dev)
Definition: fakenect.c:418
freenect_flag
Enumeration of flags to toggle features with freenect_set_flag()
Definition: libfreenect.h:110
#define FREENECTAPI
If Win32, export all functions for DLL usage.
Definition: libfreenect.h:187
FREENECTAPI int freenect_get_video_mode_count()
Definition: fakenect.c:269
FREENECTAPI int freenect_process_events_timeout(freenect_context *ctx, struct timeval *timeout)
Definition: fakenect.c:206
freenect_flag_value
Possible values for setting each freenect_flag
Definition: libfreenect.h:121
short int16_t
FREENECTAPI freenect_frame_mode freenect_find_depth_mode(freenect_resolution res, freenect_depth_format fmt)
Definition: fakenect.c:284
freenect_video_format
Definition: libfreenect.h:86
FREENECTAPI void freenect_get_mks_accel(freenect_raw_tilt_state *state, double *x, double *y, double *z)
Definition: fakenect.c:227
FREENECTAPI void freenect_set_fw_address_nui(freenect_context *ctx, unsigned char *fw_ptr, unsigned int num_bytes)
Definition: core.c:286
void freenect_usb_context
Definition: libfreenect.h:182
FREENECTAPI freenect_tilt_status_code freenect_get_tilt_status(freenect_raw_tilt_state *state)
Definition: fakenect.c:222
int8_t data_bits_per_pixel
Definition: libfreenect.h:140
FREENECTAPI void freenect_free_device_attributes(struct freenect_device_attributes *attribute_list)
Definition: core.c:112
FREENECTAPI int freenect_set_led(freenect_device *dev, freenect_led_options option)
Definition: fakenect.c:414
FREENECTAPI int freenect_start_depth(freenect_device *dev)
Definition: fakenect.c:365
const char * camera_serial
Definition: libfreenect.h:70
freenect_tilt_status_code tilt_status
Definition: libfreenect.h:172
FREENECTAPI freenect_raw_tilt_state * freenect_get_tilt_state(freenect_device *dev)
Definition: fakenect.c:217
FREENECTAPI freenect_frame_mode freenect_find_video_mode(freenect_resolution res, freenect_video_format fmt)
Definition: fakenect.c:260
FREENECTAPI int freenect_close_device(freenect_device *dev)
Definition: fakenect.c:406
FREENECTAPI double freenect_get_tilt_degs(freenect_raw_tilt_state *state)
Definition: fakenect.c:211
signed char int8_t
FREENECTAPI int freenect_get_depth_mode_count()
Definition: fakenect.c:293
void(* freenect_depth_cb)(freenect_device *dev, void *depth, uint32_t timestamp)
Typedef for depth image received event callbacks.
Definition: libfreenect.h:385
FREENECTAPI int freenect_open_device_by_camera_serial(freenect_context *ctx, freenect_device **dev, const char *camera_serial)
Definition: fakenect.c:321
FREENECTAPI int freenect_set_video_buffer(freenect_device *dev, void *buf)
Definition: fakenect.c:349
FREENECTAPI void freenect_set_depth_chunk_callback(freenect_device *dev, freenect_chunk_cb cb)
Definition: cameras.c:1102
FREENECTAPI int freenect_set_flag(freenect_device *dev, freenect_flag flag, freenect_flag_value value)
Definition: flags.c:48
FREENECTAPI int freenect_set_depth_mode(freenect_device *dev, const freenect_frame_mode mode)
Definition: fakenect.c:253
freenect_depth_format
Definition: libfreenect.h:99
FREENECTAPI int freenect_num_devices(freenect_context *ctx)
Definition: fakenect.c:308
freenect_loglevel
Enumeration of message logging levels.
Definition: libfreenect.h:200
FREENECTAPI void freenect_set_user(freenect_device *dev, void *user)
Definition: fakenect.c:355
FREENECTAPI int freenect_stop_video(freenect_device *dev)
Definition: fakenect.c:383
FREENECTAPI void freenect_set_fw_address_k4w(freenect_context *ctx, unsigned char *fw_ptr, unsigned int num_bytes)
Definition: core.c:292
FREENECTAPI int freenect_list_device_attributes(freenect_context *ctx, struct freenect_device_attributes **attribute_list)
Definition: core.c:107
int int32_t
FREENECTAPI freenect_frame_mode freenect_get_depth_mode(int mode_num)
Definition: fakenect.c:298
FREENECTAPI int freenect_process_events(freenect_context *ctx)
Definition: fakenect.c:140
freenect_led_options
Definition: libfreenect.h:148
FREENECTAPI void freenect_set_video_callback(freenect_device *dev, freenect_video_cb cb)
Definition: fakenect.c:241
FREENECTAPI freenect_frame_mode freenect_get_current_depth_mode(freenect_device *dev)
Definition: fakenect.c:303
FREENECTAPI int freenect_stop_depth(freenect_device *dev)
Definition: fakenect.c:377
struct freenect_device_attributes * next
Definition: libfreenect.h:69
void(* freenect_log_cb)(freenect_context *dev, freenect_loglevel level, const char *msg)
Typedef for logging callback functions.
Definition: libfreenect.h:232
FREENECTAPI void freenect_set_depth_callback(freenect_device *dev, freenect_depth_cb cb)
Definition: fakenect.c:236
FREENECTAPI freenect_frame_mode freenect_get_video_mode(int mode_num)
Definition: fakenect.c:274
FREENECTAPI int freenect_start_video(freenect_device *dev)
Definition: fakenect.c:371
FREENECTAPI int freenect_init(freenect_context **ctx, freenect_usb_context *usb_ctx)
Definition: fakenect.c:327
freenect_resolution
Definition: libfreenect.h:77
FREENECTAPI freenect_device_flags freenect_enabled_subdevices(freenect_context *ctx)
Definition: core.c:138
typedef void(ONI_CALLBACK_TYPE *DeviceConnectedCallback)(const OniDeviceInfo *
static freenect_context * ctx
Data from the tilt motor and accelerometer.
Definition: libfreenect.h:167
FREENECTAPI void freenect_select_subdevices(freenect_context *ctx, freenect_device_flags subdevs)
Definition: fakenect.c:338
FREENECTAPI int freenect_shutdown(freenect_context *ctx)
Definition: fakenect.c:402
FREENECTAPI int freenect_supported_subdevices(void)
Definition: fakenect.c:333
unsigned int uint32_t
FREENECTAPI void freenect_set_log_callback(freenect_context *ctx, freenect_log_cb cb)
Definition: fakenect.c:400
int8_t padding_bits_per_pixel
Definition: libfreenect.h:141
capture state
Definition: micview.c:53
freenect_device_flags
Definition: libfreenect.h:58
freenect_resolution resolution
Definition: libfreenect.h:131
FREENECTAPI void freenect_set_video_chunk_callback(freenect_device *dev, freenect_chunk_cb cb)
Definition: cameras.c:1107
void(* freenect_chunk_cb)(void *buffer, void *pkt_data, int pkt_num, int datalen, void *user_data)
Typedef for stream chunk processing callbacks.
Definition: libfreenect.h:389
freenect_depth_format depth_format
Definition: libfreenect.h:135
void(* freenect_video_cb)(freenect_device *dev, void *video, uint32_t timestamp)
Typedef for video image received event callbacks.
Definition: libfreenect.h:387
freenect_tilt_status_code
Enumeration of tilt motor status.
Definition: libfreenect.h:160
FREENECTAPI void * freenect_get_user(freenect_device *dev)
Definition: fakenect.c:360
freenect_video_format video_format
Definition: libfreenect.h:134
FREENECTAPI freenect_frame_mode freenect_get_current_video_mode(freenect_device *dev)
Definition: fakenect.c:279


libfreenect
Author(s): Hector Martin, Josh Blake, Kyle Machulis, OpenKinect community
autogenerated on Thu Jun 6 2019 19:25:38