uniba-swt / swtbahn-cli

A client-server command line interface for the SWTbahn.
GNU General Public License v3.0
7 stars 3 forks source link

Add request endpoint that serves current position of the train in handler_driver (or handler_controller) #43

Closed BLuedtke closed 2 years ago

BLuedtke commented 2 years ago

For executing systematic tests with MBT-Tools, it is advantageous to be able to query the position of a train.

handler_driver already implements train_position_is_at, but there is no way to query it from outside. Proposal: Implement a onion/http-requestable method for retrieving the current position of a train in handler_monitor. handler_monitor should be the right place, as it is already implementing handler_get_train_state, which goes in a similar direction. This could also be implemented in handler_driver, but that'd imply that only the driver is allowed to query the position of their train.

Alternative: Include the current position of a train in the method handler_get_train_state of handler_monitor, which currently only says if the train is on the track, but not where.

If there already is a way to get the segment/block that the train is on, this issue can be closed.

eyip002 commented 2 years ago

Updated implementation of handler_get_train_state. See commit 00818f0 Requires testing on an SWTbahn platform

eyip002 commented 2 years ago

Tested