Nuitrack  1.11.2
3D Skeleton Tracking Middleware
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Events Groups Pages
tdv::nuitrack::Nuitrack Class Reference

Central class for common Nuitrack operations. More...

#include <Nuitrack.h>

Public Types

typedef std::function< void(IssuesData::Ptr)> OnIssueUpdate
 Callback type of the issue update request. More...
 

Static Public Member Functions

static void init (const std::string &config="")
 Initialize Nuitrack. More...
 
static void run ()
 Start processing the data provided by the sensor. More...
 
static void update ()
 Initiate Nuitrack update. More...
 
static void update (std::shared_ptr< HeaderOnlyAPI_Module > module)
 Initiate Nuitrack module data update. More...
 
static void waitUpdate (std::shared_ptr< HeaderOnlyAPI_Module > module)
 Initiate Nuitrack module update and wait for it. More...
 
static void release ()
 Stop data processing and destroy all existing Nuitrack modules. More...
 
static void setConfigValue (const std::string &key, const std::string &value)
 Set the value of a Nuitrack configuration parameter. More...
 
static std::string getConfigValue (const std::string &key)
 Get the value of a Nuitrack configuration parameter. More...
 
static std::string getInstancesJson ()
 Get the JSON string of Nuitrack instance-based API. More...
 
static int getVersion ()
 Get Nuitrack version. The version is calculated by the formula: major * 10000 + minor * 100 + revision. More...
 
static uint64_t connectOnIssuesUpdate (const OnIssueUpdate &callback)
 Add a callback for the issue update request. More...
 
static void onIssuesUpdateCallback (IssueTrackerData *data)
 
static void disconnectOnIssuesUpdate (uint64_t handler)
 Remove a callback of the issue update request. More...
 
static std::vector
< device::NuitrackDevice::Ptr > 
getDeviceList ()
 Get a list of available devices. More...
 
static void setDevice (device::NuitrackDevice::Ptr dev)
 Setting a device to run. More...
 
static std::string getLicense ()
 Get current device license. More...
 

Detailed Description

Central class for common Nuitrack operations.

This class is an access point for common Nuitrack operations. This class does not require instance creation, all member functions are static.

Some issues that may occur when using sensor (user occluded by objects / stays close to sensor FOV borders) can be handled with the Nuitrack::OnIssueUpdate callback. Use Nuitrack::connectOnIssuesUpdate to receive information about issues happening.

Callbacks for updating data from Nuitrack modules and the Nuitrack central class are not automatically called. You should request new data with Nuitrack::update or Nuitrack::waitUpdate methods.

Member Typedef Documentation

Callback type of the issue update request.

See Also
tdv::nuitrack::IssuesData
tdv::nuitrack::Issue
connectOnIssuesUpdate

Member Function Documentation

static uint64_t tdv::nuitrack::Nuitrack::connectOnIssuesUpdate ( const OnIssueUpdate callback)
inlinestatic

Add a callback for the issue update request.

Parameters
[in]callbackCallback to be invoked at the issue update request.
Returns
Registered callback ID. You can use it to remove the callback.
See Also
disconnectOnIssuesUpdate
static void tdv::nuitrack::Nuitrack::disconnectOnIssuesUpdate ( uint64_t  handler)
inlinestatic

Remove a callback of the issue update request.

Parameters
[in]handlerID of the previously added callback.
See Also
connectOnIssuesUpdate
static std::string tdv::nuitrack::Nuitrack::getConfigValue ( const std::string &  key)
inlinestatic

Get the value of a Nuitrack configuration parameter.

Parameters
keyParameter key
Returns
Parameter value
Exceptions
tdv::nuitrack::Exception
static std::vector<device::NuitrackDevice::Ptr> tdv::nuitrack::Nuitrack::getDeviceList ( )
inlinestatic

Get a list of available devices.

Returns
List of available devices.
Exceptions
tdv::nuitrack::Exception
static std::string tdv::nuitrack::Nuitrack::getInstancesJson ( )
inlinestatic

Get the JSON string of Nuitrack instance-based API.

Returns
JSON string
Exceptions
tdv::nuitrack::Exception
static std::string tdv::nuitrack::Nuitrack::getLicense ( )
inlinestatic

Get current device license.

Returns
JSON string.
Exceptions
tdv::nuitrack::Exception
static int tdv::nuitrack::Nuitrack::getVersion ( )
inlinestatic

Get Nuitrack version. The version is calculated by the formula: major * 10000 + minor * 100 + revision.

Returns
An integer value of Nuitrack version.
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::init ( const std::string &  config = "")
inlinestatic

Initialize Nuitrack.

This should be called before using any other Nuitrack API functions.

Note
For Android OS: config file is located in the folder with unpacked assets after the installation of Nuitrack.apk
Parameters
configConfig file for Nuitrack initialization.
Warning
Do not specify the config value as it's set automatically. Specify the path to nuitrack.config only if the default location of nuitrack.config (defined after the installation of Nuitrack runtime) was changed.
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::onIssuesUpdateCallback ( IssueTrackerData *  data)
inlinestatic
Warning
For internal use only.
static void tdv::nuitrack::Nuitrack::release ( )
inlinestatic

Stop data processing and destroy all existing Nuitrack modules.

Note
To restart Nuitrack after release you should call Nuitrack::init and create all required modules again.
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::run ( )
inlinestatic

Start processing the data provided by the sensor.

The stages of data processing are determined by the existing module objects. The data is processed asynchronously.

Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::setConfigValue ( const std::string &  key,
const std::string &  value 
)
inlinestatic

Set the value of a Nuitrack configuration parameter.

Parameters
keyParameter key
valueParameter value
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::setDevice ( device::NuitrackDevice::Ptr  dev)
inlinestatic

Setting a device to run.

Parameters
devA configured device that you want to use.
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::update ( )
inlinestatic

Initiate Nuitrack update.

Request new data from all created Nuitrack modules. All module callbacks will be called. No data synchronization is performed.

Note
Non-blocking operation.
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::update ( std::shared_ptr< HeaderOnlyAPI_Module >  module)
inlinestatic

Initiate Nuitrack module data update.

Request new data from Nuitrack module. When data becomes available, corresponding callbacks will be called for given module and all the modules, that are required for it. The data sent to these callbacks will be synchronized, so callback calls will be consistent. Callback call order is defined by module dependency chain: from independent to dependent. The call order of callbacks belonging to a particular module is defined by internal organization of this module.

Note
Non-blocking operation.
Parameters
moduleNuitrack module's Ptr.
Exceptions
tdv::nuitrack::Exception
static void tdv::nuitrack::Nuitrack::waitUpdate ( std::shared_ptr< HeaderOnlyAPI_Module >  module)
inlinestatic

Initiate Nuitrack module update and wait for it.

Similar to Nuitrack::update(std::shared_ptr<HeaderOnlyAPI_Module> module), but waits until all the required callbacks are called.

Note
Blocking operation.
Parameters
moduleNuitrack module's Ptr.
Exceptions
tdv::nuitrack::Exception