aboutsummaryrefslogtreecommitdiff
path: root/wiiremote/wiiremote.h
blob: 1e8cb002814621493423535350da27069fdc3d7e (plain)
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
// wiiremote.h
// Copyright by Masayuki Akamatsu
// Based on "DarwiinRemote" by Hiroaki Kimura

#include <CoreFoundation/CoreFoundation.h>
#include <IOBluetooth/Bluetooth.h>
#include <IOBluetooth/IOBluetoothUserLib.h>

#include <stdio.h>
#include <string.h>

typedef struct {
	int x, y, s;
} IRData;

typedef struct _WiiRemoteRec
{
	IOBluetoothDeviceInquiryRef	inquiry;
	IOBluetoothDeviceRef		device;
	IOBluetoothL2CAPChannelRef	ichan;
	IOBluetoothL2CAPChannelRef	cchan;

	unsigned char	accX;
	unsigned char	accY;
	unsigned char	accZ;
	unsigned short	buttonData;
	
	float			lowZ;
	float			lowX;
	int				orientation;
	int				leftPoint; // is point 0 or 1 on the left. -1 when not tracking.
	float			posX;
	float			posY;
	float			angle;
	Boolean			tracking;

	IRData			irData[4];
	double			batteryLevel;
	
	Boolean			isIRSensorEnabled;
	Boolean			isMotionSensorEnabled;
	Boolean			isVibrationEnabled;
	
	Boolean			isExpansionPortUsed;
	Boolean			isLED1Illuminated;
	Boolean			isLED2Illuminated;
	Boolean			isLED3Illuminated;
	Boolean			isLED4Illuminated;
	
	IOBluetoothUserNotificationCallback	*disconnectNotification;
}	WiiRemoteRec, *WiiRemoteRef;

WiiRemoteRef	wiiremote_init(void);
Boolean			wiiremote_search(void);
Boolean			wiiremote_stopsearch(void);
Boolean			wiiremote_connect(void);
Boolean			wiiremote_disconnect(void);
Boolean			wiiremote_motionsensor(Boolean enabled);
Boolean			wiiremote_irsensor(Boolean enabled);
Boolean			wiiremote_vibration(Boolean enabled);
Boolean			wiiremote_led(Boolean enabled1, Boolean enabled2, Boolean enabled3, Boolean enabled4);
void			wiiremote_getstatus(void);