Skip to content

Station Controller API

jeno96 edited this page Dec 25, 2018 · 31 revisions

Messages

Status Messages

Segment State

Status info about a segment if it is enabled or disabled.
Segment State changed messages are sent automatically by StationControllerAPI.
"state" has the current state.

Topic: segment/state
{"segmentID":01,"state":0} //disabled
{"segmentID":01,"state":1} //enabled

In addition, to extend basic functionality, you can request manually to get Segment State current state.
Just send:

Topic: segment/state
{"segmentID":01,"getstate":"one"}  //for one segment
{"getstate":"every"}               //for every segments

Turnout State

Status info about a turnout’s reference state, if it is straight or divergent.
Turnout State changed messages are sent automatically by StationControllerAPI.
"state" has the current state.

Topic: turnout/state
{"turnoutID":01,"state":"straight"}
{"turnoutID":01,"state":"divergent"} 

In addition, to extend basic functionality, you can request manually to get Turnout State current state.
Just send:

Topic: turnout/state
{"turnoutID":01,"getstate":"one"}  //for one state
{"getstate":"every"}               //for every states

Segment Occupancy

Status info about which segment has train on it.
Segment Occupancy messages are sent automatically by StationControllerAPI.
"state" has the current state.

Topic: segment/occupancy
{"segmentID":01,"occupancy":"occupied"}
{"segmentID":01,"occupancy":"free"}

In addition, to extend basic functionality, you can request manually to get Occupancy.
Just send:

Topic: segment/occupancy
{"segmentID":01,"getoccupancy":"one"}  //for one segment
{"getoccupancy":"every"}               //for every segment

Clone this wiki locally