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_proc_handover.c
Go to the documentation of this file.
1
5
7#include "rte/oal/memory/rte_mem_util.h"
8
9/* REQ-ID: RBC_ERTMS_HO_001 - Handover Context Initialization */
11{
12 if (ctx == NULL)
13 {
14 return;
15 }
16
18 ctx->handover.target_nid_c = 0U;
19 ctx->handover.target_nid_rbc = 0U;
20 ctx->handover.target_nid_radio = 0ULL;
21 ctx->handover.d_rbctr_m = 0U;
22 ctx->handover.order_sent = false;
23}
24
25/* REQ-ID: RBC_ERTMS_HO_002 - Announce Handover Boundary */
27 uint16_t target_nid_c,
28 uint16_t target_nid_rbc,
29 uint64_t target_nid_radio,
30 uint32_t d_rbctr_m)
31{
32 if ((ctx == NULL) || (target_nid_rbc == 0U))
33 {
34 return false;
35 }
36
38 ctx->handover.target_nid_c = target_nid_c;
39 ctx->handover.target_nid_rbc = target_nid_rbc;
40 ctx->handover.target_nid_radio = target_nid_radio;
41 ctx->handover.d_rbctr_m = d_rbctr_m;
42 ctx->handover.order_sent = false;
43
44 return true;
45}
46
47/* REQ-ID: RBC_ERTMS_HO_003 - Packet 131 Generation */
50{
51 if ((ctx == NULL) || (out_p131 == NULL))
52 {
53 return false;
54 }
55
58 {
59 return false;
60 }
61
62 out_p131->d_rbctr = ctx->handover.d_rbctr_m;
63 out_p131->nid_c = ctx->handover.target_nid_c;
64 out_p131->nid_rbc = ctx->handover.target_nid_rbc;
65 out_p131->nid_radio = ctx->handover.target_nid_radio;
66 out_p131->q_sleepingsession = false;
67
69 ctx->handover.order_sent = true;
70
71 return true;
72}
73
74/* REQ-ID: RBC_ERTMS_HO_004 - Handover Completion */
76{
77 if (ctx == NULL)
78 {
79 return false;
80 }
81
83 return true;
84}
85
86/* REQ-ID: RBC_ERTMS_HO_005 - Handover State Query */
88{
89 if (ctx == NULL)
90 {
92 }
93
94 return ctx->handover.state;
95}
96
void ab_gp_proc_handover_init(ab_gp_ertms_train_context_t *ctx)
Initializes handover context for a train slot.
bool ab_gp_proc_handover_announce(ab_gp_ertms_train_context_t *ctx, uint16_t target_nid_c, uint16_t target_nid_rbc, uint64_t target_nid_radio, uint32_t d_rbctr_m)
Announces an upcoming boundary transition to a neighboring RBC.
ab_gp_ertms_handover_state_t ab_gp_proc_handover_get_state(const ab_gp_ertms_train_context_t *ctx)
Returns current handover state for a train.
bool ab_gp_proc_handover_complete(ab_gp_ertms_train_context_t *ctx)
Completes the handover and marks session transferred.
bool ab_gp_proc_handover_generate_packet_131(ab_gp_ertms_train_context_t *ctx, rbc_packet_131_rbc_transition_t *out_p131)
Generates an ERTMS Packet 131 (RBC transition order) payload.
ERTMS Subset-026 ยง5.11 RBC-to-RBC Handover Procedure (Packet 131).
ab_gp_ertms_handover_state_t
Handover execution state machine.
@ AB_GP_HANDOVER_STATE_ORDERED
@ AB_GP_HANDOVER_STATE_ANNOUNCED
@ AB_GP_HANDOVER_STATE_NONE
@ AB_GP_HANDOVER_STATE_COMPLETED
ab_gp_ertms_handover_state_t state
Complete ERTMS state and procedure context for one train slot.
ab_gp_ertms_handover_record_t handover