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.c File Reference

See ab_gp_train_data_fsm.h for this table's design rationale. More...

#include "ab_gp_train_data_fsm.h"
#include "rte/oal/log/rte_log.h"
#include "rte/utils/string/rte_string.h"
Include dependency graph for ab_gp_train_data_fsm.c:

Go to the source code of this file.

Data Structures

struct  [struct].s_transitions
 The full transition set as { from, event, to } triples - every (state, event) pair NOT listed here has no outcome (the event does nothing from that state; not an error). More...

Macros

#define AB_GP_TRAIN_DATA_FSM_TRANSITION_COUNT   (sizeof(s_transitions) / sizeof(s_transitions[0]))

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.
static const char * state_name (ab_gp_train_data_state_t state)
static void log_event (const ab_gp_ertms_train_context_t *ctx, ab_gp_event_t event, bool handled, ab_gp_train_data_state_t to)
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).

Variables

static const struct  s_transitions []

Detailed Description

See ab_gp_train_data_fsm.h for this table's design rationale.

Definition in file ab_gp_train_data_fsm.c.

Macro Definition Documentation

◆ AB_GP_TRAIN_DATA_FSM_TRANSITION_COUNT

#define AB_GP_TRAIN_DATA_FSM_TRANSITION_COUNT   (sizeof(s_transitions) / sizeof(s_transitions[0]))

Definition at line 49 of file ab_gp_train_data_fsm.c.

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.

◆ state_name()

const char * state_name ( ab_gp_train_data_state_t state)
static

Short fixed names for the debug log line only.

Definition at line 72 of file ab_gp_train_data_fsm.c.

◆ log_event()

void log_event ( const ab_gp_ertms_train_context_t * ctx,
ab_gp_event_t event,
bool handled,
ab_gp_train_data_state_t to )
static

Debug line for every handled/not-handled call - same posture as ab_gp_session_fsm.c's log_event().

Definition at line 86 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.

Variable Documentation

◆ s_transitions

const struct [struct].s_transitions s_transitions[]
Initial value:
= {
}
@ AB_GP_EVENT_TRAIN_DATA_REJECTED
Definition ab_gp_event.h:73
@ AB_GP_SESSION_EVENT_TRAIN_DATA_VALIDATED
Definition ab_gp_event.h:57
@ AB_GP_EVENT_TRAIN_DATA_RECEIVED
Definition ab_gp_event.h:72
@ AB_GP_TRAIN_DATA_NONE
@ AB_GP_TRAIN_DATA_RECEIVED
@ AB_GP_TRAIN_DATA_VALIDATED
@ AB_GP_TRAIN_DATA_REJECTED