-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
In this wiki page, the messages are sent individually for each train and wagon, which is a difficult task to collect in a receiver component. Thus, I'm suggesting the following format:
Message format:
| JSON field | Type | Description | Example |
|---|---|---|---|
| time | int | timestamp of the message in milliseconds | 1508578744987 |
| locomotive | string | name of the locomotive | Taurus |
| length | float | the length of the locomotive | 21.47 |
| speed | cm/s or mm/s | the speed of the locomotive, only cm/s or mm/s could be used | 10.67 |
| unit | cm or mm | the length unit used in both the calculation the length and the speed field | mm |
| wagons | array of wagon objects | wagon message for each wagon, could be empty | [] |
Wagon object:
| JSON field | Type | Description | Example |
|---|---|---|---|
| name | string | name of the wagon | Red |
| length | float | the length of the wagon | 21.47 |
| unit | cm or mm | the length unit used in calculating the length field (it is recommended to be the very same unit which used in the parent object) | mm |
An example message when a Taurus locomotive with two Red wagon passed by the sensor (disclaimer: the example data might not be real):
{
"time": 1508578744987,
"locomotive": "Taurus",
"length": 21.47,
"speed": 10.67,
"unit": "cm",
"wagons": [
{"name": "Red", "length": 12.01, "unit": "cm"},
{"name": "Red", "length": 12.07, "unit": "cm"}
]
};This message format is open for discuss, please, comment on this issue if you have any ideas.
benedekh