00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef __KINECTDEVICE_H__
00036 #define __KINECTDEVICE_H__
00037
00038 #include "../lib/common.h"
00039 #include "../core/Thread.h"
00040 #include "../objects/KinectUser.h"
00041
00042 namespace NIDevice
00043 {
00044 namespace Objects
00045 {
00046 class KinectDevice : public NIDevice::Core::Thread
00047 {
00048 public:
00049 KinectDevice(unsigned int id);
00050 ~KinectDevice();
00051
00052
00053
00054 xn::Context& GetContext();
00055 xn::Context* GetContextPtr();
00056 bool IsInit();
00057 bool IsConnected();
00058 bool IsGenerating();
00059 void GoThread();
00060
00061
00062 NIDevice::Objects::KinectUser* CreateKinectUser();
00063 void DestroyKinectUser(NIDevice::Objects::KinectUser* existingKinectUser);
00064
00065 unsigned int GetId();
00066 int GetExistingAvailableId();
00067 void AddExistingId(unsigned int id);
00068 void RemoveExistingId(unsigned int id);
00069 void GetValidUsersMap(NIDevice::Objects::KinectUser** tUsers);
00070 NIDevice::Objects::KinectUser* GetUser(int userId);
00071 NIDevice::Generator::Depth* GetDepthGenerator();
00072 NIDevice::Generator::Image* GetImageGenerator();
00073 NIDevice::Generator::User* GetUserGenerator();
00074 NIDevice::Generator::Gesture* GetGestureGenerator();
00075 NIDevice::Generator::Hands* GetHandsGenerator();
00076
00077 void SetSkeletonSmoothing(float value);
00078 float GetSkeletonSmoothing();
00079
00080
00081 XnVSessionManager& GetSessionManager();
00082 XnVSessionManager* GetSessionManagerPtr();
00083
00087 NIDEVICE_GET_OBJECT_TYPE_AS_STRING(KinectDevice);
00088 NIDEVICE_GET_ERROR_MESSAGE(nRetVal, description);
00089
00090 void SetMirrorMode(bool state);
00091 bool GetMirrorMode();
00092
00093 void SetDistCutoff(int dist);
00094 int GetDistCutoff();
00095 void SetAngCutoff(float ang);
00096 float GetAngCutoff();
00097 private:
00098
00099
00100 KinectUserList listOfUsers;
00101 OpenNIUserList listOfAvalaibleUsers;
00102 XnStatus nRetVal;
00103 std::string description;
00104 unsigned int mId;
00105 bool bConnected;
00106 bool bInit;
00107 bool bGenerating;
00108 bool bMirror;
00109 float m_sklSmoothing;
00110 int iDistCutoff;
00111 float fAngCutoff;
00112
00113
00114 xn::Context context;
00115 xn::ProductionNode m_deviceNode;
00116
00117
00118 XnVSessionManager* sessionManager;
00119
00120
00121
00122
00123
00124 NIDevice::Generator::Depth* m_DepthGenerator;
00125 NIDevice::Generator::Image* m_ImageGenerator;
00126 NIDevice::Generator::User* m_UserGenerator;
00127 NIDevice::Generator::Gesture* m_GestureGenerator;
00128 NIDevice::Generator::Hands* m_HandsGenerator;
00129
00130 void createContext();
00131 void destroyContext();
00132 int initContext();
00133
00134 void createAndStartGenerators();
00135 void stopAndDestroyGenerators();
00136
00137 protected:
00138 KinectDevice();
00139 };
00140 }
00141 }
00142
00143
00144 #endif