Context
C Reference

## Initialization

Functions for initializing and shutting down an OpenNI context.
XN_C_API XnStatus XN_C_DECL | xnInit (XnContext **ppContext)
XN_C_API XnStatus XN_C_DECL | xnContextRunXmlScriptFromFileEx (XnContext *pContext, const XnChar *strFileName, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
XN_C_API XnStatus | xnContextRunXmlScriptFromFile (XnContext *pContext, const XnChar *strFileName, XnEnumerationErrors *pErrors)
XN_C_API XnStatus XN_C_DECL | xnContextRunXmlScriptEx (XnContext *pContext, const XnChar *xmlScript, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
XN_C_API XnStatus XN_C_DECL | xnContextRunXmlScript (XnContext *pContext, const XnChar *xmlScript, XnEnumerationErrors *pErrors)
XN_C_API XnStatus XN_C_DECL | xnInitFromXmlFileEx (const XnChar *strFileName, XnContext **ppContext, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
XN_C_API XnStatus XN_C_DECL | xnInitFromXmlFile (const XnChar *strFileName, XnContext **ppContext, XnEnumerationErrors *pErrors)
XN_C_API XnStatus XN_C_DECL | xnContextOpenFileRecordingEx (XnContext *pContext, const XnChar *strFileName, XnNodeHandle *phPlayerNode)
XN_C_API XnStatus XN_C_DECL | xnContextOpenFileRecording (XnContext *pContext, const XnChar *strFileName)
XN_C_API XnStatus XN_C_DECL | xnContextAddRef (XnContext *pContext)
XN_C_API void XN_C_DECL | xnContextRelease (XnContext *pContext)
XN_C_API void XN_C_DECL | xnShutdown (XnContext *pContext)
XN_C_API void XN_C_DECL | xnForceShutdown (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnContextRegisterForShutdown (XnContext *pContext, XnContextShuttingDownHandler pHandler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnContextUnregisterFromShutdown (XnContext *pContext, XnCallbackHandle hCallback)

## Enumeration

Functions for enumeration and creation of nodes.
XN_C_API XnStatus XN_C_DECL | xnEnumerateProductionTrees (XnContext *pContext, XnProductionNodeType Type, const XnNodeQuery *pQuery, XnNodeInfoList **ppTreesList, XnEnumerationErrors *pErrors)
XN_C_API XnStatus XN_C_DECL | xnCreateProductionTree (XnContext *pContext, XnNodeInfo *pTree, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL | xnCreateAnyProductionTree (XnContext *pContext, XnProductionNodeType type, XnNodeQuery *pQuery, XnNodeHandle *phNode, XnEnumerationErrors *pErrors)
XN_C_API XnStatus XN_C_DECL | xnCreateMockNode (XnContext *pContext, XnProductionNodeType type, const XnChar *strName, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL | xnCreateMockNodeBasedOn (XnContext *pContext, XnNodeHandle hOriginalNode, const XnChar *strName, XnNodeHandle *phMockNode)
XN_C_API XnStatus XN_C_DECL | xnProductionNodeAddRef (XnNodeHandle hNode)
XN_C_API XnStatus XN_C_DECL | xnRefProductionNode (XnNodeHandle hNode)
XN_C_API void XN_C_DECL | xnProductionNodeRelease (XnNodeHandle hNode)
XN_C_API void XN_C_DECL | xnUnrefProductionNode (XnNodeHandle hNode)
XN_C_API XnStatus XN_C_DECL | xnEnumerateExistingNodes (XnContext *pContext, XnNodeInfoList **ppList)
XN_C_API XnStatus XN_C_DECL | xnEnumerateExistingNodesByType (XnContext *pContext, XnProductionNodeType type, XnNodeInfoList **ppList)
XN_C_API XnStatus XN_C_DECL | xnFindExistingRefNodeByType (XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL | xnFindExistingNodeByType (XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL | xnGetRefNodeHandleByName (XnContext *pContext, const XnChar *strInstanceName, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL | xnGetNodeHandleByName (XnContext *pContext, const XnChar *strInstanceName, XnNodeHandle *phNode)

## Multi-Node Handling

Functions that affect all the nodes in the context.
XN_C_API XnStatus XN_C_DECL | xnWaitAndUpdateAll (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnWaitOneUpdateAll (XnContext *pContext, XnNodeHandle hNode)
XN_C_API XnStatus XN_C_DECL | xnWaitAnyUpdateAll (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnWaitNoneUpdateAll (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnStartGeneratingAll (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnStopGeneratingAll (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnSetGlobalMirror (XnContext *pContext, XnBool bMirror)
XN_C_API XnBool XN_C_DECL | xnGetGlobalMirror (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnGetGlobalErrorState (XnContext *pContext)
XN_C_API XnStatus XN_C_DECL | xnRegisterToGlobalErrorStateChange (XnContext *pContext, XnErrorStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromGlobalErrorStateChange (XnContext *pContext, XnCallbackHandle hCallback)
XN_C_API XnStatus XN_C_DECL | xnRegisterToNodeCreation (XnContext *pContext, XnNodeCreationHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromNodeCreation (XnContext *pContext, XnCallbackHandle hCallback)
XN_C_API XnStatus XN_C_DECL | xnRegisterToNodeDestruction (XnContext *pContext, XnNodeDestructionHandler handler, void *pCookie, XnCallbackHandle *phCallback)
XN_C_API void XN_C_DECL | xnUnregisterFromNodeDestruction (XnContext *pContext, XnCallbackHandle hCallback)

## Detailed Description

This page details functions for managing an OpenNI context.

# Initializing and Deinitializing OpenNI Context

Initialization must be performed before using any OpenNI functionality, and similarly you must not call any OpenNI functions after deinitialization.

# Enumerating and Creating Production Trees

A production tree is composed of a production node, and optionally a list of other production trees needed for this production node. Each production node has a type (one of the types defined by OpenNI spec), a vendor name, and a specific name (unique for this type and vendor), with a version. For example, a User generator may need a Depth generator, which in turn might need a Device node.

## Enumeration Results

The results from an enumeration operation is a pointer to the first node of a linked list, representing all the different possibilities to get data of the requested type. A single possibility contains the provider description, an optional instance name (that can be used by the provider as proprietary information, like a device S/N), and the bExists field, which tells if this node already exists in the context (and as such, doesn't need to be created) or not, and a list of needed nodes by this node.

## Enumerating Example

For example, let's take a look at an application in need of depth maps:

// Enumerate for production trees that can produce depth
XnNodeInfoList* pNodesList;
nRetVal = xnEnumerateProductionTrees(pNiteCtx, XN_NODE_TYPE_DEPTH, NULL, &pNodesList);
CHECK_RC(nRetVal, "Enumerate");
// choose a tree (for simplicity, take first one)
XnNodeInfoListIterator itChosen = xnNodeInfoListGetFirst(pNodesList);
XnNodeInfo* pChosen = xnNodeInfoListGetCurrent(itChosen);
// create first one
XnNodeHandle hDepth;
nRetVal = xnCreateProductionTree(pNiteCtx, pChosen, &hDepth);
CHECK_RC(nRetVal, "Create");
// free the list (it is no longer needed)
xnNodeInfoListFree(pNodesList);
// TODO: use handle for configuration and data extraction
XnNodeInfoList
struct XnNodeInfoList XnNodeInfoList
Definition XnTypes.h:187
XnNodeInfo
struct XnNodeInfo XnNodeInfo
Definition XnTypes.h:177
XN_NODE_TYPE_DEPTH
@ XN_NODE_TYPE_DEPTH
Definition XnTypes.h:106
XnNodeHandle
struct XnInternalNodeData * XnNodeHandle
Definition XnTypes.h:82
xnCreateProductionTree
XN_C_API XnStatus XN_C_DECL xnCreateProductionTree(XnContext *pContext, XnNodeInfo *pTree, XnNodeHandle *phNode)
Creates a production node. If the tree specifies additional needed nodes, and those nodes do not exis...
xnEnumerateProductionTrees
XN_C_API XnStatus XN_C_DECL xnEnumerateProductionTrees(XnContext *pContext, XnProductionNodeType Type, const XnNodeQuery *pQuery, XnNodeInfoList **ppTreesList, XnEnumerationErrors *pErrors)
Enumerates all available production trees for a specific node type. The trees populated in the list s...
xnNodeInfoListFree
XN_C_API void XN_C_DECL xnNodeInfoListFree(XnNodeInfoList *pList)
xnNodeInfoListGetCurrent
XN_C_API XnNodeInfo *XN_C_DECL xnNodeInfoListGetCurrent(XnNodeInfoListIterator it)
xnNodeInfoListGetFirst
XN_C_API XnNodeInfoListIterator XN_C_DECL xnNodeInfoListGetFirst(XnNodeInfoList *pList)
XnNodeInfoListIterator
Definition XnTypes.h:193

## Function Documentation

## xnContextAddRef()

XN_C_API XnStatus XN_C_DECL xnContextAddRef | ( | XnContext * | pContext | ) |

Adds a reference to the context object.

Parameters

  pContext | [in] The context.

## xnContextOpenFileRecording()

XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecording | ( | XnContext * | pContext,
|  | const XnChar * | strFileName )

Opens a recording file, adding all nodes in it to the context. NOTE: when using this function, the context will be the owner of the created player node, so this nodes and the context will only be destroyed if calling xnShutdown(). It is highly suggested to use xnContextOpenFileRecordingEx() instead, which returns the player node, making the caller owner of this node.

Parameters

  pContext | [in] The context.
  strFileName | [in] The file to open.

## xnContextOpenFileRecordingEx()

XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecordingEx | ( | XnContext * | pContext,
|  | const XnChar * | strFileName,
|  | XnNodeHandle * | phPlayerNode )

Opens a recording file, adding all nodes in it to the context.

Parameters

  pContext | [in] The context.
  strFileName | [in] The file to open.
  phPlayerNode | [out] The created player node.

## xnContextRegisterForShutdown()

XN_C_API XnStatus XN_C_DECL xnContextRegisterForShutdown | ( | XnContext * | pContext,
|  | XnContextShuttingDownHandler | pHandler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers for context shutting down event. This function is used for backwards compatibility and should not be called by any client.

## xnContextRelease()

XN_C_API void XN_C_DECL xnContextRelease | ( | XnContext * | pContext | ) |

Releases a context object, decreasing its ref count by 1. If reference count has reached 0, the context will be destroyed.

Parameters

  pContext | [in] The context.

## xnContextRunXmlScript()

XN_C_API XnStatus XN_C_DECL xnContextRunXmlScript | ( | XnContext * | pContext,
|  | const XnChar * | xmlScript,
|  | XnEnumerationErrors * | pErrors )

Runs an XML script in the given context. NOTE: when using this function, the context will be the owner of the created nodes, so those nodes and the context will only be destroyed if calling xnShutdown(). It is highly suggested to use xnContextRunXmlScriptEx() instead, which returns a node referencing created nodes, making the caller owner of those nodes.

Parameters

  pContext | [in] The context.
  xmlScript | [in] A string representation of the XML script. for a full description of the XML structure, see Xml Scripts.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.

## xnContextRunXmlScriptEx()

XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptEx | ( | XnContext * | pContext,
|  | const XnChar * | xmlScript,
|  | XnEnumerationErrors * | pErrors,
|  | XnNodeHandle * | phScriptNode )

Runs an XML script in the given context.

Parameters

  pContext | [in] The context.
  xmlScript | [in] A string representation of the XML script. for a full description of the XML structure, see Xml Scripts.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.
  phScriptNode | [out] Handle to a node holding all the nodes created from the script. When no longer needed, the node can be released, causing all those nodes to dec ref.

## xnContextRunXmlScriptFromFile()

XN_C_API XnStatus xnContextRunXmlScriptFromFile | ( | XnContext * | pContext,
|  | const XnChar * | strFileName,
|  | XnEnumerationErrors * | pErrors )

Runs an XML script in the given context. NOTE: when using this function, the context will be the owner of the created nodes, so those nodes and the context will only be destroyed if calling xnShutdown(). It is highly suggested to use xnContextRunXmlScriptFromFileEx() instead, which returns a node referencing created nodes, making the caller owner of those nodes.

Parameters

  pContext | [in] The context to be configured.
  strFileName | [in] The name of the file containing the script. for a full description of the XML structure, see Xml Scripts.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.

## xnContextRunXmlScriptFromFileEx()

XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptFromFileEx | ( | XnContext * | pContext,
|  | const XnChar * | strFileName,
|  | XnEnumerationErrors * | pErrors,
|  | XnNodeHandle * | phScriptNode )

Runs an XML script in the given context.

Parameters

  pContext | [in] The context to be configured.
  strFileName | [in] The name of the file containing the script. for a full description of the XML structure, see Xml Scripts.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.
  phScriptNode | [out] Handle to a node holding all the nodes created from the script. When no longer needed, the node can be released, causing all those nodes to dec ref.

## xnContextUnregisterFromShutdown()

XN_C_API void XN_C_DECL xnContextUnregisterFromShutdown | ( | XnContext * | pContext,
|  | XnCallbackHandle | hCallback )

Unregisters from context shutting down event. This function is used for backwards compatibility and should not be called by any client.

## xnCreateAnyProductionTree()

XN_C_API XnStatus XN_C_DECL xnCreateAnyProductionTree | ( | XnContext * | pContext,
|  | XnProductionNodeType | type,
|  | XnNodeQuery * | pQuery,
|  | XnNodeHandle * | phNode,
|  | XnEnumerationErrors * | pErrors )

Enumerates for production trees for a specific node type, and creates the first found tree. This function is a shortcut version for using xnEnumerateProductionTrees(), iterating the list, and then calling xnCreateProductionTree().

Parameters

  pContext | [in] OpenNI context.
  type | [in] The requested node type.
  pQuery | [in] Optional. A query object that can be used to filter results.
  phNode | [out] A handle to the newly created node.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.

## xnCreateMockNode()

XN_C_API XnStatus XN_C_DECL xnCreateMockNode | ( | XnContext * | pContext,
|  | XnProductionNodeType | type,
|  | const XnChar * | strName,
|  | XnNodeHandle * | phNode )

Creates a production node which is only a mock. This node does not represent an actual node, but only keeps a state and implements an interface above it. Mock nodes are useful when simulating nodes for playing recordings, or for use in tests. See also xnCreateMockNodeBasedOn().

Parameters

  pContext | [in] OpenNI context.
  type | [in] The type of the mock to create.
  strName | [in] Optional. The name of the node. If NULL is provided, a name will be automatically generated.
  phNode | [out] A handle to the newly created node.

## xnCreateMockNodeBasedOn()

XN_C_API XnStatus XN_C_DECL xnCreateMockNodeBasedOn | ( | XnContext * | pContext,
|  | XnNodeHandle | hOriginalNode,
|  | const XnChar * | strName,
|  | XnNodeHandle * | phMockNode )

Creates a production node which is only a mock, base on the type and properties of another node. This node does not represent an actual node, but only keeps a state and implements an interface above it. Mock nodes are useful when simulating nodes for playing recordings, or for use in tests. See also xnCreateMockNode().

Parameters

  pContext | [in] OpenNI context.
  hOriginalNode | [in] A handle to an existing node on which the mock node will be based on.
  strName | [in] The name of the node. If set to NULL, a name will be generated based on the name of hOriginalNode.
  phMockNode | [out] A handle to the newly created mock node.

## xnCreateProductionTree()

XN_C_API XnStatus XN_C_DECL xnCreateProductionTree | ( | XnContext * | pContext,
|  | XnNodeInfo * | pTree,
|  | XnNodeHandle * | phNode )

Creates a production node. If the tree specifies additional needed nodes, and those nodes do not exist, they will be created too, and passed to this node as input.

Parameters

  pContext | [in] OpenNI context.
  pTree | [in] A production tree to create.
  phNode | [out] A handle to the newly created node.

## xnEnumerateExistingNodes()

XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodes | ( | XnContext * | pContext,
|  | XnNodeInfoList ** | ppList )

Gets a list of all existing node in the context. Each node that was returned increases its ref count. The list must be freed using xnNodeInfoListFree().

Parameters

  pContext | [in] OpenNI context.
  ppList | [out] A linked list of current existing nodes

## xnEnumerateExistingNodesByType()

XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodesByType | ( | XnContext * | pContext,
|  | XnProductionNodeType | type,
|  | XnNodeInfoList ** | ppList )

Gets a list of all existing node in the context. Each node that was returned increases its ref count. The list must be freed using xnNodeInfoListFree().

Parameters

  pContext | [in] OpenNI context.
  type | [in] Type to look for.
  ppList | [out] A linked list of current existing nodes

## xnEnumerateProductionTrees()

XN_C_API XnStatus XN_C_DECL xnEnumerateProductionTrees | ( | XnContext * | pContext,
|  | XnProductionNodeType | Type,
|  | const XnNodeQuery * | pQuery,
|  | XnNodeInfoList ** | ppTreesList,
|  | XnEnumerationErrors * | pErrors )

Enumerates all available production trees for a specific node type. The trees populated in the list should be freed by calling xnNodeInfoListFree() once not needed.

Parameters

  pContext | [in] OpenNI context.
  Type | [in] The requested node type.
  pQuery | [in] Optional. A query object that can be used to filter results.
  ppTreesList | [out] A list of possible production trees.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.

## xnFindExistingNodeByType()

XN_C_API XnStatus XN_C_DECL xnFindExistingNodeByType | ( | XnContext * | pContext,
|  | XnProductionNodeType | type,
|  | XnNodeHandle * | phNode )

## xnFindExistingRefNodeByType()

XN_C_API XnStatus XN_C_DECL xnFindExistingRefNodeByType | ( | XnContext * | pContext,
|  | XnProductionNodeType | type,
|  | XnNodeHandle * | phNode )

Returns the first found existing node of the specified type.

Parameters

  pContext | [in] OpenNI context.
  type | [in] Type to look for.
  phNode | [out] A handle to the found node.

## xnForceShutdown()

XN_C_API void XN_C_DECL xnForceShutdown | ( | XnContext * | pContext | ) |

Forces a context to shutdown, destroying all nodes. This function is used for backwards compatibility and should not be called by any client. Please use xnContextRelease() instead.

Parameters

  pContext | [in] The context to be destroyed.

## xnGetGlobalErrorState()

XN_C_API XnStatus XN_C_DECL xnGetGlobalErrorState | ( | XnContext * | pContext | ) |

Gets the global error state of the context. If one of the nodes in the context is in error state, that state will be returned. If more than one node is in error state, XN_STATUS_MULTIPLE_NODES_ERROR is returned. An application can query each node error state by calling xnGetNodeErrorState().

Parameters

  pContext | [in] OpenNI context.

## xnGetGlobalMirror()

XN_C_API XnBool XN_C_DECL xnGetGlobalMirror | ( | XnContext * | pContext | ) |

Gets the global mirror flag.

Parameters

  pContext | [in] OpenNI context.

## xnGetNodeHandleByName()

XN_C_API XnStatus XN_C_DECL xnGetNodeHandleByName | ( | XnContext * | pContext,
|  | const XnChar * | strInstanceName,
|  | XnNodeHandle * | phNode )

## xnGetRefNodeHandleByName()

XN_C_API XnStatus XN_C_DECL xnGetRefNodeHandleByName | ( | XnContext * | pContext,
|  | const XnChar * | strInstanceName,
|  | XnNodeHandle * | phNode )

Gets a handle to an existing production node instance using that instance name.

Parameters

  pContext | [in] OpenNI context.
  strInstanceName | [in] Name of the instance to get.
  phNode | [out] A handle to that instance.

Returns
  XN_STATUS_BAD_NODE_NAME if node by name of strInstanceName doesn't exist.

## xnInit()

XN_C_API XnStatus XN_C_DECL xnInit | ( | XnContext ** | ppContext | ) |

Initializes the OpenNI library.

This function must be called before calling any other OpenNI function (except for xnInitFromXmlFile())

Parameters

  ppContext | [out] Output location for context pointer.

## xnInitFromXmlFile()

XN_C_API XnStatus XN_C_DECL xnInitFromXmlFile | ( | const XnChar * | strFileName,
|  | XnContext ** | ppContext,
|  | XnEnumerationErrors * | pErrors )

Initializes OpenNI context, and then configures it using the given file. NOTE: when using this function, the context will be the owner of the created nodes, so those nodes and the context will only be destroyed if calling xnShutdown(). It is highly suggested to use xnInitFromXmlFileEx() instead, which returns a node referencing created nodes, making the caller owner of those nodes.

Parameters

  strFileName | [in] The name of the file to read configuration from.
  ppContext | [out] Output location for context pointer.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.

## xnInitFromXmlFileEx()

XN_C_API XnStatus XN_C_DECL xnInitFromXmlFileEx | ( | const XnChar * | strFileName,
|  | XnContext ** | ppContext,
|  | XnEnumerationErrors * | pErrors,
|  | XnNodeHandle * | phScriptNode )

Initializes OpenNI context, and then configures it using the given file.

Parameters

  strFileName | [in] The name of the file to read configuration from.
  ppContext | [out] Output location for context pointer.
  pErrors | [in/out] Optional. If provided, will be filled with enumeration errors.
  phScriptNode | [out] Handle to a node holding all the nodes created from the script. When no longer needed, the node can be released, causing all those nodes to dec ref.

## xnProductionNodeAddRef()

XN_C_API XnStatus XN_C_DECL xnProductionNodeAddRef | ( | XnNodeHandle | hNode | ) |

References a production node, increasing its reference count by 1.

Parameters

  hNode | [in] A handle to the node.

## xnProductionNodeRelease()

XN_C_API void XN_C_DECL xnProductionNodeRelease | ( | XnNodeHandle | hNode | ) |

Unreference a production node, decreasing its reference count by 1. If the reference count reaches zero, the node will be destroyed.

Parameters

  hNode | [in] A handle to the node.

## xnRefProductionNode()

XN_C_API XnStatus XN_C_DECL xnRefProductionNode | ( | XnNodeHandle | hNode | ) |

References a production node, increasing its reference count by 1. Note: this function is deprecated. Please use xnProductionNodeAddRef() instead.

Parameters

  hNode | [in] A handle to the node.

## xnRegisterToGlobalErrorStateChange()

XN_C_API XnStatus XN_C_DECL xnRegisterToGlobalErrorStateChange | ( | XnContext * | pContext,
|  | XnErrorStateChangedHandler | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers a callback function to global error state changes.

Parameters

  pContext | [in] OpenNI context.
  handler | [in] A pointer to a function that will be called when global error state changes.
  pCookie | [in] A user cookie that will be passed to the callback function.
  phCallback | [out] Optional. Will be filled with a handle to be passed to xnUnregisterFromGlobalErrorStateChange().

## xnRegisterToNodeCreation()

XN_C_API XnStatus XN_C_DECL xnRegisterToNodeCreation | ( | XnContext * | pContext,
|  | XnNodeCreationHandler | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers a callback function to 'Node Creation' event. This event is raised whenever node are created.

Parameters

  pContext | [in] OpenNI context.
  handler | [in] A pointer to a function that will be called when a new node is created.
  pCookie | [in] A user cookie that will be passed to the callback function.
  phCallback | [out] Optional. Will be filled with a handle to be passed to xnUnregisterFromNodeCreation().

## xnRegisterToNodeDestruction()

XN_C_API XnStatus XN_C_DECL xnRegisterToNodeDestruction | ( | XnContext * | pContext,
|  | XnNodeDestructionHandler | handler,
|  | void * | pCookie,
|  | XnCallbackHandle * | phCallback )

Registers a callback function to 'Node Destruction' event. This event is raised whenever a node is destroyed.

Parameters

  pContext | [in] OpenNI context.
  handler | [in] A pointer to a function that will be called when a node is destroyed.
  pCookie | [in] A user cookie that will be passed to the callback function.
  phCallback | [out] Optional. Will be filled with a handle to be passed to xnUnregisterFromNodeDestruction().

## xnSetGlobalMirror()

XN_C_API XnStatus XN_C_DECL xnSetGlobalMirror | ( | XnContext * | pContext,
|  | XnBool | bMirror )

Sets the global mirror flag. This will set all current existing nodes' mirror state, and also affect future created nodes. The default mirror flag is FALSE.

Parameters

  pContext | [in] OpenNI context.
  bMirror | [in] New Mirror state.

## xnShutdown()

XN_C_API void XN_C_DECL xnShutdown | ( | XnContext * | pContext | ) |

Shuts down an OpenNI context, destroying all its nodes. Do not call any function of this context or any correlated node after calling this method. NOTE: this function destroys the context and all the nodes it holds and so should be used very carefully. Normally you should just call xnContextRelease().

Parameters

  pContext | [in] The context to be destroyed.

## xnStartGeneratingAll()

XN_C_API XnStatus XN_C_DECL xnStartGeneratingAll | ( | XnContext * | pContext | ) |

Make sure all generators are generating data.

Parameters

  pContext | [in] OpenNI context.

## xnStopGeneratingAll()

XN_C_API XnStatus XN_C_DECL xnStopGeneratingAll | ( | XnContext * | pContext | ) |

Stop all generators from generating data.

Parameters

  pContext | [in] OpenNI context.

## xnUnrefProductionNode()

XN_C_API void XN_C_DECL xnUnrefProductionNode | ( | XnNodeHandle | hNode | ) |

Unreference a production node, decreasing its reference count by 1. If the reference count reaches zero, the node will be destroyed. Note: this function is deprecated. Please use xnProductionNodeAddRef() instead.

Parameters

  hNode | [in] A handle to the node.

## xnUnregisterFromGlobalErrorStateChange()

XN_C_API void XN_C_DECL xnUnregisterFromGlobalErrorStateChange | ( | XnContext * | pContext,
|  | XnCallbackHandle | hCallback )

Unregisters a callback function which was registered using xnRegisterToGlobalErrorStateChange().

Parameters

  pContext | [in] OpenNI context.
  hCallback | [in] The handle to the callback returned from xnRegisterToGlobalErrorStateChange().

## xnUnregisterFromNodeCreation()

XN_C_API void XN_C_DECL xnUnregisterFromNodeCreation | ( | XnContext * | pContext,
|  | XnCallbackHandle | hCallback )

Unregisters a callback function which was registered using xnRegisterToNodeCreation().

Parameters

  pContext | [in] OpenNI context.
  hCallback | [in] The handle to the callback returned from xnRegisterToNodeCreation().

## xnUnregisterFromNodeDestruction()

XN_C_API void XN_C_DECL xnUnregisterFromNodeDestruction | ( | XnContext * | pContext,
|  | XnCallbackHandle | hCallback )

Unregisters a callback function which was registered using xnRegisterToNodeDestruction().

Parameters

  pContext | [in] OpenNI context.
  hCallback | [in] The handle to the callback returned from xnRegisterToNodeDestruction().

## xnWaitAndUpdateAll()

XN_C_API XnStatus XN_C_DECL xnWaitAndUpdateAll | ( | XnContext * | pContext | ) |

Updates all generators nodes in the context, waiting for all to have new data.

Parameters

  pContext | [in] OpenNI context.

## xnWaitAnyUpdateAll()

XN_C_API XnStatus XN_C_DECL xnWaitAnyUpdateAll | ( | XnContext * | pContext | ) |

Updates all generators nodes in the context, once any of them have new data.

Parameters

  pContext | [in] OpenNI context.

## xnWaitNoneUpdateAll()

XN_C_API XnStatus XN_C_DECL xnWaitNoneUpdateAll | ( | XnContext * | pContext | ) |

Updates all generator nodes in the context, without any waiting. If a node has new data, it will be updated.

Parameters

  pContext | [in] OpenNI context.

## xnWaitOneUpdateAll()

XN_C_API XnStatus XN_C_DECL xnWaitOneUpdateAll | ( | XnContext * | pContext,
|  | XnNodeHandle | hNode )

Updates all generators nodes in the context, waiting for a specific one to have new data.

Parameters

  pContext | [in] OpenNI context.
  hNode | [in] The node to wait for.