|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
See ab_gp_session_fsm.h for this table's own design rationale. More...
#include "ab_gp_session_fsm.h"#include "rte/oal/log/rte_log.h"#include "rte/utils/string/rte_string.h"Go to the source code of this file.
Macros | |
| #define | AB_GP_SESSION_FSM_STATE_COUNT 9U |
| #define | AB_GP_SESSION_FSM_NONE (-1) |
Functions | |
| bool | ab_gp_session_fsm_can_handle (ab_gp_ertms_session_state_t from, ab_gp_session_event_t event, ab_gp_ertms_session_state_t *out_to) |
| Read-only lookup, no side effect: what event does from a given state produce, if anything. | |
| static const char * | state_name (ab_gp_ertms_session_state_t state) |
| static const char * | event_name (ab_gp_session_event_t event) |
| static void | log_event (const ab_gp_ertms_train_context_t *ctx, ab_gp_session_event_t event, bool handled, ab_gp_ertms_session_state_t to) |
| bool | ab_gp_session_fsm_handle_event (ab_gp_ertms_train_context_t *ctx, ab_gp_session_event_t event) |
| Applies event to ctx->session_state. | |
Variables | |
| static const int8_t | s_table [AB_GP_SESSION_FSM_STATE_COUNT][AB_GP_SESSION_EVENT_COUNT] |
| s_table[from][event] is the resulting state, or AB_GP_SESSION_FSM_NONE if this table defines no outcome for that (state, event) pair (the event does nothing from that state - not an error, just "not applicable here"). Indexed by ab_gp_ertms_session_state_t / ab_gp_session_event_t's own numeric values - keep row/column order in sync with those enums' declaration order if either ever changes (the two _COUNT constants too). | |
See ab_gp_session_fsm.h for this table's own design rationale.
Definition in file ab_gp_session_fsm.c.
| #define AB_GP_SESSION_FSM_STATE_COUNT 9U |
Definition at line 11 of file ab_gp_session_fsm.c.
| #define AB_GP_SESSION_FSM_NONE (-1) |
Definition at line 12 of file ab_gp_session_fsm.c.
| bool ab_gp_session_fsm_can_handle | ( | ab_gp_ertms_session_state_t | from, |
| ab_gp_session_event_t | event, | ||
| ab_gp_ertms_session_state_t * | out_to ) |
Read-only lookup, no side effect: what event does from a given state produce, if anything.
| [in] | from | Current state. |
| [in] | event | Event to evaluate. |
| [out] | out_to | Receives the resulting state on success. Left untouched on failure. May be NULL if the caller only wants the yes/no answer (e.g. a procedure checking whether to bother doing its own work before firing the event for real). |
Definition at line 211 of file ab_gp_session_fsm.c.
|
static |
Short, fixed names for log lines only - not used anywhere the table itself is evaluated. Falls back to "UNKNOWN" for an out-of-range value rather than indexing an array, so a corrupted/garbage state can never read out of bounds here.
Definition at line 236 of file ab_gp_session_fsm.c.
|
static |
Definition at line 253 of file ab_gp_session_fsm.c.
|
static |
Debug-level line for every ab_gp_session_fsm_handle_event() call, applied or not - the one place this whole table is exercised from, so this is the one place that needs to log to make every real event (not just the ones that produced a transition) observable. Built with rte_string's bounded API (ADR-006), not snprintf. A formatting failure (should not happen: the fixed literals, a 3-digit train_id and two state names always fit storage[]) silently skips the log line rather than risk writing a truncated/garbled one.
Definition at line 281 of file ab_gp_session_fsm.c.
| bool ab_gp_session_fsm_handle_event | ( | ab_gp_ertms_train_context_t * | ctx, |
| ab_gp_session_event_t | event ) |
Applies event to ctx->session_state.
| [in,out] | ctx | Train context whose session_state is (maybe) updated. Must not be NULL. |
| [in] | event | Event to apply. |
Definition at line 314 of file ab_gp_session_fsm.c.
|
static |
s_table[from][event] is the resulting state, or AB_GP_SESSION_FSM_NONE if this table defines no outcome for that (state, event) pair (the event does nothing from that state - not an error, just "not applicable here"). Indexed by ab_gp_ertms_session_state_t / ab_gp_session_event_t's own numeric values - keep row/column order in sync with those enums' declaration order if either ever changes (the two _COUNT constants too).
Read a row as "everything event E can do while in state S"; read a column as "every state this event can produce, and from where" - both directly visible without tracing any ertms_procedures/ file.
Definition at line 28 of file ab_gp_session_fsm.c.