-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWiimote.h
60 lines (40 loc) · 1.08 KB
/
Wiimote.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef WIIMOTE_H
#define WIIMOTE_H
#include <bluetooth/bluetooth.h>
#include <cwiid.h>
#include <map>
class ControllerIntf;
typedef enum
{
NO_CONNECTION,
CALLBACK_SETUP_ERROR
} WiiMoteErrorCode;
class Wiimote;
typedef std::map<cwiid_wiimote_t*, Wiimote*> WiimoteMap;
class Wiimote
{
public:
//constructor. Starts the connection to a wiimote.
//throw some exception if it fails
explicit Wiimote(ControllerIntf *wiimoteHandler);
//disconnect the wiimote from this object
~Wiimote();
void WiimoteCallback(
int mesg_count,
union cwiid_mesg mesg_array[],
struct timespec *timestamp);
private:
ControllerIntf *m_wiimoteHandler;
//setup a constant for the equivalent of BD_ADDR_ANY
//because the one in bluetooth.h is stupid
static const bdaddr_t kBdAddrAny;
cwiid_wiimote_t *m_pWiimote;
int m_index;
static int index;
//place to register all the callback objects
static WiimoteMap m_wiimoteMap;
/* Wiimote Callback */
static cwiid_mesg_callback_t cwiid_callback;
bdaddr_t m_bdaddr;
};
#endif