Functions
core.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include "freenect_internal.h"
#include "registration.h"
#include "cameras.h"
#include "loader.h"
Include dependency graph for core.c:

Go to the source code of this file.

Functions

FN_INTERNAL void fn_log (freenect_context *ctx, freenect_loglevel level, const char *fmt,...)
 
FREENECTAPI int freenect_close_device (freenect_device *dev)
 
FREENECTAPI freenect_device_flags freenect_enabled_subdevices (freenect_context *ctx)
 
FREENECTAPI void freenect_free_device_attributes (struct freenect_device_attributes *attribute_list)
 
FREENECTAPI void * freenect_get_user (freenect_device *dev)
 
FREENECTAPI int freenect_init (freenect_context **ctx, freenect_usb_context *usb_ctx)
 
FREENECTAPI int freenect_list_device_attributes (freenect_context *ctx, struct freenect_device_attributes **attribute_list)
 
FREENECTAPI int freenect_num_devices (freenect_context *ctx)
 
FREENECTAPI int freenect_open_device (freenect_context *ctx, freenect_device **dev, int index)
 
FREENECTAPI int freenect_open_device_by_camera_serial (freenect_context *ctx, freenect_device **dev, const char *camera_serial)
 
FREENECTAPI int freenect_process_events (freenect_context *ctx)
 
FREENECTAPI int freenect_process_events_timeout (freenect_context *ctx, struct timeval *timeout)
 
FREENECTAPI void freenect_select_subdevices (freenect_context *ctx, freenect_device_flags subdevs)
 
FREENECTAPI void freenect_set_fw_address_k4w (freenect_context *ctx, unsigned char *fw_ptr, unsigned int num_bytes)
 
FREENECTAPI void freenect_set_fw_address_nui (freenect_context *ctx, unsigned char *fw_ptr, unsigned int num_bytes)
 
FREENECTAPI void freenect_set_log_callback (freenect_context *ctx, freenect_log_cb cb)
 
FREENECTAPI void freenect_set_log_level (freenect_context *ctx, freenect_loglevel level)
 
FREENECTAPI void freenect_set_user (freenect_device *dev, void *user)
 
FREENECTAPI int freenect_shutdown (freenect_context *ctx)
 
FREENECTAPI int freenect_supported_subdevices (void)
 

Function Documentation

FN_INTERNAL void fn_log ( freenect_context ctx,
freenect_loglevel  level,
const char *  fmt,
  ... 
)

Definition at line 262 of file core.c.

FREENECTAPI int freenect_close_device ( freenect_device dev)

Closes a device that is currently open

Parameters
devDevice to close
Returns
0 on success

Definition at line 205 of file core.c.

FREENECTAPI freenect_device_flags freenect_enabled_subdevices ( freenect_context ctx)

Returns the devices that are enabled after calls to freenect_open_device() On newer kinects the motor and audio are automatically disabled for now

Parameters
ctxContext to set future subdevice selection for
Returns
Flags representing the subdevices that were actually opened (see freenect_device_flags)

Definition at line 138 of file core.c.

FREENECTAPI void freenect_free_device_attributes ( struct freenect_device_attributes attribute_list)

Free the linked list produced by freenect_list_device_attributes().

Parameters
attribute_listLinked list of attributes to free.

Definition at line 112 of file core.c.

FREENECTAPI void* freenect_get_user ( freenect_device dev)

Retrieve the pointer to user data from the device struct

Parameters
devDevice from which to get user data
Returns
Pointer to user data

Definition at line 247 of file core.c.

FREENECTAPI int freenect_init ( freenect_context **  ctx,
freenect_usb_context usb_ctx 
)

Initialize a freenect context and do any setup required for platform specific USB libraries.

Parameters
ctxAddress of pointer to freenect context struct to allocate and initialize
usb_ctxUSB context to initialize. Can be NULL if not using multiple contexts.
Returns
0 on success, < 0 on error

Definition at line 40 of file core.c.

FREENECTAPI int freenect_list_device_attributes ( freenect_context ctx,
struct freenect_device_attributes **  attribute_list 
)

Scans for kinect devices and produces a linked list of their attributes (namely, serial numbers), returning the number of devices.

Parameters
ctxContext to scan for kinect devices with
attribute_listPointer to where this function will store the resultant linked list
Returns
Number of devices connected, < 0 on error

Definition at line 107 of file core.c.

FREENECTAPI int freenect_num_devices ( freenect_context ctx)

Return the number of kinect devices currently connected to the system

Parameters
ctxContext to access device count through
Returns
Number of devices connected, < 0 on error

Definition at line 102 of file core.c.

FREENECTAPI int freenect_open_device ( freenect_context ctx,
freenect_device **  dev,
int  index 
)

Opens a kinect device via a context. Index specifies the index of the device on the current state of the bus. Bus resets may cause indexes to shift.

Parameters
ctxContext to open device through
devDevice structure to assign opened device to
indexIndex of the device on the bus
Returns
0 on success, < 0 on error

Definition at line 143 of file core.c.

FREENECTAPI int freenect_open_device_by_camera_serial ( freenect_context ctx,
freenect_device **  dev,
const char *  camera_serial 
)

Opens a kinect device (via a context) associated with a particular camera subdevice serial number. This function will fail if no device with a matching serial number is found.

Parameters
ctxContext to open device through
devDevice structure to assign opened device to
camera_serialNull-terminated ASCII string containing the serial number of the camera subdevice in the device to open
Returns
0 on success, < 0 on error

Definition at line 181 of file core.c.

FREENECTAPI int freenect_process_events ( freenect_context ctx)

Calls the platform specific usb event processor

Parameters
ctxcontext to process events for
Returns
0 on success, other values on error, platform/library dependant

Definition at line 72 of file core.c.

FREENECTAPI int freenect_process_events_timeout ( freenect_context ctx,
struct timeval *  timeout 
)

Calls the platform specific usb event processor until either an event occurs or the timeout parameter time has passed. If a zero timeval is passed, this function will handle any already-pending events, then return immediately.

Parameters
ctxContext to process events for
timeoutPointer to a timeval containing the maximum amount of time to block waiting for events, or zero for nonblocking mode
Returns
0 on success, other values on error, platform/library dependant

Definition at line 80 of file core.c.

FREENECTAPI void freenect_select_subdevices ( freenect_context ctx,
freenect_device_flags  subdevs 
)

Set which subdevices any subsequent calls to freenect_open_device() should open. This will not affect devices which have already been opened. The default behavior, should you choose not to call this function at all, is to open all supported subdevices - motor, cameras, and audio, if supported on the platform.

Parameters
ctxContext to set future subdevice selection for
subdevsFlags representing the subdevices to select

Definition at line 133 of file core.c.

FREENECTAPI void freenect_set_fw_address_k4w ( freenect_context ctx,
unsigned char *  fw_ptr,
unsigned int  num_bytes 
)

Allows the user to specify a pointer to the audio firmware in memory for the K4W Kinect

Parameters
ctxContext to open device through
fw_ptrPointer to audio firmware loaded in memory
num_bytesThe size of the firmware in bytes

Definition at line 292 of file core.c.

FREENECTAPI void freenect_set_fw_address_nui ( freenect_context ctx,
unsigned char *  fw_ptr,
unsigned int  num_bytes 
)

Allows the user to specify a pointer to the audio firmware in memory for the Xbox 360 Kinect

Parameters
ctxContext to open device through
fw_ptrPointer to audio firmware loaded in memory
num_bytesThe size of the firmware in bytes

Definition at line 286 of file core.c.

FREENECTAPI void freenect_set_log_callback ( freenect_context ctx,
freenect_log_cb  cb 
)

Callback for log messages (i.e. for rerouting to a file instead of stdout)

Parameters
ctxcontext to set log callback for
cbcallback function pointer

Definition at line 257 of file core.c.

FREENECTAPI void freenect_set_log_level ( freenect_context ctx,
freenect_loglevel  level 
)

Set the log level for the specified freenect context

Parameters
ctxcontext to set log level for
levellog level to use (see freenect_loglevel enum)

Definition at line 252 of file core.c.

FREENECTAPI void freenect_set_user ( freenect_device dev,
void *  user 
)

Set the device user data, for passing generic information into callbacks

Parameters
devDevice to attach user data to
userUser data to attach

Definition at line 242 of file core.c.

FREENECTAPI int freenect_shutdown ( freenect_context ctx)

Closes the device if it is open, and frees the context

Parameters
ctxfreenect context to close/free
Returns
0 on success

Definition at line 60 of file core.c.

FREENECTAPI int freenect_supported_subdevices ( void  )

Answer which subdevices this library supports. This is most useful for wrappers trying to determine whether the underlying library was built with audio support or not, so the wrapper can avoid calling functions that do not exist.

Returns
Flags representing the subdevices that the library supports opening (see freenect_device_flags)

Definition at line 128 of file core.c.



libfreenect
Author(s): Hector Martin, Josh Blake, Kyle Machulis, OpenKinect community
autogenerated on Mon Jun 10 2019 13:46:43