2
// Nintendo Wii Remote controller HID packet declaration
4
// This model does not register any of the packet fields directly to
5
// mixxx controls. Please register callbacks to fields named here in
6
// the script using WiimoteController() object and parse events
7
// yourself in callbacks.
9
// Details for Wiimote HID packet data can be found in:
10
// http://wiibrew.org/wiki/Wiimote
12
// Note: until I figure out why my Wii does not accept output packets
13
// for LED and mode control, this mapping is for the basic mode only
14
// with buttons: no rumble, LED control or accelerometer data.
17
function WiimoteController() {
18
this.controller = new HIDController();
20
this.registerInputPackets = function() {
21
// Example call for debugging: calling packet level
22
// callback ignores all field scalers and callbacks
23
//packet = new HIDPacket('control',[],3,this.dump);
25
// Basic button toggle input packet: packet is longer when
26
// we figure out how to enable other data than buttons
27
packet = new HIDPacket('control',[],3);
29
packet.addControl('hid','arrow_left',1,'B',0x1);
30
packet.addControl('hid','arrow_right',1,'B',0x2);
31
packet.addControl('hid','arrow_down',1,'B',0x4);
32
packet.addControl('hid','arrow_up',1,'B',0x8);
33
packet.addControl('hid','button_plus',1,'B',0x10);
34
packet.addControl('hid','button_1',2,'B',0x2);
35
packet.addControl('hid','button_2',2,'B',0x1);
36
packet.addControl('hid','button_bottom',2,'B',0x4);
37
packet.addControl('hid','button_a',2,'B',0x8);
38
packet.addControl('hid','button_minus',2,'B',0x10);
39
packet.addControl('hid','button_home',2,'B',0x80);
41
this.controller.registerInputPacket(packet);
44
// Wiimote has output controls, but I could not figure out how
45
// to send the packets, I'm just getting a general error response.
46
this.registerOutputPackets = function() { }
48
// No default scalers: all controls done with callbacks anyway
49
this.registerScalers = function() { }
51
// Register your own callbacks in caller by overriding this
52
this.registerCallbacks = function() { }
54
// Default dummy callback for gyro events
55
this.gyro = function(field) { return; }
57
// Example of packet callback:
58
// dumps changes (delta) in all packet fields
59
this.dump = function(packet,delta) {
60
for (field_name in delta) {
61
var field = delta[field_name];
62
script.HIDDebug('Wiimote ' + field.id + ' VALUE ' + field.value);