/*private static*/ void XN_CALLBACK_TYPE UserManager::onCalibrationEnd(xn::SkeletonCapability& capability, XnUserID userId, XnBool successfullyCalibrated, void* cookie) { UserManager* tthis = static_cast<UserManager*>(cookie); if (successfullyCalibrated) { printf("Calibration complete, start tracking user %d\n", userId); tthis->userGenerator.GetSkeletonCap().StartTracking(userId); tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_ENDED_SUCCESFULLY); } else { printf("Calibration failed for user %d\n", userId); tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE); tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_ENDED_UNSUCCESFULLY); } }
// TODO when is this invoked?? /*private static*/ void XN_CALLBACK_TYPE UserManager::onPoseDetected(xn::PoseDetectionCapability& capability, const XnChar* detectedPoseName, XnUserID userId, void* cookie) { printf("UserManager.Pose %s detected for user %d\n", detectedPoseName, userId); UserManager* tthis = static_cast<UserManager*>(cookie); tthis->userGenerator.GetPoseDetectionCap().StopPoseDetection(userId); tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE); tthis->broadcastUserChangeState(userId, USER_STATE_POSE_DETECTED); }
/*private static*/ void XN_CALLBACK_TYPE UserManager::onUserNew(xn::UserGenerator& generator, XnUserID/*unsigned int*/ userId, void* cookie) { printf("UserManager.onNewUser(generator, userId=%d, cookie)\n", userId); UserManager* tthis = static_cast<UserManager*>(cookie); printf("Requesting calibration for new user."); tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE); tthis->broadcastUserChangeState(userId, USER_STATE_NEW); }
/*private static*/ void XN_CALLBACK_TYPE UserManager::onCalibrationStart(xn::SkeletonCapability& capability, XnUserID userId, void* cookie) { printf("Calibration started for user %d\n", userId); UserManager* tthis = static_cast<UserManager*>(cookie); tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_STARTED); }
/*private static*/ void XN_CALLBACK_TYPE UserManager::onUserLost(xn::UserGenerator& generator, XnUserID userId, void* cookie) { printf("UserManager.onUserLost(generator, userId=%d, cookie)\n", userId); UserManager* tthis = static_cast<UserManager*>(cookie); tthis->broadcastUserChangeState(userId, USER_STATE_LOST); }