/
wiidevice.cpp
executable file
·98 lines (79 loc) · 1.42 KB
/
wiidevice.cpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "wiidevice.h"
WiiDevice::WiiDevice()
{
setRumble(false);
}
void WiiDevice::setAcc(char oName, int val)
{
_device.acc[oName] = val;
}
void WiiDevice::setIR(char oName, int val, int n)
{
_device.ir[n][oName] = val;
}
void WiiDevice::setKey(const char * key, bool val)
{
_device.key[key] = val;
}
void WiiDevice::setMP(char oName, int32_t val)
{
_device.mp[oName] = val;
}
void WiiDevice::setRumble(bool val)
{
_device.rumble = val;
}
void WiiDevice::setLedState(int n, bool val)
{
if (n < 4 && n >= 0)
_device.led[n] = val;
}
void WiiDevice::setBattery(uint16_t val)
{
_device.battery = val;
}
void WiiDevice::setHasMP(bool val)
{
_device.hasmp = val;
}
bool WiiDevice::getLedState(int no)
{
if (no < 4 && no >= 0) return _device.led[no];
else return false;
}
int WiiDevice::getAcc(char oName)
{
return _device.acc[oName];
}
int WiiDevice::getIR(char oName, int which)
{
return _device.ir[which][oName];
}
bool WiiDevice::getKey(const char * key)
{
return _device.key[key];
}
int32_t WiiDevice::getMP(char oName)
{
return _device.mp[oName];
}
bool WiiDevice::getRumble()
{
return _device.rumble;
}
uint16_t WiiDevice::getBattery()
{
return _device.battery;
}
bool WiiDevice::getHasMP()
{
return _device.hasmp;
}
struct device WiiDevice::getDeviceState()
{
return _device;
}
void WiiDevice::setDeviceState(struct device dev)
{
_device = dev;
}