libfreenect2  0.2
Public Member Functions | List of all members
Freenect2 Class Reference

Library context to find and open devices. More...

#include <libfreenect2/libfreenect2.hpp>

Public Member Functions

 Freenect2 (void *usb_context=0)
 
virtual ~Freenect2 ()
 
int enumerateDevices ()
 Must be called before doing anything else. More...
 
std::string getDeviceSerialNumber (int idx)
 
std::string getDefaultDeviceSerialNumber ()
 
Freenect2DeviceopenDevice (int idx)
 Open device by index with default pipeline. More...
 
Freenect2DeviceopenDevice (int idx, const PacketPipeline *factory)
 Open device by index. More...
 
Freenect2DeviceopenDevice (const std::string &serial)
 Open device by serial number with default pipeline. More...
 
Freenect2DeviceopenDevice (const std::string &serial, const PacketPipeline *factory)
 Open device by serial number. More...
 
Freenect2DeviceopenDefaultDevice ()
 Open the first device with default pipeline. More...
 
Freenect2DeviceopenDefaultDevice (const PacketPipeline *factory)
 Open the first device. More...
 

Detailed Description

Library context to find and open devices.

You will first find existing devices by calling enumerateDevices().

Then you can openDevice() and control the devices with returned Freenect2Device object.

You may open devices with custom PacketPipeline. After passing a PacketPipeline object to libfreenect2 do not use or free the object, libfreenect2 will take care. If openDevice() fails the PacketPipeline object will get deleted. A new PacketPipeline object has to be created each time a device is opened.

Constructor & Destructor Documentation

Freenect2 ( void *  usb_context = 0)
Parameters
usb_contextIf the libusb context is provided, Freenect2 will use it instead of creating one.
virtual ~Freenect2 ( )
virtual

Member Function Documentation

int enumerateDevices ( )

Must be called before doing anything else.

Returns
Number of devices, 0 if none
std::string getDeviceSerialNumber ( int  idx)
Parameters
idxDevice index
Returns
Device serial number, or empty if the index is invalid.
std::string getDefaultDeviceSerialNumber ( )
Returns
Device serial number, or empty if no device exists.
Freenect2Device* openDevice ( int  idx)

Open device by index with default pipeline.

Parameters
idxIndex number. Index numbers are not determinstic during enumeration.
Returns
New device object, or NULL on failure
Freenect2Device* openDevice ( int  idx,
const PacketPipeline factory 
)

Open device by index.

Parameters
idxIndex number. Index numbers are not determinstic during enumeration.
factoryNew PacketPipeline instance. This is always automatically freed.
Returns
New device object, or NULL on failure
Freenect2Device* openDevice ( const std::string &  serial)

Open device by serial number with default pipeline.

Parameters
serialSerial number
Returns
New device object, or NULL on failure
Freenect2Device* openDevice ( const std::string &  serial,
const PacketPipeline factory 
)

Open device by serial number.

Parameters
serialSerial number
factoryNew PacketPipeline instance. This is always automatically freed.
Returns
New device object, or NULL on failure
Freenect2Device* openDefaultDevice ( )

Open the first device with default pipeline.

Returns
New device object, or NULL on failure
Freenect2Device* openDefaultDevice ( const PacketPipeline factory)

Open the first device.

Parameters
factoryNew PacketPipeline instance. This is always automatically freed.
Returns
New device object, or NULL on failure