-
Notifications
You must be signed in to change notification settings - Fork 8
On the communication component of the API
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.
-
You should extend from the AbstractRailRoadCommunicationComponent (v1.1 API), or from the AbstractCommunicationComponent (v2.0 API).
-
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.
-
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
-
-
Should you use the v2.0 API, you can find example classes, in the sample project, which explain how you can send commands and retrieve status information. These examples can be used in the v1.1 API in a similar way though.
-
The main difference between v1.1 and v2.0 versions of the *Locator is, in the latter version there are separate commanders for Train annd DCC commands, while in the first version they are included in the TrackElementCommander.
Fields of the TrackCommunicationServiceLocator v1.1:
Fields of the TrackCommunicationServiceLocator v2.0: