Difference between revisions of "Network API"
(→Send report) |
|||
Line 2: | Line 2: | ||
See the "--src IP:port" argument on the [[Command_line#General_gimx_options|Command line page]] to learn how to start such a GIMX instance. | See the "--src IP:port" argument on the [[Command_line#General_gimx_options|Command line page]] to learn how to start such a GIMX instance. | ||
− | =Get controller type= | + | =Protocol starting from version 7.1= |
+ | |||
+ | One problem with the earlier protocol was that backward compatibility was broken each time a new axis was added to the controller map.<br /> | ||
+ | The new protocol allows to send any number of axis values. | ||
+ | |||
+ | ==Get controller type== | ||
+ | |||
+ | It's possible to send a packet to get the controller type from the remote GIMX. | ||
+ | |||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | |+Request | ||
+ | | byte || value | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | | 0 || 0x00 | ||
+ | |- | ||
+ | | 1 || 0x00 | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | |+Answer | ||
+ | | byte || value | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | | 0 || 0x00 | ||
+ | |- | ||
+ | | 1 || 0x01 | ||
+ | |- | ||
+ | | 2 || value | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | |value || type | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | | 0x00 || JOYSTICK | ||
+ | |- | ||
+ | | 0x01 || 360 PAD | ||
+ | |- | ||
+ | | 0x02 || SIXAXIS | ||
+ | |- | ||
+ | | 0x05 || DS4 | ||
+ | |- | ||
+ | | 0x07 || T300RS PS4 | ||
+ | |- | ||
+ | | 0x08 || G27 PS3 | ||
+ | |- | ||
+ | | 0x09 || G29 PS4 | ||
+ | |} | ||
+ | |||
+ | ==Send report== | ||
+ | |||
+ | All axes are unsigned 32-bit integers (network byte order). | ||
+ | |||
+ | The [[Controller_Maps|Controller Maps]] page describes the axes and the value ranges corresponding to each controller type. | ||
+ | |||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | |+Report | ||
+ | | byte || value | ||
+ | |- | ||
+ | | | ||
+ | |- | ||
+ | | 0 || 0x01 | ||
+ | |- | ||
+ | | 1 || number of axes to follow | ||
+ | |- | ||
+ | | 2 || | ||
+ | {| class="wikitable" style="text-align: center;" | ||
+ | |width="90"|bit 7 | ||
+ | |width="60"|bit 6 | ||
+ | |width="60"|bit 5 | ||
+ | |width="60"|bit 4 | ||
+ | |width="60"|bit 3 | ||
+ | |width="60"|bit 2 | ||
+ | |width="60"|bit 1 | ||
+ | |width="60"|bit 0 | ||
+ | |- | ||
+ | |0 for rel_axis<br /> | ||
+ | 1 for abs_axis | ||
+ | |colspan="7"|axis index<br />e.g. 0 for abs_axis_0 or for rel_axis_0 | ||
+ | |} | ||
+ | |- | ||
+ | | 3-6 || axis value | ||
+ | |- | ||
+ | | ... || repeat 2 and 3-6 for each axis to update | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | =Protocol for versions up to 6.11= | ||
+ | |||
+ | <div class="mw-collapsible mw-collapsed"> | ||
+ | |||
+ | ==Get controller type== | ||
It's possible to send a packet to get the controller type from the remote GIMX. | It's possible to send a packet to get the controller type from the remote GIMX. | ||
Line 50: | Line 145: | ||
|} | |} | ||
− | =Send report= | + | ==Send report== |
All axes are signed integers. | All axes are signed integers. | ||
Line 70: | Line 165: | ||
| 6-9 || axis 1 | | 6-9 || axis 1 | ||
|- | |- | ||
− | | ... || | + | | ... || |
|- | |- | ||
| 158-161 || axis 39 (changed in GIMX 6.10) | | 158-161 || axis 39 (changed in GIMX 6.10) | ||
|} | |} | ||
+ | |||
+ | </div> |
Revision as of 16:04, 3 February 2018
This page describes how to talk to a GIMX instance that is listening for UDP packets on a specific port.
See the "--src IP:port" argument on the Command line page to learn how to start such a GIMX instance.
Contents
Protocol starting from version 7.1
One problem with the earlier protocol was that backward compatibility was broken each time a new axis was added to the controller map.
The new protocol allows to send any number of axis values.
Get controller type
It's possible to send a packet to get the controller type from the remote GIMX.
byte | value |
0 | 0x00 |
1 | 0x00 |
byte | value |
0 | 0x00 |
1 | 0x01 |
2 | value |
value | type |
0x00 | JOYSTICK |
0x01 | 360 PAD |
0x02 | SIXAXIS |
0x05 | DS4 |
0x07 | T300RS PS4 |
0x08 | G27 PS3 |
0x09 | G29 PS4 |
Send report
All axes are unsigned 32-bit integers (network byte order).
The Controller Maps page describes the axes and the value ranges corresponding to each controller type.
byte | value | ||||||||||||||||
0 | 0x01 | ||||||||||||||||
1 | number of axes to follow | ||||||||||||||||
2 |
| ||||||||||||||||
3-6 | axis value | ||||||||||||||||
... | repeat 2 and 3-6 for each axis to update |
Protocol for versions up to 6.11
Get controller type
It's possible to send a packet to get the controller type from the remote GIMX.
byte | value |
0 | 0x11 |
1 | 0x00 |
byte | value |
0 | 0x11 |
1 | 0x01 |
2 | value |
value | type |
0x00 | JOYSTICK |
0x01 | 360 PAD |
0x02 | SIXAXIS |
0x05 | DS4 |
0x07 | T300RS PS4 |
0x08 | G27 PS3 |
0x09 | G29 PS4 |
Send report
All axes are signed integers.
The Controller Maps page describes the axes and the value ranges corresponding to each controller type.
byte | value |
0 | 0xff |
1 | 0x9C = 156 |
2-5 | axis 0 |
6-9 | axis 1 |
... | |
158-161 | axis 39 (changed in GIMX 6.10) |