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 read from a JSON file. The JSON file is called input.json and is found in $XDG_CONFIG_HOME/railway if XDG_CONFIG_HOME is set or from $HOME/.config/railway if it isn't.

Field name

Content type

Value range

Number of values

Description

Action

int

0-MAXINT,0-10, 0-47

3

Contains the description of a new train action in the format: [ action id, train id, destination ]

Tags: