RTE RBC 2oo2 Reference Application
0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Toggle main menu visibility
Loading...
Searching...
No Matches
ab_gp_channel_dual.c
Go to the documentation of this file.
1
5
#include "
ab_gp_channel_dual.h
"
6
7
#include <stdio.h>
8
9
#include "rte/oal/log/rte_log.h"
10
11
#include "
../../common/common_config.h
"
12
14
16
18
20
22
23
25
void
ab_gp_channel_dual_on_transfer_lost
(
void
*context)
26
{
27
ab_gp_channel_context_t
*ctx = (
ab_gp_channel_context_t
*)context;
28
29
if
(!ctx->
single_mode
)
30
{
31
RTE_EXAMPLE_LOG
(
"[%s] dual transfer lost - no peer message within %ums - entering SINGLE mode\n"
, ctx->
role_tag
,
32
(
unsigned
int
)ctx->
config
.
timers
.
dual_transfer_timeout_ms
);
33
rte_log_write_event(RTE_LOG_LEVEL_ERROR,
site_config_name
(ctx->
site
), 0U, ctx->
role_tag
,
"-"
,
"MODE"
,
34
"dual transfer lost - entering SINGLE mode"
, NULL);
35
ctx->
single_mode
=
true
;
36
}
37
}
38
39
const
char
*
ab_gp_channel_dual_role_byte_to_string
(uint8_t role_byte)
40
{
41
if
(role_byte == (uint8_t)
RTE_EXAMPLE_SITE_ROLE_ONLINE
)
42
{
43
return
"ONLINE"
;
44
}
45
if
(role_byte == (uint8_t)
RTE_EXAMPLE_SITE_ROLE_STANDBY
)
46
{
47
return
"STANDBY"
;
48
}
49
if
(role_byte == (uint8_t)
RTE_EXAMPLE_SITE_ROLE_FAULTED
)
50
{
51
return
"FAULTED"
;
52
}
53
return
"UNKNOWN"
;
54
}
ab_gp_channel_dual_role_byte_to_string
const char * ab_gp_channel_dual_role_byte_to_string(uint8_t role_byte)
Definition
ab_gp_channel_dual.c:39
ab_gp_channel_dual_on_transfer_lost
void ab_gp_channel_dual_on_transfer_lost(void *context)
Definition
ab_gp_channel_dual.c:25
ab_gp_channel_dual.h
Everything related to this channel's own "dual transfer" state: the single-mode degradation reaction ...
common_config.h
RTE_EXAMPLE_SITE_ROLE_STANDBY
#define RTE_EXAMPLE_SITE_ROLE_STANDBY
Definition
common_config.h:762
RTE_EXAMPLE_LOG
#define RTE_EXAMPLE_LOG(...)
Definition
common_config.h:20
RTE_EXAMPLE_SITE_ROLE_ONLINE
#define RTE_EXAMPLE_SITE_ROLE_ONLINE
Definition
common_config.h:761
RTE_EXAMPLE_SITE_ROLE_FAULTED
#define RTE_EXAMPLE_SITE_ROLE_FAULTED
Definition
common_config.h:763
site_config_name
const char * site_config_name(rte_example_site_t site)
Definition
site_config.c:52
ab_gp_channel_context_t
Central application context owned by composition root (main.c).
Definition
ab_gp_channel_types.h:155
ab_gp_channel_context_t::single_mode
bool single_mode
Definition
ab_gp_channel_types.h:257
ab_gp_channel_context_t::config
ab_gp_config_t config
Definition
ab_gp_channel_types.h:180
ab_gp_channel_context_t::role_tag
const char * role_tag
Definition
ab_gp_channel_types.h:159
ab_gp_channel_context_t::site
rte_example_site_t site
Definition
ab_gp_channel_types.h:157
ab_gp_config_t::timers
ab_gp_config_timers_t timers
Definition
ab_gp_config.h:55
ab_gp_config_timers_t::dual_transfer_timeout_ms
uint32_t dual_transfer_timeout_ms
Definition
ab_gp_config.h:43
src
application
AB
GP
com
ab_gp_channel_dual.c
Generated by
1.18.0