8#include "rte/oal/log/rte_log.h"
10#include "common_config.h"
26 const ab_gp_train_session_t *sessions;
52 if (status == RTE_STATUS_OK)
58 if (status == RTE_STATUS_OK)
68 if (status != RTE_STATUS_OK)
70 RTE_EXAMPLE_LOG(
"[%s] GA registration -> %s\n", role_tag, rte_status_to_string(status));
71 rte_log_write_event(RTE_LOG_LEVEL_ERROR, site_config_name(site), 0U, role_tag,
"-",
"GA",
72 "GA registration failed", NULL);
85 ab_gp_route_context_t prev_ctx;
91 if (ab_gp_db_get_route_context(db, layout->
prev_route_id, &prev_ctx))
93 if (prev_ctx.used_in_ma && (prev_ctx.train_id == train_id))
101 for (i = 0U; i < ab_site_ga_track_layout_count; i++)
107 if (prev_ctx.used_in_ma && (prev_ctx.train_id == train_id))
131 const ab_gp_db_t *db = (
const ab_gp_db_t *)context;
133 uint32_t last_nid_lrbg = 0U;
134 bool balise_found =
false;
141 if (!ab_gp_db_route_exists(db, route_id))
146 if (ab_gp_train_get_last_position(db, train_id, &last_nid_lrbg) && (last_nid_lrbg != 0U))
157 0U,
"GA",
"GP",
"ROUTE_VALIDATION",
158 "train's last position matches route balise", NULL);
168 0U,
"GA",
"GP",
"ROUTE_VALIDATION",
169 "route is extension of route held by train", NULL);
174 0U,
"GA",
"GP",
"ROUTE_VALIDATION",
175 "train's last position does NOT match any route balise and not an extension", NULL);
190 ab_gp_train_context_t train_ctx;
192 if ((sc == NULL) || (sc->sessions == NULL) || (sc->db == NULL)
193 || !ab_gp_get_train_context(sc->sessions, sc->db, train_id, &train_ctx))
197 if ((train_ctx.route_count > 0U) || train_ctx.has_ma)
199 rte_log_write_event(RTE_LOG_LEVEL_INFO,
g_ga_role_tag, 0U,
"GA",
"GP",
"SHUNTING_VALIDATION",
200 "SH refused: train holds a route or an active MA", NULL);
rte_status_t ab_ga_dispatch_init(ab_gp_train_session_t *sessions, ab_gp_db_t *db)
Registers every GA<->GP subscription this process needs, in one place: route-context notify,...
GA's single GP-notification subscriber AND registration point for everything GP calls into GA with - ...
bool ab_ga_il_site_has_route(uint16_t route_id, const ab_site_ga_route_layout_t **out_layout)
Pure site-layout lookup - does route_id exist in this site's own static track layout at all (ab_site_...
A/B's own route handling against GP's own runtime table (via AB/GP/ga_interface/ga_interface....
static bool validate_shunting_request(void *context, uint8_t train_id)
static bool validate_route_assignment(void *context, uint16_t route_id, uint8_t train_id)
static bool train_holds_preceding_route(const ab_gp_db_t *db, const ab_site_ga_route_layout_t *layout, uint8_t train_id)
Checks if the given train already holds a preceding route connecting to layout.
static ab_ga_shunting_context_t g_shunting_context
rte_status_t ab_ga_ma_adaptation_init(ab_gp_train_session_t *sessions, ab_gp_db_t *db, rte_example_site_t site, const char *role_tag)
GA's own single entry point, IMPLEMENTED here - ab_ga_ma_adaptation_init() is DECLARED in AB/GP/ga_in...
GA's own site data: route composition, built from GP's raw physical elements (railML interlocking <ro...
const ab_site_ga_route_layout_t ab_site_ga_track_layout[]
One route's static layout entry (railML interlocking <route>) - GA's own full definition (not a reduc...
uint32_t balise_nid_lrbgs[RTE_EXAMPLE_MAX_BALISES_PER_ROUTE]