RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Loading...
Searching...
No Matches
ab_gp_train_data_fsm.h File Reference

(state, event) -> state table for ab_gp_train_data_state_t (Subset-026 §5.4 Validated Train Data acceptance) - GP's second per-entity procedure state machine under state_machines/, after session/. More...

#include <stdbool.h>
#include "../ab_gp_event.h"
#include "../../ertms_procedures/ab_gp_ertms_types.h"
Include dependency graph for ab_gp_train_data_fsm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool ab_gp_train_data_fsm_can_handle (ab_gp_train_data_state_t from, ab_gp_event_t event, ab_gp_train_data_state_t *out_to)
 Read-only lookup, no side effect.
bool ab_gp_train_data_fsm_handle_event (ab_gp_ertms_train_context_t *ctx, ab_gp_event_t event)
 Applies event to ctx->train_data.state, and keeps ctx->train_data.valid in sync (true iff the new state is AB_GP_TRAIN_DATA_VALIDATED).

Detailed Description

(state, event) -> state table for ab_gp_train_data_state_t (Subset-026 §5.4 Validated Train Data acceptance) - GP's second per-entity procedure state machine under state_machines/, after session/.

Same design as session/ (see ab_gp_session_fsm.h and ab_gp_event.h): a procedure fires a named ab_gp_event_t through ab_gp_dispatch(); this FSM is one subscriber and reacts only to the train-data events. It does NOT choose a target state - the table below does.

The transitions are given as an explicit { from, event, to } list rather than session/'s dense 2D array: this FSM reacts to only 3 of the ~14 shared events, so a dense row would be mostly "no outcome" padding and the column index would have to be counted against ab_gp_event_t by hand. The list keeps every transition readable in one place without that. It stays a pure table lookup (no per-transition code).

ab_gp_ertms_train_data_t.valid is kept as a derived mirror of "state == AB_GP_TRAIN_DATA_VALIDATED" by ab_gp_proc_train_data.c's own call sites, so nothing that reads .valid today has to change.

Definition in file ab_gp_train_data_fsm.h.

Function Documentation

◆ ab_gp_train_data_fsm_can_handle()

bool ab_gp_train_data_fsm_can_handle ( ab_gp_train_data_state_t from,
ab_gp_event_t event,
ab_gp_train_data_state_t * out_to )

Read-only lookup, no side effect.

Parameters
[in]fromCurrent train-data state.
[in]eventEvent to evaluate.
[out]out_toReceives the resulting state on success; untouched otherwise. May be NULL.
Returns
true and *out_to set if this table defines an outcome for (from, event); false otherwise (out-of-range, or an event this FSM does not react to from that state).

Definition at line 52 of file ab_gp_train_data_fsm.c.

◆ ab_gp_train_data_fsm_handle_event()

bool ab_gp_train_data_fsm_handle_event ( ab_gp_ertms_train_context_t * ctx,
ab_gp_event_t event )

Applies event to ctx->train_data.state, and keeps ctx->train_data.valid in sync (true iff the new state is AB_GP_TRAIN_DATA_VALIDATED).

Parameters
[in,out]ctxTrain context. NULL -> returns false, no change.
[in]eventEvent to apply. An event this FSM does not react to from the current state -> returns false, no change (not an error - it is simply not one of this FSM's).
Returns
true and state (and .valid) updated on a defined transition; false and everything left unchanged otherwise. Signature matches ab_gp_fsm_handler_fn (ab_gp_dispatch.h) so this is a valid subscription-table entry.

Definition at line 118 of file ab_gp_train_data_fsm.c.