MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / UpdateUserTracking

Method UpdateUserTracking

Samples/NiUserSelection/UserSelector.cpp:97–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 return UpdateUserSelectionState(nUserId, pState->m_eState, newSubState);
96}
97XnStatus UserSelector::UpdateUserTracking(XnUserID nUserId, XnBool bTracked, XnInt64 newSubState)
98{
99 // update by checking the current state is ok and then update it based on the success and the
100 // sub state.
101 UserSelectionState* pState;
102 XnStatus nRetVal = m_hUsersState.Get(nUserId,pState);
103 if(nRetVal!=XN_STATUS_OK)
104 {
105 return nRetVal;
106 }
107 if(pState == NULL || pState->m_eState != XN_SELECTION_SELECTED)
108 {
109 xnLogError("SAMPLE","User %d should have been in an unselected state but was instead in %d state.\n", nUserId, pState->m_eState);
110 return XN_STATUS_ERROR; // this should be only called when a user is selected!
111 }
112 XnSelectionState newState = bTracked ? XN_SELECTION_TRACKING : XN_SELECTION_FAILED;
113
114 return UpdateUserSelectionState(nUserId, newState, newSubState);
115}
116
117XnStatus UserSelector::AddNewUser(XnUserID nUserId)
118{

Callers 2

StartTrackingMethod · 0.80
CalibrationCompleteMethod · 0.80

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected