#pragma once #include #include "MainFrm.h" #ifndef DISABLE_OPENNI #define ENABLE_OPENNI #include "ExNiLib/ExOpenNiWin.h" #endif #ifndef DISABLE_KINECT_SDK #define ENABLE_KINECT_SDK #include "ExNiLib/ExKinectWin.h" #endif #include "MFCTool.h" #define NIDEVICE_WAIT_TIME 200 // ms #define NIDEVICE_TERM_WAIT_TIME 1000 // ms //////////////////////////////////////////////// // ライブラリのラッパークラス //using namespace jbxl; using namespace jbxwl; //////////////////////////////////////////////////////////////////////////////////// // // CExNiDevice:  // class CExNiDevice { public: CExNiDevice(); virtual ~CExNiDevice(); private: // #ifdef ENABLE_OPENNI CExOpenNiWin* openni_win; #else void* openni_win; #endif #ifdef ENABLE_KINECT_SDK CExKinectWin* kinect_sdk; #else void* kinect_sdk; #endif CExNiFileDev* nifile_dev; CExportNiData* niexport_data; protected: BOOL locked_sensor; CString err_message; public: BOOL init(void); BOOL check_lib(void); BOOL init_device(void); BOOL load_lib(LPCTSTR lib_name); public: NiFileType checkFileType(LPCTSTR fname); NiFileType rftype; void execFilePlayer(BOOL login, CString fname); float getLocalAvgFPS(void); void clearLocalAvgFPS(void); int execLoadedData(BOOL login, FileDevParam ctrl); int getFileFrameNum(void) { return nifile_dev->frames_num;} double getFilePlayTime(void) { return nifile_dev->playback_time;} void saveFramesDataAsBVH(CString fname, BVHSaveParam param); public: NiSDK_Lib nowSDKLib; CWnd* mWnd; HWND hWnd; BOOL has_device; BOOL loaded_oni; int image_xsize; int image_ysize; int image_fps; // CMainFrame* pMainFrame; CExFrame* pSensorFrame; CExTextFrame* pLogFrame; CExFrame* pSkeletonFrame; CExNiNetwork* niNetwork; CExNiSHMemory* sharedMem; CParameterSet appParam; FileDevParam flpParam; BOOL enableUSBDev; NiInputDevice inputDevice; NiInputDevice prvInputDevice; public: // Interface to basic class void setParameter(CParameterSet param); void setStatusBarMemFPS(float fps) { if (pMainFrame!=NULL) pMainFrame->SetStausBarLocalFPS(fps);} void setStatusBarNetFPS(float fps) { if (pMainFrame!=NULL) pMainFrame->SetStausBarNetworkFPS(fps);} void setStatusBarNetBPS(float bps) { if (pMainFrame!=NULL) pMainFrame->SetStausBarNetworkBPS(bps);} BOOL initRingBuffer(void); CString getErrorMessage(BOOL dev=FALSE); void execMirroring(void); int getDevState(void); void setViewScale(int scale); void clearJointsData(void); void clearAvatarDetected(void); void clearLogDocPtr(void); void setLogFramePtr(CExTextFrame* ptr); void setSensorFramePtr(CExFrame* ptr); void setSkeletonFramePtr(CExFrame* ptr); void setJointConst(CNiJoints* joints); void setNetwork (CExNiNetwork* net); void setSharedMem (CExNiSHMemory* mem); void setNiFileDev(void); void setViewPoint(void); void deleteDevice(void); BOOL createImage(void); BOOL createDepth(void); void deleteImage(void); void deleteDepth(void); BOOL hasImage(void); BOOL hasDepth(void); void setUseImage(BOOL use); void setMirroring(BOOL use); BOOL startDetection(void); BOOL stopDetection(void); void setDenyTrackingSearch(void); // File BOOL startRecorde(void); void stopRecorde (void); int backupRecordeTempFile(LPCTSTR backup_file); void deleteRecordeTempFile(void); BOOL openLoadFile(LPCTSTR fname); // USB BOOL openUSBDevice(void); void closeUSBDevice(void); void setTiltMotor(int ang); void setLEDColor (int col); void setUseMotor(BOOL use); void setUseLED(BOOL use); // Device BOOL makeFileDevice(LPCTSTR fname); BOOL restoreDevice(void); public: friend UINT niDeviceEventLoop(LPVOID pParam); }; ////////////////////////////////////////////////////////////////////// // UINT niDeviceEventLoop(LPVOID pParam);