If Gainput is built with GAINPUT_DEV
defined, it features a server that external tools can connect to obtain information on devices, mappings and button states. The underlying protocol is TCP/IP and the default port 1211.
The following messages are defined:
hello
{
uint8_t cmd
uint32_t protocolVersion
uint32_t libVersion
}
device
{
uint8_t cmd
uint32_t deviceId
string name
}
device button
{
uint8_t cmd
uint32_t deviceId
uint32_t buttonId
string name
uint8_t type
}
map
{
uint8_t cmd
uint32_t mapId
string name
}
remove map
{
uint8_t cmd
uint32_t mapId
}
user button
{
uint8_t cmd
uint32_t mapId
uint32_t buttonId
uint32_t deviceId
uint32_t deviceButtonId
float value
}
remove user button
{
uint8_t cmd
uint32_t mapId
uint32_t buttonId
}
user button changed
{
uint8_t cmd
uint32_t mapId
uint32_t buttonId
uint8_t type
uint8_t/float value
}
ping
{
uint8_t cmd
}
get all infos
{
uint8_t cmd
}
start device sync
{
uint8_t cmd
uint8_t deviceType
uint8_t deviceIndex
}
set device button
{
uint8_t cmd
uint8_t deviceType
uint8_t deviceIndex
uint32_t deviceButtonId
uint8_t/float value
}
The message IDs (cmd
) are defined in GainputDevProtocol.h.
Each message is prefaced with a uint8_t
that specifies the message's length.
All integers are in network byte order.
Strings are represented like this:
{
uint8_t length
char text[length]
}