Library context to find and open devices.
More...
#include <libfreenect2/libfreenect2.hpp>
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.
◆ Freenect2()
| Freenect2 |
( |
void * | usb_context = 0 | ) |
|
◆ ~Freenect2()
◆ enumerateDevices()
Must be called before doing anything else.
- Returns
- Number of devices, 0 if none
◆ getDeviceSerialNumber()
| std::string getDeviceSerialNumber |
( |
int | idx | ) |
|
- Parameters
-
- Returns
- Device serial number, or empty if the index is invalid.
◆ getDefaultDeviceSerialNumber()
| std::string getDefaultDeviceSerialNumber |
( |
| ) |
|
- Returns
- Device serial number, or empty if no device exists.
◆ waitForDevice()
| bool waitForDevice |
( |
const std::string & | serial, |
|
|
uint32_t | timeout_ms, |
|
|
uint32_t | poll_ms = 250 ) |
Wait until a device with serial appears in enumeration.
This does not revive a closed or disconnected device object. After it returns true, call openDevice(serial) to obtain a fresh object.
- Parameters
-
| serial | Device serial number to find. |
| timeout_ms | Maximum monotonic wait in milliseconds. |
| poll_ms | Delay between enumeration attempts. |
◆ openDevice() [1/4]
Open device by index with default pipeline.
- Parameters
-
| idx | Index number. Index numbers are not determinstic during enumeration. |
- Returns
- New device object, or NULL on failure
◆ openDevice() [2/4]
Open device by index.
- Parameters
-
| idx | Index number. Index numbers are not determinstic during enumeration. |
| factory | New PacketPipeline instance. This is always automatically freed. |
- Returns
- New device object, or NULL on failure
◆ openDevice() [3/4]
Open device by serial number with default pipeline.
- Parameters
-
- Returns
- New device object, or NULL on failure
◆ openDevice() [4/4]
Open device by serial number.
- Parameters
-
| serial | Serial number |
| factory | New PacketPipeline instance. This is always automatically freed. |
- Returns
- New device object, or NULL on failure
◆ openDefaultDevice() [1/2]
Open the first device with default pipeline.
- Returns
- New device object, or NULL on failure
◆ openDefaultDevice() [2/2]
Open the first device.
- Parameters
-
| factory | New PacketPipeline instance. This is always automatically freed. |
- Returns
- New device object, or NULL on failure
References Freenect2().