What Is Plain Text?
what is plain text?
Regarding callback registering for OpenNI in middleware framework
Basically I am trying to pack OpenNI Kinect into RT-middleware framework.The OpenNI Kinect uses callback and has to be registered.
To do this, I could declare the callback functions and relevant variables in global without problem.
// ----------------------------------------------- // Global // ---------------------------------------------- // Declare OpenNI nodes xn::Context g_Context; xn::ScriptNode g_scriptNode; xn::DepthGenerator g_DepthGenerator; xn::UserGenerator g_UserGenerator; // ... more codes // Define callback functions // Callback: New user was detected void User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie) { // ... some codes if (g_bNeedPose) { g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId); } // ... some codes } // Callback: An existing user was lost void User_LostUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie) { // ... some codes } // ----------------------------------------------- // Member // ---------------------------------------------- // Register callback functioins in the RT-middleware class (OOP) RTC::ReturnCode_t rtc_kinect::onActivated(RTC::UniqueId ec_id) { // ... some codes nRetVal = g_UserGenerator.RegisterUserCallbacks(User_NewUser, User_LostUser, NULL, hUserCallbacks); // ...Legal Writing in Plain English: A Text With Exercises
Learn more
Bryan A. Garner some codes }
I tried to move the callback functions and related variables as member of the middleware class, however been unsuccessful. The codes are:
The Message of A Course In Miracles: A Translation of the Text in Plain LanguageLearn more
Elizabeth A. Cronkhite
// ---------------------------------------- // private members // ---------------------------------------- // Declare OpenNI nodes as member variables xn::Context g_Context; xn::ScriptNode g_scriptNode; xn::DepthGenerator g_DepthGenerator; xn::UserGenerator g_UserGenerator; // ... more codes // Define callback functions as member function // Callback: New user was detected void XN_CALLBACK_TYPE rtc_kinect::User_NewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie) { // ... some codes if (g_bNeedPose) { g_UserGenerator.GetPoseDetectionCap().StartPoseDetection(g_strPose, nId); } else { g_UserGenerator.GetSkeletonCap().RequestCalibration(nId, TRUE); } } // Callback: An existing user was lost void XN_CALLBACK_TYPE rtc_kinect::User_LostUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie) { // ... some codes } // Register callback functioins in the RT-middleware class RTC::ReturnCode_t rtc_kinect::onActivated(RTC::UniqueId ec_id) { // ... some codes nRetVal = g_UserGenerator.RegisterUserCallbacks(&rtc_kinect::User_NewUser, &rtc_kinect::User_LostUser, NULL, hUserCallbacks); // ... some codes }
error C2664: 'xn::UserGenerator::RegisterUserCallbacks' : cannot convert parameter 1 from 'void (__stdcall rtc_kinect::* )(xn::UserGenerator &,XnUserID,void *)' to 'xn::UserGenerator::UserHandler' error C2664: 'xn::PoseDetectionCapability::RegisterToPoseDetected' : cannot convert parameter 1 from 'void (__stdcall rtc_kinect::* )(xn::PoseDetectionCapability &,const XnChar *,XnUserID,void *)' to 'xn::PoseDetectionCapability::PoseDetection' .... and many more
inline XnStatus RegisterUserCallbacks(UserHandler NewUserCB, UserHandler LostUserCB, void* pCookie, XnCallbackHandle& hCallback) { // ... some codes }
typedef void (XN_CALLBACK_TYPE* UserHandler)(UserGenerator& generator, XnUserID user, void* pCookie);
0 コメント:
コメントを投稿