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

Reverser status cannot be read if no train is on the reverser #120

Closed BLuedtke closed 1 year ago

BLuedtke commented 1 year ago

Via the request on endpoint monitor/reversers, we should be able to get status information on the reversers. For this, the startup command must've been sent before, and there must exist at least one reverser on the track and in the config.

On our SWTbahn-Full, we only get the expected reply (containing the reverser status) iff a train is on the segments related to/wired to the reverser. If a train is somewhere else on the track, we get OCS_NOT_IMPLEMENTED (i.e. line 432) and the server logs Request: Get reversers - unable to request state update. In other words, the reversers_state_update call returns true.

From looking at the reversers_state_update implementation, the way that the return works does not reveal where exactly the error occurred. Either bidib_request_reverser_state returns the error, or all queries that succeed have the state value BIDIB_REV_EXEC_STATE_UNKNOWN.

My suspicion is that this is either due to libbidib, or the protocol working in a different way than expected.

eyip002 commented 1 year ago

Fixed in https://github.com/uniba-swt/libbidib/commit/c192a65474030e152f1e35aa1ed3c5bbfb4427d7