Go to the documentation of this file.00001 #ifndef MITK_WIIMOTEHTREAD_H
00002 #define MITK_WIIMOTEHTREAD_H
00003
00004 #include "mitkCommon.h"
00005 #include "itkObject.h"
00006
00007 #include "itkMultiThreader.h"
00008 #include "itkFastMutexLock.h"
00009 #include "mitkCallbackFromGUIThread.h"
00010
00011 #include "wiimote.h"
00012
00013 #include "itksys/SystemTools.hxx"
00014 #include "mitkVector.h"
00015
00016 namespace mitk
00017 {
00018
00019 class WiiMoteAddOn;
00020
00021 class WiiMoteThread : public itk::Object
00022 {
00023 public:
00024
00025
00026 typedef itk::ReceptorMemberCommand<mitk::WiiMoteAddOn> ReceptorCommand;
00027
00028
00029 typedef ReceptorCommand::Pointer ReceptorCommandPointer;
00030
00031 WiiMoteThread();
00032 ~WiiMoteThread();
00033
00034 itkSetMacro(SleepTime, int);
00035 itkGetConstMacro(SleepTime, int);
00036
00054 static void OnStateChange(wiimote &remote, state_change_flags changed, const wiimote_state &newState);
00055
00059 void Run();
00060
00065 static ITK_THREAD_RETURN_TYPE StartWiiMoteThread(void* data);
00066
00070 void StartWiiMote();
00071
00075 void StopWiiMote();
00076
00080 void ReconnectWiiMote();
00081
00086 void DetectWiiMotes();
00087
00092 void WiiMoteIRInput();
00093
00101 void WiiMoteButtonPressed(int buttonType);
00102
00107 void WiiMoteCalibrationInput();
00108
00109 protected:
00110
00111 private:
00112
00113 int m_ThreadID;
00114 itk::MultiThreader::Pointer m_MultiThreader;
00115
00116
00117 itk::FastMutexLock::Pointer m_WiiMoteThreadFinished;
00118 bool m_StopWiiMote;
00119
00120
00121 wiimote m_WiiMote;
00122 ReceptorCommandPointer m_Command;
00123
00124
00125 Point2D m_LastReadData;
00126 double m_LastRecordTime;
00127 bool m_ReadDataOnce;
00128
00129
00130 bool m_InCalibrationMode;
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140 int m_SleepTime;
00141
00142
00143 wiimote* m_WiiMotes[6];
00144
00145 };
00146 }
00147
00148 #endif // MITK_WIIMOTEHTREAD_H