S Class Messages

S-Class train describer messages provide updates relating to the status of signalling equipment within a train describer area. Not all TD areas provide this information.

There are three types of S-Class message:

S-Class messages report the status of the following signalling elements:


 * Signal aspects - whether the signal is displaying its most restrictive aspect or not
 * Points - whether the points are set normal or reverse
 * Route set - the route set from a signal to another signal or bay platform
 * TRTS buttons - the status of a Train Ready to Start button, used by train dispatch staff to indicate to the signaller that platform duties are complete
 * Level crossings - whether they are lowered or raised
 * Track circuits - whether a particular track circuit is occupied or not

Not all train describers support S-Class data, and those that do may only support a subset of the available groups of data. The List of Train Describers shows S-Class support.

= Message Format =

Messages are sent in JSON format, as follows:


 * {"SF_MSG":{"time":"1349696911000", "area_id":"WJ", "msg_type:"SF", "address":"3E", "data":"18", "report_time":"073814"}}
 * {"SG_MSG":{"time":"1349696911000", "area_id":"WJ", "msg_type:"SG", "address":"30", "data":"900000C0", "report_time":"073814"}}
 * {"SH_MSG":{"time":"1349696911000", "area_id":"WJ", "msg_type:"SH", "address":"30", "data":"900000C0", "report_time":"073814"}}

= Message Fields =

= Interpreting S-Class data =

S-Class data represents the state of individual signalling elements within a TD area as bits within a set of 2,048 bits (numbered from 0x00 to 0xFF). The number of bits needed for a TD area depends on the number of signalling elements within that area. Each time an element changes state, an SF message is sent with the value of the elements in the relevant byte.

Every few hours, the state of all bits is sent as a 'refresh' in a series of SG messages with the value of groups of four bytes. These messages are terminated with an SH message.

To decode the set of addresses and bits in to signalling elements, a mapping table containing a list of bits and the signalling elements to which they refer is needed. To reference this to signals on the track layout, a diagram containing signal numbers, routes available from signals, point numbers and track circuit detail is also needed.