All requests and responses are sent as json objects.
Every request must conatin at least one value: command
{
"command": "<command>"
}
Saves config to ./flapconfig.json.
Request:
{
"command": "dm_load"
}
Response:
{
"ack": true
}
Loads config from ./flapconfig.json.
Request:
{
"command": "dm_load"
}
Response:
{
"ack": true
}
Dumps current config to socket.
Request:
{
"command": "dm_dump"
}
Response:
{
"devices_all": <registered device count>
"devices_online": <online device count>,
"devices": <array of all devices>,
"map": <2D array of device locations>
}
Gets all information for specified device id.
Request:
{
"command": "dm_describe",
"id": <device id>
}
Response:
{
...
}
Register device, assign new id and assign a location.
{
"command": "dm_describe",
"address": <device bus address>,
"x": <x position on screen>,
"y": <y position on screen>,
}
Response:
{
"id": <assigned device id>
}
Removes device from config and frees location in screen
Request:
{
"command": "dm_remove",
"id": <device id>
}
Response:
{
"ack": true
}
Refresh device config
Request:
{
"command": "dm_refresh"
}
Response:
{
"devices_online": <online device count>
}
Print string at position (x,y)
Request:
{
"command": "dm_describe",
"string": <string to display>,
"mode": <int: 0=full rotation/1=direct/2=sync>,
"x": <int: x position on screen>,
"y": <int: y position on screen>
}
Response:
{
"ack": true
}
Print string at position (x,y)
Request:
{
"command": "dm_print_single",
"flap": <int: flap to display>,
"full": <boolean: full rotation of drum/recalibration>,
"x": <int: x position on screen>,
"y": <int: y position on screen>
}
Response:
{
"ack": true
}
Clears all flaps.
Request:
{
"command": "dm_clear"
}
Response:
{
"ack": true
}
Checks if a module reponds on the given address.
Request:
{
"command": "dr_ping",
"address": <address>
}
Response:
{
"success": <boolean: if device reponded 'true', else 'false'>
}
Changes the hardware address of an module.
Request:
{
"command": "dr_setaddress",
"address": <address>,
"newaddress": <new address>
}
Response:
{
"success": <boolean: if success 'true', else 'false'>
}
Sets the offset calibration for an module.
Request:
{
"command": "dr_setcalibration",
"address": <address>,
"calibration": <calibration value (default: 1800)>
}
Response:
{
"success": <boolean: if success 'true', else 'false'>
}
Resets the controller of an module
Request:
{
"command": "dr_reset",
"address": <address>
}
Response:
{
"ack": true
}
Sets the module to the specified flap directly or with recalibration.
Request:
{
"command": "dr_display",
"address": <address>,
"flap": <flap-number>,
("full": <boolean: full rotation of drum/recalibration>)
}
Response:
{
"ack": true
}
Sets the power-state for the motor of the given module.
Request:
{
"command": "dr_power",
"address": <address>,
"power": <boolean: power on>
}
Response:
{
"ack": true
}
{
"error": "<error name>",
"detail": "<more detailed error message>"
}
The following responses are valid:
parsing error: the json request is malformated and cannot be parsedformat error: the json object is missing required fields. Check details for more information.internal error: an internal error occured. This should not happen. Chaeck server logs.