Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

WORK IN PROGRESS - MIGHT BY SUBJECT TO CHANGE

Both the controller and the client GUI send their data as JSON Objects.
In JSON every Object is an unordered set of key/value pairs. The values of these pairs can be a JSON Object, a JSON Array or a primitive value (integer, string, boolean or null).
For more information or a complete grammar see http://www.json.org/.

Messages sent by Controller

  • Every message must provide the keys msgType and data.
  • Valid values for msgType are log, error or status.

Log messages

For log messages the data segment consists of a JSON Array, containing zero or more strings.

Error messages

For error messages the data segment consists of one single string, describing the error.

Status messages

In status messages the data segment is a JSON Object which must contain the following key/value pairs.

  • debug - true if the controller is set to verbose debug output, false otherwise
  • cleanup - true after cleanup mode has been engaged, false before that point
  • pause - true while the controller is paused, false otherwise
  • trainCount - an integer with the number of active trains on the railway
  • trains - a JSON Array with the data of all trains, each entry is a JSON Object with these values
    • trainNum - the individual controller number of the train
    • spdSlow - the integer PWM value of this train while driving slow
    • spdCaution - the integer PWM value of this train while driving caution
    • spdNormal - the integer PWM value of this train while driving normally
    • currentIndex -an integer describing the current position in the schedule
  • No labels