Skip to content

On the communication component of the API

Benedek Horvath edited this page Sep 7, 2017 · 20 revisions

How to send messages to the railway track?

Implementing your own stack

Use find the protobuf definition of the Network messages that are used by the system. You should generate the Java / C++ / Python / etc. classes from those definitions and connect to the network via MQTT.

Using the services provided by the API

  1. You should extend from the AbstractRailRoadCommunicationComponent (v1.1 API), or from the AbstractCommunicationComponent (v2.0 API).

  2. In order to create a CommunicationStack (v1.1 API) use the CommunicationStackFactory (v1.1 API). In the v2.0 API you should use the MessagingService and the MessagingServiceFactory classes.

  3. In the AbstractRailRoadCommunicationComponent (v1.1 API) or the AbstractCommunicationComponent (v2.0 API) you should find a field called locator, which has a TrackCommunicationServiceLocator v1.1, v2.0. You should use its fields, if you would like to:

    • send commands to the network (set segment’s enabledness, set turnout’s direction, set train’s speed)

    • get status information about various elements (segment’s occupancy, segment’s enabledness, turnout’s direction)

    • register your listener for a particular message

Clone this wiki locally