NITE 1.5.1 - API Reference

XnVSessionManager Class Reference

#include <XnVSessionManager.h>

Inheritance diagram for XnVSessionManager:
Collaboration diagram for XnVSessionManager:

List of all members.

Public Member Functions

 XnVSessionManager (const XnChar *strName="XnVSessionManager")
 ~XnVSessionManager ()
XnStatus Initialize (xn::Context *pContext, const XnChar *strUseAsFocus, const XnChar *strUseAsQuickRefocus, xn::HandsGenerator *pTracker=NULL, xn::GestureGenerator *pFocusGenerator=NULL, xn::GestureGenerator *pQuickRefocusGenerator=NULL)
void Update (XnVMessage *pMessage)
void Update (const xn::Context *pContext)
void ProcessPoints (XnVMultipleHands *pHands)
void SetTracker (XnVPointTracker *pTracker)
void SetTracker (xn::HandsGenerator generator)
void SetQuickRefocusTimeout (XnUInt32 nMilliseconds)
XnUInt32 GetQuickRefocusTimeout () const
XnStatus LosePoint (XnUInt32 nID)
XnStatus LosePoints ()
XnStatus EndSession ()
XnStatus ForceSession (const XnPoint3D &ptFocus)
XnStatus TrackPoint (const XnPoint3D &pt)
void ClearQueue ()
XnStatus SetQuickRefocusArea (const XnBoundingBox3D &bbQuickRefocusArea)
XnStatus SetQuickRefocusArea (XnFloat fLengthX, XnFloat fLengthY, XnFloat fLengthZ)
void GetQuickRefocusArea (XnFloat &fLengthX, XnFloat &fLengthY, XnFloat &fLengthZ)
void ForceQuickRefocus (XnBoundingBox3D *pbbForcedArea, XnUInt32 nForcedTimeout)
XnUInt32 AddGesture (XnVGesture *pGesture)
XnUInt32 AddGesture (xn::GestureGenerator &generator, const XnChar *strName)
XnUInt32 AddGesture (xn::Context &context, const XnChar *strName)
void RemoveGesture (XnUInt32 nId)
XnUInt32 AddQuickRefocus (XnVGesture *pGesture)
XnUInt32 AddQuickRefocus (xn::GestureGenerator &generator, const XnChar *strName)
XnUInt32 AddQuickRefocus (xn::Context &context, const XnChar *strName)
void RemoveQuickRefocus (XnUInt32 nId)
void StartPrimaryStatic ()
void StopPrimaryStatic ()
void SetPrimaryStaticTimeout (XnFloat fTimeout)
XnFloat GetPrimarySteadyTimeout () const
void SetPrimaryStaticBoundingBox (XnFloat fX, XnFloat fY, XnFloat fZ)
void GetPrimaryStaticBoundingBox (XnFloat &fX, XnFloat &fY, XnFloat &fZ)
XnStatus XN_API_DEPRECATED ("Please use Initialize() instead.") Initialize(XnVGesture *pFocusGesture
void XN_API_DEPRECATED ("Please use AddGesture() instead.") SetGesture(XnVGesture *pGesture)

Public Attributes

XnStatus XnVGesturepQuickRefocusGesture
XnStatus XnVGesture
XnVPointTracker
pTracker

Protected Types

enum  {
  SMGR_ILLEGAL = 0x0000, SMGR_NOT_IN_SESSION = 0x0001, SMGR_IN_SESSION = 0x0002, SMGR_QUICK_REFOCUS = SMGR_IN_SESSION | SMGR_NOT_IN_SESSION,
  SMGR_START_SESSION = 0x0004
}

Protected Member Functions

void SessionStop ()
void StartQuickRefocus (XnBoundingBox3D *pbbROI, XnUInt32 nTimeout)
XnStatus FindTracker (xn::Context *pContext, xn::HandsGenerator *pTracker, xn::HandsGenerator &tracker)
void GestureRecognized (const XnChar *strGesture, const XnPoint3D &ptIDPosition, const XnPoint3D &ptEndPosition)
void GestureStartRecognized (const XnChar *strGesture, const XnPoint3D &pos, XnFloat fProgress)
XnUInt64 GetTime ()
void EnableGestures (XnBoundingBox3D *pROI=NULL)
void EnableQuickRefocusGestures (XnBoundingBox3D *pROI=NULL)
void DisableGestures ()
void DisableQuickRefocusGestures ()
void UpdateGestures (const xn::Context *pContext)
void UpdateQuickRefocusGestures (const xn::Context *pContext)
void ClearGestureHash (XnVGestureHash &hash)
XnUInt32 AddGesture (XnVGesture *pGesture, XnBool bAuto, XnUInt32 nHintID, XnBool bFocus)
XnUInt32 AddGesture (xn::Context &context, const XnChar *strName, const XnStringsHash &hash, XnBool bFocus)
XnUInt32 AddGesture (xn::GestureGenerator &generator, const XnChar *strName, const XnStringsHash &hash, XnBool bFocus)
void RemoveGesture (XnUInt32 nId, XnVGestureHash &hash)
XnBool IsInSession () const
XnBool IsNotInSession () const
XnBool IsQuickRefocus () const
void InitializeStatic ()
void FinalizeStatic ()

Static Protected Member Functions

static void XN_CALLBACK_TYPE Gesture_Recognized (const XnChar *strGesture, const XnPoint3D &ptIDPosition, const XnPoint3D &ptEndPosition, void *cxt)
static void XN_CALLBACK_TYPE Gesture_StartRecognized (const XnChar *strGesture, const XnPoint3D &pos, XnFloat fProgress, void *cxt)
static void XN_CALLBACK_TYPE PrimaryIsSteady (XnUInt32 id, XnFloat dummy, void *cxt)
static void XN_CALLBACK_TYPE PrimaryIsNotSteady (XnUInt32 id, XnFloat dummy, void *cxt)

Protected Attributes

XnBool m_bGesturesEnabled
XnBool m_bQuickRefocusEnabled
XnVGestureHash * m_pMainGestures
XnVGestureHash * m_pQuickRefocusGestures
XnUInt32 m_nNextGestureID
XnVPointTrackerm_pTracker
XnBool m_bAutoTracker
enum XnVSessionManager:: { ... }  m_eSessionState
XnBool m_bQuickRefocusAllowed
XnCallbackHandle m_hGesture
XnCallbackHandle m_hGestureMid
XnCallbackHandle m_hQRGesture
XnUInt32 m_nQuickRefocusTimeout
XnUInt64 m_nQuickRefocusExpire
XnV3DVector m_ptLastPrimaryPosition
XnBoundingBox3D m_bbQuickRefocusArea
const xn::Context * m_pContext
XnBool m_bCheckPrimaryForStatic
XnBool m_bPrimaryIsStatic
XnVSteadyDetectorm_pSteadyDetector
XnFloat m_fLastSteadyTime
XnFloat m_fLastPrimaryTime
XnFloat m_fSteadyTimeout
XnUInt32 m_nLastPrimaryID
XnPoint3D m_GestureWhileTrackingThreshold

Static Protected Attributes

static const XnUInt32 ms_nQuickRefocusDefaultTimeout

Detailed Description

A XnVSessionManager manages the session state Possible states are: Not In Session - Looking for the main gesture. Changing to this state is a "SessionStop" event. In Session - Tracking hand points. Changing to this state is a "SessionStart" event. Quick refocus - lost last point, looking for it where it disappeared, and for main gesture

Initial mode is "Not in session"

Definition at line 32 of file XnVSessionManager.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
SMGR_ILLEGAL 
SMGR_NOT_IN_SESSION 
SMGR_IN_SESSION 
SMGR_QUICK_REFOCUS 
SMGR_START_SESSION 

Definition at line 313 of file XnVSessionManager.h.


Constructor & Destructor Documentation

XnVSessionManager::XnVSessionManager ( const XnChar *  strName = "XnVSessionManager")

Constructor. Create a new Session Manager

Parameters:
[in]strNameA name, for Log use
XnVSessionManager::~XnVSessionManager ( )

Member Function Documentation

XnUInt32 XnVSessionManager::AddGesture ( XnVGesture pGesture)

Add user-defined gesture to be used as a focus gesture

Parameters:
[in]pGestureUser-defined gesture
Returns:
ID to allow removal
XnUInt32 XnVSessionManager::AddGesture ( xn::GestureGenerator &  generator,
const XnChar *  strName 
)

Add gesture to be used as a focus gesture, by gesture generator (OpenNI) and name

Parameters:
[in]generatorGenerator with the wanted gesture
[in]strNameName of the wanted gesture in the generator
Returns:
ID to allow removal
XnUInt32 XnVSessionManager::AddGesture ( xn::Context &  context,
const XnChar *  strName 
)

Add user-defined gesture to be used as a focus gesture, by OpenNI context and name

Parameters:
[in]contextOpenNI context
[in]strNameName of gesture, to be searched in all gesture generators
Returns:
ID to allow removal
XnUInt32 XnVSessionManager::AddGesture ( XnVGesture pGesture,
XnBool  bAuto,
XnUInt32  nHintID,
XnBool  bFocus 
) [protected]
XnUInt32 XnVSessionManager::AddGesture ( xn::Context &  context,
const XnChar *  strName,
const XnStringsHash &  hash,
XnBool  bFocus 
) [protected]
XnUInt32 XnVSessionManager::AddGesture ( xn::GestureGenerator &  generator,
const XnChar *  strName,
const XnStringsHash &  hash,
XnBool  bFocus 
) [protected]
XnUInt32 XnVSessionManager::AddQuickRefocus ( XnVGesture pGesture)

Add user-defined gesture to be used as a quick refocus gesture

Parameters:
[in]pGestureUser-defined gesture
Returns:
ID to allow removal
XnUInt32 XnVSessionManager::AddQuickRefocus ( xn::GestureGenerator &  generator,
const XnChar *  strName 
)

Add gesture to be used as a quick refocus gesture, by gesture generator (OpenNI) and name

Parameters:
[in]generatorGenerator with the wanted gesture
[in]strNameName of the wanted gesture in the generator
Returns:
ID to allow removal
XnUInt32 XnVSessionManager::AddQuickRefocus ( xn::Context &  context,
const XnChar *  strName 
)

Add user-defined gesture to be used as a quick refocus gesture, by OpenNI context and name

Parameters:
[in]contextOpenNI context
[in]strNameName of gesture, to be searched in all gesture generators
Returns:
ID to allow removal
void XnVSessionManager::ClearGestureHash ( XnVGestureHash &  hash) [protected]
void XnVSessionManager::ClearQueue ( ) [virtual]

Clear the multi-thread queue

Reimplemented from XnVMessageListener.

void XnVSessionManager::DisableGestures ( ) [protected]
void XnVSessionManager::DisableQuickRefocusGestures ( ) [protected]
void XnVSessionManager::EnableGestures ( XnBoundingBox3D *  pROI = NULL) [protected]
void XnVSessionManager::EnableQuickRefocusGestures ( XnBoundingBox3D *  pROI = NULL) [protected]
XnStatus XnVSessionManager::EndSession ( ) [virtual]

Stop the current session. All points will be lost.

Implements XnVSessionGenerator.

void XnVSessionManager::FinalizeStatic ( ) [protected]
XnStatus XnVSessionManager::FindTracker ( xn::Context *  pContext,
xn::HandsGenerator *  pTracker,
xn::HandsGenerator &  tracker 
) [protected]
void XnVSessionManager::ForceQuickRefocus ( XnBoundingBox3D *  pbbForcedArea,
XnUInt32  nForcedTimeout 
)

Force the system into quick refocus state, if not already in a session.

Parameters:
[in]pbbForcedAreaA fixed area in which to look for the quick refocus. This overrides but doesn't overwrite the regular Quick Refocus area.
[in]nForcedTimeoutTimeout in ms in which to look for quick refocus. This overrides but doesn't overwrite the regular Quick refocus timeout.
XnStatus XnVSessionManager::ForceSession ( const XnPoint3D &  ptFocus) [virtual]

Force a session to start, with a specific focus position.

Parameters:
[in]ptFocusThe position to consider as focus point

Implements XnVSessionGenerator.

static void XN_CALLBACK_TYPE XnVSessionManager::Gesture_Recognized ( const XnChar *  strGesture,
const XnPoint3D &  ptIDPosition,
const XnPoint3D &  ptEndPosition,
void *  cxt 
) [static, protected]
static void XN_CALLBACK_TYPE XnVSessionManager::Gesture_StartRecognized ( const XnChar *  strGesture,
const XnPoint3D &  pos,
XnFloat  fProgress,
void *  cxt 
) [static, protected]
void XnVSessionManager::GestureRecognized ( const XnChar *  strGesture,
const XnPoint3D &  ptIDPosition,
const XnPoint3D &  ptEndPosition 
) [protected]
void XnVSessionManager::GestureStartRecognized ( const XnChar *  strGesture,
const XnPoint3D &  pos,
XnFloat  fProgress 
) [protected]
void XnVSessionManager::GetPrimaryStaticBoundingBox ( XnFloat &  fX,
XnFloat &  fY,
XnFloat &  fZ 
)

Get the box dimensions in which a gesture is looked for when the primary hand is static

Parameters:
[out]fXLength (in mm) in the X-axis
[out]fYLength (in mm) in the Y-axis
[out]fZLength (in mm) in the Z-axis
XnFloat XnVSessionManager::GetPrimarySteadyTimeout ( ) const

Get the timeout of the primary hand being static to allow gestures

Returns:
Time in seconds
void XnVSessionManager::GetQuickRefocusArea ( XnFloat &  fLengthX,
XnFloat &  fLengthY,
XnFloat &  fLengthZ 
)
XnUInt32 XnVSessionManager::GetQuickRefocusTimeout ( ) const
XnUInt64 XnVSessionManager::GetTime ( ) [protected]
XnStatus XnVSessionManager::Initialize ( xn::Context *  pContext,
const XnChar *  strUseAsFocus,
const XnChar *  strUseAsQuickRefocus,
xn::HandsGenerator *  pTracker = NULL,
xn::GestureGenerator *  pFocusGenerator = NULL,
xn::GestureGenerator *  pQuickRefocusGenerator = NULL 
)

Initialize the Session. Set the gestures to use for focus and for quick refocus, as two comma-separated lists.

Parameters:
[in]pContextThe OpenNI context from which to take some values
[in]strUseAsFocusA comma-separated list of gestures to use as the main focus gesture
[in]strUseAsQuickRefocusA comma-separated list of gesture to use as the quick focus gesture
[in]pTrackerThe HandsGenerator to use for tracking
[in]pFocusGeneratorThe GestureGenerator from which to take the focus gesture
[in]pQuickRefocusGeneratorThe GestureGenerator from which to take the quick refocus gesture
Returns:
XN_STATUS_OK on success
void XnVSessionManager::InitializeStatic ( ) [protected]
XnBool XnVSessionManager::IsInSession ( ) const [inline, protected]

Tells if currently in Session

Returns:
TRUE if in Session (Started but never Stopped), FALSE otherwise

Reimplemented from XnVSessionGenerator.

Definition at line 322 of file XnVSessionManager.h.

XnBool XnVSessionManager::IsNotInSession ( ) const [inline, protected]

Definition at line 323 of file XnVSessionManager.h.

XnBool XnVSessionManager::IsQuickRefocus ( ) const [inline, protected]

Definition at line 324 of file XnVSessionManager.h.

XnStatus XnVSessionManager::LosePoint ( XnUInt32  nID) [virtual]

Stop tracking a specific point

Parameters:
[in]nIDThe ID of the point to stop track

Implements XnVSessionGenerator.

XnStatus XnVSessionManager::LosePoints ( ) [virtual]

Stop tracking all points

Implements XnVSessionGenerator.

static void XN_CALLBACK_TYPE XnVSessionManager::PrimaryIsNotSteady ( XnUInt32  id,
XnFloat  dummy,
void *  cxt 
) [static, protected]
static void XN_CALLBACK_TYPE XnVSessionManager::PrimaryIsSteady ( XnUInt32  id,
XnFloat  dummy,
void *  cxt 
) [static, protected]
void XnVSessionManager::ProcessPoints ( XnVMultipleHands pHands)

Handle Hand Points. Manage session state.

Parameters:
[in]pHandsPoints summary
void XnVSessionManager::RemoveGesture ( XnUInt32  nId)

Remove a gesture from being a focus gesture

Parameters:
[in]nIdID of the gesture to be removed, as received when adding it.
void XnVSessionManager::RemoveGesture ( XnUInt32  nId,
XnVGestureHash &  hash 
) [protected]
void XnVSessionManager::RemoveQuickRefocus ( XnUInt32  nId)

Remove a gesture from being a quick refocus gesture

Parameters:
[in]nIdID of the gesture to be removed, as received when adding it.
void XnVSessionManager::SessionStop ( ) [protected, virtual]

Reimplemented from XnVSessionGenerator.

void XnVSessionManager::SetPrimaryStaticBoundingBox ( XnFloat  fX,
XnFloat  fY,
XnFloat  fZ 
)

Set the box in which to look for the gesture as a result of the primary hand being static. The box will be around the last focus point, with the focus point being its center.

Parameters:
[in]fXLength (in mm) on the X-axis
[in]fYLength (in mm) on the Y-axis
[in]fZLength (in mm) on the Z-axis
void XnVSessionManager::SetPrimaryStaticTimeout ( XnFloat  fTimeout)

Set the timeout of the primary hand being static to allow gestures

Parameters:
[in]fTimeoutTime in seconds
XnStatus XnVSessionManager::SetQuickRefocusArea ( XnFloat  fLengthX,
XnFloat  fLengthY,
XnFloat  fLengthZ 
)

Set the area in which Quick Refocus is expected, where all lengths are symmetric relative to the last known point

Parameters:
[in]fLengthXLength in the X coordinate, half of which will be in either direction
[in]fLengthYLength in the Y coordinate, half of which will be in either direction
[in]fLengthZLength in the z coordinate, half of which will be in either direction
XnStatus XnVSessionManager::SetQuickRefocusArea ( const XnBoundingBox3D &  bbQuickRefocusArea)

Set the area in which Quick Refocus is expected

Parameters:
[in]bbQuickRefocusAreaArea relative to the last known hand (treated as 0,0,0) to expect quick refocus
void XnVSessionManager::SetQuickRefocusTimeout ( XnUInt32  nMilliseconds)

Change the timeout for the quick refocus gesture. Default is 15000 (15 seconds)

Parameters:
[in]nMillisecondsThe new timeout
void XnVSessionManager::SetTracker ( XnVPointTracker pTracker)

Replace Tracker used

Parameters:
[in]pTrackernew Tracker
void XnVSessionManager::SetTracker ( xn::HandsGenerator  generator)
void XnVSessionManager::StartPrimaryStatic ( )

Turn on looking for gestures when the primary hand is static

void XnVSessionManager::StartQuickRefocus ( XnBoundingBox3D *  pbbROI,
XnUInt32  nTimeout 
) [protected]
void XnVSessionManager::StopPrimaryStatic ( )

Turn off looking for gestures when the primary hand is static

XnStatus XnVSessionManager::TrackPoint ( const XnPoint3D &  pt) [virtual]

Start tracking a new hand from a specific position

Parameters:
[in]ptThe position from which to start tracking

Implements XnVSessionGenerator.

void XnVSessionManager::Update ( const xn::Context *  pContext) [virtual]

Handle a context. Calls the Gesture and the Tracker

Parameters:
[in]pContextThe context to process

Implements XnVContextControl.

void XnVSessionManager::Update ( XnVMessage pMessage) [virtual]

Handle incoming Messages. Depth Messages are dealt with by the other Update method Point Messages (from Point Tracker) are dealt with by ProcessPoints

Parameters:
[in]pMessageincoming Message

Reimplemented from XnVContextControl.

void XnVSessionManager::UpdateGestures ( const xn::Context *  pContext) [protected]
void XnVSessionManager::UpdateQuickRefocusGestures ( const xn::Context *  pContext) [protected]
XnStatus XnVSessionManager::XN_API_DEPRECATED ( "Please use Initialize() instead."  )
void XnVSessionManager::XN_API_DEPRECATED ( "Please use AddGesture() instead."  )

Member Data Documentation

Definition at line 311 of file XnVSessionManager.h.

XnBoundingBox3D XnVSessionManager::m_bbQuickRefocusArea [protected]

Definition at line 339 of file XnVSessionManager.h.

Definition at line 342 of file XnVSessionManager.h.

Definition at line 295 of file XnVSessionManager.h.

Definition at line 343 of file XnVSessionManager.h.

Definition at line 326 of file XnVSessionManager.h.

Definition at line 296 of file XnVSessionManager.h.

enum { ... } XnVSessionManager::m_eSessionState [protected]

Definition at line 350 of file XnVSessionManager.h.

Definition at line 349 of file XnVSessionManager.h.

Definition at line 351 of file XnVSessionManager.h.

Definition at line 354 of file XnVSessionManager.h.

XnCallbackHandle XnVSessionManager::m_hGesture [protected]

Definition at line 328 of file XnVSessionManager.h.

XnCallbackHandle XnVSessionManager::m_hGestureMid [protected]

Definition at line 329 of file XnVSessionManager.h.

XnCallbackHandle XnVSessionManager::m_hQRGesture [protected]

Definition at line 330 of file XnVSessionManager.h.

Definition at line 353 of file XnVSessionManager.h.

Definition at line 301 of file XnVSessionManager.h.

Definition at line 333 of file XnVSessionManager.h.

Definition at line 332 of file XnVSessionManager.h.

const xn::Context* XnVSessionManager::m_pContext [protected]

Definition at line 340 of file XnVSessionManager.h.

XnVGestureHash* XnVSessionManager::m_pMainGestures [protected]

Definition at line 299 of file XnVSessionManager.h.

XnVGestureHash* XnVSessionManager::m_pQuickRefocusGestures [protected]

Definition at line 300 of file XnVSessionManager.h.

Definition at line 310 of file XnVSessionManager.h.

const XnUInt32 XnVSessionManager::ms_nQuickRefocusDefaultTimeout [static, protected]

Definition at line 335 of file XnVSessionManager.h.


The documentation for this class was generated from the following file: