|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
Route<->train connect logic (GP) + its own GA callback registries - see ab_gp_logic.h. More...
#include "ab_gp_logic.h"#include "rte/utils/lifecycle/rte_lifecycle.h"#include "rte/utils/notify/rte_notify.h"#include "rte/oal/log/rte_log.h"#include "../../common/common_config.h"#include "ab_siteGP.h"#include "../train/ab_gp_train.h"Go to the source code of this file.
Functions | |
| RTE_DECLARE_CALLBACK_LIST (ab_gp_logic_route_validator_list_t, ab_gp_logic_route_validator_fn, AB_GP_LOGIC_MAX_ROUTE_VALIDATORS) | |
| RTE_DECLARE_CALLBACK_LIST (ab_gp_logic_shunting_validator_list_t, ab_gp_logic_shunting_validator_fn, AB_GP_LOGIC_MAX_SHUNTING_VALIDATORS) | |
| static bool | route_validators_all_agree (uint16_t route_id, uint8_t train_id) |
| rte_status_t | ab_gp_ga_register_init (ab_gp_logic_route_validator_fn fn, void *context) |
| rte_status_t | ab_gp_ga_register_shunting_validator (ab_gp_logic_shunting_validator_fn fn, void *context) |
| bool | ab_gp_logic_shunting_allowed (uint8_t train_id) |
Asks every registered shunting validator about train_id. | |
| bool | ab_gp_logic_connect_route_for_train (ab_gp_db_t *db, uint8_t train_id) |
Connects one train's own currently-reported route to it: looks up which route the balise at db->trains[train_id-1].last_nid_lrbg (ab_gp_train_get_last_position(), AB/GP/train/ab_gp_train.h) is placed in (site/'s own static balise table, ab_site.h), asks every registered GA validator whether connecting it to train_id is OK (ab_gp_ga_register_init() above - il/'s own validator is also where a not-yet-tracked route gets added, see that function's own doc), and if approved, connects it (AB/GP/db/ab_gp_db.h's own ab_gp_db_route_connect_train(), which fires its OWN registered-subscriber notification on success - this module itself does not notify GA, see this file's own module doc for why). Idempotent: calling this again with the same still-current position is a safe no-op, not a re-connect (already-connected is detected before any validator call, so it does not fire again for an unchanged position). | |
| void | ab_gp_logic_connect_routes_and_trains (ab_gp_db_t *db) |
| THE cyclic sweep: calls ab_gp_logic_connect_route_for_train() for every currently-connected train (ab_gp_train_is_connected(), AB/GP/train/ab_gp_train.h). Safe to call every cycle unconditionally, whether or not any train reported a new position this cycle - see this function's own idempotence doc above. | |
Variables | |
| static ab_gp_logic_route_validator_list_t | g_validators |
| static ab_gp_logic_shunting_validator_list_t | g_shunting_validators |
Route<->train connect logic (GP) + its own GA callback registries - see ab_gp_logic.h.
Definition in file ab_gp_logic.c.
| RTE_DECLARE_CALLBACK_LIST | ( | ab_gp_logic_route_validator_list_t | , |
| ab_gp_logic_route_validator_fn | , | ||
| AB_GP_LOGIC_MAX_ROUTE_VALIDATORS | ) |
Local makros Local types declarations
| RTE_DECLARE_CALLBACK_LIST | ( | ab_gp_logic_shunting_validator_list_t | , |
| ab_gp_logic_shunting_validator_fn | , | ||
| AB_GP_LOGIC_MAX_SHUNTING_VALIDATORS | ) |
|
static |
Global variables declarations Local function declarations
Definition at line 237 of file ab_gp_logic.c.
| rte_status_t ab_gp_ga_register_init | ( | ab_gp_logic_route_validator_fn | fn, |
| void * | context ) |
Global functions
Definition at line 46 of file ab_gp_logic.c.
| rte_status_t ab_gp_ga_register_shunting_validator | ( | ab_gp_logic_shunting_validator_fn | fn, |
| void * | context ) |
Definition at line 69 of file ab_gp_logic.c.
| bool ab_gp_logic_shunting_allowed | ( | uint8_t | train_id | ) |
Asks every registered shunting validator about train_id.
Definition at line 92 of file ab_gp_logic.c.
| bool ab_gp_logic_connect_route_for_train | ( | ab_gp_db_t * | db, |
| uint8_t | train_id ) |
Connects one train's own currently-reported route to it: looks up which route the balise at db->trains[train_id-1].last_nid_lrbg (ab_gp_train_get_last_position(), AB/GP/train/ab_gp_train.h) is placed in (site/'s own static balise table, ab_site.h), asks every registered GA validator whether connecting it to train_id is OK (ab_gp_ga_register_init() above - il/'s own validator is also where a not-yet-tracked route gets added, see that function's own doc), and if approved, connects it (AB/GP/db/ab_gp_db.h's own ab_gp_db_route_connect_train(), which fires its OWN registered-subscriber notification on success - this module itself does not notify GA, see this file's own module doc for why). Idempotent: calling this again with the same still-current position is a safe no-op, not a re-connect (already-connected is detected before any validator call, so it does not fire again for an unchanged position).
Definition at line 120 of file ab_gp_logic.c.
| void ab_gp_logic_connect_routes_and_trains | ( | ab_gp_db_t * | db | ) |
THE cyclic sweep: calls ab_gp_logic_connect_route_for_train() for every currently-connected train (ab_gp_train_is_connected(), AB/GP/train/ab_gp_train.h). Safe to call every cycle unconditionally, whether or not any train reported a new position this cycle - see this function's own idempotence doc above.
Definition at line 219 of file ab_gp_logic.c.
|
static |
Local variables declarations
Definition at line 33 of file ab_gp_logic.c.
|
static |
Definition at line 34 of file ab_gp_logic.c.