SafeAPI RBC 2oo2 Generic Application
IL/CTC route and train logic for the safeAPIRBC2oo2 reference RBC
Loading...
Searching...
No Matches
ab_ga_route_fsm.c File Reference

See ab_ga_route_fsm.h. More...

#include "ab_ga_route_fsm.h"
#include "safeapi/oal/log/sapi_log.h"
#include "safeapi/utils/string/sapi_string.h"
Include dependency graph for ab_ga_route_fsm.c:

Go to the source code of this file.

Functions

static ab_ga_route_state_t status_to_state (rbc_il_route_status_t status)
static bool state_is_stub (ab_ga_route_state_t s)
ab_ga_route_fsm_result_t ab_ga_route_fsm_eval (ab_ga_route_state_t from, const ab_ga_il_route_cmd_t *cmd)
 Computes the target state for (from, cmd), WITHOUT logging or touching any storage - pure, for tests and for ab_ga_route_fsm_step() itself.
static const char * state_name (ab_ga_route_state_t s)
static void log_step (uint32_t cycle, const char *role_tag, uint16_t route_id, const ab_ga_route_fsm_result_t *r)
ab_ga_route_fsm_result_t ab_ga_route_fsm_step (ab_gp_db_t *db, uint16_t route_id, const ab_ga_il_route_cmd_t *cmd, uint32_t cycle, const char *role_tag)
 Applies cmd to the route's FSM: reads the current state via ab_gp_db_route_get_fsm_state(), computes the target (ab_ga_route_fsm_eval), logs the transition at INFO (STUB targets logged as "not implemented yet"), and writes the target back via ab_gp_db_route_set_fsm_state().

Detailed Description

See ab_ga_route_fsm.h.

Definition in file ab_ga_route_fsm.c.

Function Documentation

◆ ab_ga_route_fsm_eval()

ab_ga_route_fsm_result_t ab_ga_route_fsm_eval ( ab_ga_route_state_t from,
const ab_ga_il_route_cmd_t * cmd )

Computes the target state for (from, cmd), WITHOUT logging or touching any storage - pure, for tests and for ab_ga_route_fsm_step() itself.

Definition at line 30 of file ab_ga_route_fsm.c.

◆ ab_ga_route_fsm_step()

ab_ga_route_fsm_result_t ab_ga_route_fsm_step ( ab_gp_db_t * db,
uint16_t route_id,
const ab_ga_il_route_cmd_t * cmd,
uint32_t cycle,
const char * role_tag )

Applies cmd to the route's FSM: reads the current state via ab_gp_db_route_get_fsm_state(), computes the target (ab_ga_route_fsm_eval), logs the transition at INFO (STUB targets logged as "not implemented yet"), and writes the target back via ab_gp_db_route_set_fsm_state().

Parameters
[in]dbGP route DB handle (ga_interface.h).
[in]route_idRoute the command concerns (must already be tracked).
[in]cmdDecoded, already-validated IL route command.
[in]cycleCyclic-executive count, for the log line.
[in]role_tagRole string for the log line.
Returns
The transition result (also reflects what was written).

Definition at line 123 of file ab_ga_route_fsm.c.

◆ log_step()

void log_step ( uint32_t cycle,
const char * role_tag,
uint16_t route_id,
const ab_ga_route_fsm_result_t * r )
static

Definition at line 81 of file ab_ga_route_fsm.c.

◆ state_is_stub()

bool state_is_stub ( ab_ga_route_state_t s)
static

Definition at line 25 of file ab_ga_route_fsm.c.

◆ state_name()

const char * state_name ( ab_ga_route_state_t s)
static

Definition at line 66 of file ab_ga_route_fsm.c.

◆ status_to_state()

ab_ga_route_state_t status_to_state ( rbc_il_route_status_t status)
static

Definition at line 11 of file ab_ga_route_fsm.c.