blob: d18e280a11e787482f4aba0bd1a00b532018782f (
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
|
//
// Demo script to print events from apple bluetooth keyboard on OS/X
// Copyright (C) 2012, Ilkka Tuohela
// Feel free to use whatever way wish1
//
HIDKeyboard = new HIDKeyboardDevice();
HIDKeyboard.init = function(id) {
HIDKeyboard.id = id;
HIDKeyboard.registerInputPackets();
HIDKeyboard.registerOutputPackets();
HIDKeyboard.registerScalers();
HIDKeyboard.registerCallbacks();
HIDDebug("HID Keyboard Initialized: " + HIDKeyboard.id);
}
HIDKeyboard.shutdown = function() {
HIDDebug("HID Keyboard Shutdown: " + HIDKeyboard.id);
}
HIDKeyboard.incomingData = function(data,length) {
var controller = HIDKeyboard.controller;
if (controller==undefined) {
HIDDebug("Error in script initialization: controller not found");
return;
}
controller.parsePacket(data,length);
}
|