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
gateway_c_selfstatus.h File Reference

ADR-038: a role-C gateway service's own periodic status - a self log line plus a PUBLISH(STATUS) rbc_util_frame_t to the C-side broker (rte_gateway_c_status). Wired in by gateway_c_common when a service's gateway_c_service_def_t sets broker_channel. More...

#include "gateway_c_types.h"
Include dependency graph for gateway_c_selfstatus.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void gateway_c_selfstatus_init (const char *broker_channel_name)
 Setup the broker CONNECT link. broker_channel_name is one of "c-broker-train"/"-il"/"-ctc". Best-effort - a failure is logged, not fatal (status is non-safety).
void gateway_c_selfstatus_tick (const gateway_c_context_t *ctx, uint32_t cycle, const char *log_tag, uint8_t src_id)
 Call once per cycle. Every RTE_EXAMPLE_STATUS_PERIOD_MS (and on cycle 1) logs [unit] [-] [STATUS] [self] [unit=GW-<tag>/<site> up=1] and publishes the same payload to the broker.
void gateway_c_selfstatus_publish (uint8_t src_id, const char *payload)
 Republish a foreign unit's status to the C broker as a PUBLISH(STATUS) with source id src_id (rbc_util_source_t). Used by the train/il/ctc handlers to forward a sim's own-perspective status (RBC_MSG_SIM_STATUS, received on the sim link) into the broker. No-op when no broker link is set up or payload is NULL.
void gateway_c_selfstatus_shutdown (void)

Detailed Description

ADR-038: a role-C gateway service's own periodic status - a self log line plus a PUBLISH(STATUS) rbc_util_frame_t to the C-side broker (rte_gateway_c_status). Wired in by gateway_c_common when a service's gateway_c_service_def_t sets broker_channel.

Definition in file gateway_c_selfstatus.h.

Function Documentation

◆ gateway_c_selfstatus_init()

void gateway_c_selfstatus_init ( const char * broker_channel_name)

Setup the broker CONNECT link. broker_channel_name is one of "c-broker-train"/"-il"/"-ctc". Best-effort - a failure is logged, not fatal (status is non-safety).

Definition at line 23 of file gateway_c_selfstatus.c.

◆ gateway_c_selfstatus_tick()

void gateway_c_selfstatus_tick ( const gateway_c_context_t * ctx,
uint32_t cycle,
const char * log_tag,
uint8_t src_id )

Call once per cycle. Every RTE_EXAMPLE_STATUS_PERIOD_MS (and on cycle 1) logs [unit] [-] [STATUS] [self] [unit=GW-<tag>/<site> up=1] and publishes the same payload to the broker.

Parameters
ctxGateway context (site + log tag via the def).
cycleThis service's cycle counter.
log_tagThe service's log tag ("TRAIN"/"IL"/"CTC").
src_idrbc_util_source_t for this service.

Definition at line 42 of file gateway_c_selfstatus.c.

◆ gateway_c_selfstatus_publish()

void gateway_c_selfstatus_publish ( uint8_t src_id,
const char * payload )

Republish a foreign unit's status to the C broker as a PUBLISH(STATUS) with source id src_id (rbc_util_source_t). Used by the train/il/ctc handlers to forward a sim's own-perspective status (RBC_MSG_SIM_STATUS, received on the sim link) into the broker. No-op when no broker link is set up or payload is NULL.

Definition at line 76 of file gateway_c_selfstatus.c.

◆ gateway_c_selfstatus_shutdown()

void gateway_c_selfstatus_shutdown ( void )

Definition at line 89 of file gateway_c_selfstatus.c.