00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __OPENKN_CONTROLLER__WIIMOTE_MANAGER_HPP__
00024 #define __OPENKN_CONTROLLER__WIIMOTE_MANAGER_HPP__
00025
00026 #include "Wiimote.hpp"
00027
00028
00029
00030
00031
00032 #include <boost/thread.hpp>
00033
00034
00035
00036
00037
00038 namespace kn{
00039
00040
00047 class WiimoteManager{
00048
00049 private :
00050
00052 wiimote** wiimotes;
00053
00055 unsigned int maxnumberofwiimotes;
00056
00058 unsigned int numberofwiimotes;
00059
00061 Wiimote* wiimoteobservers;
00062
00063 public :
00064
00071 WiimoteManager(void);
00072
00080 ~WiimoteManager(void);
00081
00090 void launch(const unsigned int& maxtime = 3, const unsigned int& maxwiimotes = 4);
00091
00097 void stop(void);
00098
00106 Wiimote& getWiimote(const unsigned int& i = 0);
00107
00115 unsigned int getWiimoteNumber(void){return numberofwiimotes;}
00116
00117 private :
00118
00120 boost::thread *thrd;
00121
00123 volatile bool treatevents;
00124
00132 void handleEvents(void);
00133
00144 void handle_event(struct wiimote_t* wm, const unsigned int& id);
00145
00146 };
00147 }
00148
00149 #endif