Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes

XnVSessionManager Class Reference

#include <XnVSessionManager.h>

Inheritance diagram for XnVSessionManager:
Inheritance graph
[legend]
Collaboration diagram for XnVSessionManager:
Collaboration graph
[legend]

List of all members.

Classes

struct  GestureDescription

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)
 XN_DECLARE_DEFAULT_HASH (XnUInt32, GestureDescription *, GestureHash)
void ClearGestureHash (GestureHash &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, GestureHash &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
GestureHash m_MainGestures
GestureHash m_QuickRefocusGestures
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 31 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 321 of file XnVSessionManager.h.


Constructor & Destructor Documentation

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

Constructor. Create a new Session Manager

Parameters:
[in] strName A 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] pGesture User-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] generator Generator with the wanted gesture
[in] strName Name 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] context OpenNI context
[in] strName Name 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] pGesture User-defined gesture
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] context OpenNI context
[in] strName Name of gesture, to be searched in all gesture generators
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] generator Generator with the wanted gesture
[in] strName Name of the wanted gesture in the generator
Returns:
ID to allow removal
void XnVSessionManager::ClearGestureHash ( GestureHash &  hash  )  [protected]
void XnVSessionManager::ClearQueue (  ) 

Clear the multi-thread queue

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] pbbForcedArea A fixed area in which to look for the quick refocus. This overrides but doesn't overwrite the regular Quick Refocus area.
[in] nForcedTimeout Timeout 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] ptFocus The 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] fX Length (in mm) in the X-axis
[out] fY Length (in mm) in the Y-axis
[out] fZ Length (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] pContext The OpenNI context from which to take some values
[in] strUseAsFocus A comma-separated list of gestures to use as the main focus gesture
[in] strUseAsQuickRefocus A comma-separated list of gesture to use as the quick focus gesture
[in] pTracker The HandsGenerator to use for tracking
[in] pFocusGenerator The GestureGenerator from which to take the focus gesture
[in] pQuickRefocusGenerator The 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 330 of file XnVSessionManager.h.

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

Definition at line 331 of file XnVSessionManager.h.

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

Definition at line 332 of file XnVSessionManager.h.

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

Stop tracking a specific point

Parameters:
[in] nID The 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] pHands Points summary
void XnVSessionManager::RemoveGesture ( XnUInt32  nId  ) 

Remove a gesture from being a focus gesture

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

Remove a gesture from being a quick refocus gesture

Parameters:
[in] nId ID 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] fX Length (in mm) on the X-axis
[in] fY Length (in mm) on the Y-axis
[in] fZ Length (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] fTimeout Time 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] fLengthX Length in the X coordinate, half of which will be in either direction
[in] fLengthY Length in the Y coordinate, half of which will be in either direction
[in] fLengthZ Length 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] bbQuickRefocusArea Area 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] nMilliseconds The new timeout
void XnVSessionManager::SetTracker ( XnVPointTracker pTracker  ) 

Replace Tracker used

Parameters:
[in] pTracker new 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] pt The position from which to start tracking

Implements XnVSessionGenerator.

void XnVSessionManager::Update ( XnVMessage pMessage  ) 

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] pMessage incoming Message
void XnVSessionManager::Update ( const xn::Context *  pContext  ) 

Handle a context. Calls the Gesture and the Tracker

Parameters:
[in] pContext The context to process
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."   ) 
XnVSessionManager::XN_DECLARE_DEFAULT_HASH ( XnUInt32  ,
GestureDescription ,
GestureHash   
) [protected]

Member Data Documentation

Definition at line 319 of file XnVSessionManager.h.

XnBoundingBox3D XnVSessionManager::m_bbQuickRefocusArea [protected]

Definition at line 347 of file XnVSessionManager.h.

Definition at line 350 of file XnVSessionManager.h.

Definition at line 294 of file XnVSessionManager.h.

Definition at line 351 of file XnVSessionManager.h.

Definition at line 334 of file XnVSessionManager.h.

Definition at line 295 of file XnVSessionManager.h.

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

Definition at line 358 of file XnVSessionManager.h.

Definition at line 357 of file XnVSessionManager.h.

Definition at line 359 of file XnVSessionManager.h.

Definition at line 362 of file XnVSessionManager.h.

XnCallbackHandle XnVSessionManager::m_hGesture [protected]

Definition at line 336 of file XnVSessionManager.h.

XnCallbackHandle XnVSessionManager::m_hGestureMid [protected]

Definition at line 337 of file XnVSessionManager.h.

XnCallbackHandle XnVSessionManager::m_hQRGesture [protected]

Definition at line 338 of file XnVSessionManager.h.

GestureHash XnVSessionManager::m_MainGestures [protected]

Definition at line 307 of file XnVSessionManager.h.

Definition at line 361 of file XnVSessionManager.h.

Definition at line 309 of file XnVSessionManager.h.

Definition at line 341 of file XnVSessionManager.h.

Definition at line 340 of file XnVSessionManager.h.

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

Definition at line 348 of file XnVSessionManager.h.

Definition at line 352 of file XnVSessionManager.h.

Definition at line 345 of file XnVSessionManager.h.

Definition at line 318 of file XnVSessionManager.h.

Definition at line 308 of file XnVSessionManager.h.

const XnUInt32 XnVSessionManager::ms_nQuickRefocusDefaultTimeout [static, protected]

Definition at line 343 of file XnVSessionManager.h.

Definition at line 261 of file XnVSessionManager.h.

Definition at line 261 of file XnVSessionManager.h.


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