JSON Communication
Controller Output
The controller executable outputs JSON data whenever certain internal values are updated. The JSON output contains one or more of the following fields.
Field name | Content type | Value range | Number of values | Description |
---|---|---|---|---|
TrackSpeeds | int | 0-255 | 48 | The speed each track is set at. |
TrackContacts | boolean | false-true | 96 | Whether or not a contact is triggered. Contacts on the same track are consecutive, for instance the contacts on track 0 are represented by indexes 0 and 1 in this array. |
TrackPoints | boolean | false-true (Branch=true,Straight=false) | 30 | Whether a given directional switch is set to straight or branch. |
TrainPositions | int | 0-47 | 11 | The track each train is currently on. |
Bell | boolean | false-true | 1 | Whether the bell is ringing or not. |
Gate0 | boolean | false-true | 1 | Whether gate 0 is raised or not. |
Gate1 | boolean | false-true | 1 | Whether gate 1 is raised or not. |
Controller Input
The controller accepts the following input format (as JSON) through stdin. The input JSON must be on a single line.
Field name | Content type | Value range | Number of values | Description |
---|---|---|---|---|
Action | int | 0-MAXINT, 0-47,0-47,0-1 | 4 | Contains the description of a new train action in the format: [ id, start, destination, reverse flag ] |