~w-shackleton/droidpad-android/stable

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
BINARY SPEC

Since old versions of DroidPad use a very bad text-based format, new versions still use a text-based header containing details of type and features

If using binary connection info (which secure connections do), then the info is as thus:
Info:
* header bytes "DINF"
* Mode type number: (int32)
  * Joystick = 1
  * Absolute mouse = 2
  * Mouse = 3
  * Slideshow = 4
* Raw devices (int32)
* Axes (int32)
* Buttons (int32)
* 32 bytes of reserved data

Each packet contains a header:
* header bytes "DPAD" - 0x4450 4144 (in network order)
* number of elements (int32)
* flags (int32)
  * Has accel		(0x1)
  * Has gyro		(0x2)
  * Stop / close stream	(0x4) - If this flag is passed then all other options are invalid.
* accel x, y, z (three floats)
* gyro x, y, z, normalised z (four floats) - These are accumulated values. Normalised z always points down.
* RESERVED x, y, z (three floats)

Followed is a list (length given by number) with each element of the following format:
* flags (int32)
  * Is a button			(0x1)
  * Is a toggle button		(0x2) - The button flag is also '1' here
  * Is a slider			(0x4)
  * Is a trackpad		(0x8)
  * Has a X axis		(0x10)
  * Has a Y axis		(0x20)
  * Is a 'reset' button		(0x40)
* Data 1 (4 bytes)
* Data 2 (4 bytes)
* Data 3 (4 bytes)

If a button, data 1 is a boolean value. If a slider / trackpad, Data 1 and Data 2 are int32.
They represent the X and Y positions, either on the slider or accumulated trackpad movement.
Data 1 -> X
Data 2 -> Y


The computer can also send messages to the device. Messages are currently of this format:
* header bytes "DCMD"
* command (int32)
  * Stop = 1