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_ertms_train_packet_codec.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "ab_gp_ertms_train_packets.h"
Include dependency graph for ab_gp_ertms_train_packet_codec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool rbc_codec_read_u8 (const uint8_t *buf, size_t len, size_t *offset, uint8_t *val)
bool rbc_codec_read_u16_be (const uint8_t *buf, size_t len, size_t *offset, uint16_t *val)
bool rbc_codec_read_u32_be (const uint8_t *buf, size_t len, size_t *offset, uint32_t *val)
bool rbc_codec_write_u8 (uint8_t *buf, size_t cap, size_t *offset, uint8_t val)
bool rbc_codec_write_u16_be (uint8_t *buf, size_t cap, size_t *offset, uint16_t val)
bool rbc_codec_write_u32_be (uint8_t *buf, size_t cap, size_t *offset, uint32_t val)
bool rbc_codec_write_u64_be (uint8_t *buf, size_t cap, size_t *offset, uint64_t val)
bool rbc_packet_read_0_position_report (const uint8_t *buf, size_t len, size_t *offset, rbc_packet_0_position_report_t *out_p0)
bool rbc_packet_read_1_position_report_2bg (const uint8_t *buf, size_t len, size_t *offset, rbc_packet_1_position_report_2bg_t *out_p1)
bool rbc_packet_write_15_ma (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_15_ma_t *ma)
bool rbc_packet_write_21_gradient_profile (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_21_gradient_profile_t *gradient)
bool rbc_packet_write_27_ssp (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_27_ssp_t *ssp)
bool rbc_packet_write_5_linking (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_5_linking_t *linking)
bool rbc_packet_write_3_national_values (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_3_national_values_t *nv)
bool rbc_packet_write_57_ma_request_params (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_57_ma_request_params_t *params)
bool rbc_packet_write_58_pr_params (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_58_pr_params_t *params)
bool rbc_packet_write_65_tsr (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_65_tsr_t *tsr)
bool rbc_packet_write_66_tsr_revoke (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_66_tsr_revoke_t *revoke)
bool rbc_packet_write_72_text_message (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_72_text_message_t *text)
bool rbc_packet_write_131_rbc_transition (uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_131_rbc_transition_t *transition)
 Encodes Packet 131 (RBC Transition Order). NOTE: only d_rbctr/nid_c/ nid_rbc/nid_radio are written to the wire - transition->q_sleepingsession is deliberately NOT encoded (Msg 33's own field set, the only caller today, never modeled it either; keeping the wire format unchanged rather than silently growing it while lifting this code out of ab_gp_ertms_train_message_codec.c's old inline Msg 33 case).

Function Documentation

◆ rbc_codec_read_u8()

bool rbc_codec_read_u8 ( const uint8_t * buf,
size_t len,
size_t * offset,
uint8_t * val )

Definition at line 13 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_codec_read_u16_be()

bool rbc_codec_read_u16_be ( const uint8_t * buf,
size_t len,
size_t * offset,
uint16_t * val )

Definition at line 24 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_codec_read_u32_be()

bool rbc_codec_read_u32_be ( const uint8_t * buf,
size_t len,
size_t * offset,
uint32_t * val )

Definition at line 35 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_codec_write_u8()

bool rbc_codec_write_u8 ( uint8_t * buf,
size_t cap,
size_t * offset,
uint8_t val )

Definition at line 49 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_codec_write_u16_be()

bool rbc_codec_write_u16_be ( uint8_t * buf,
size_t cap,
size_t * offset,
uint16_t val )

Definition at line 60 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_codec_write_u32_be()

bool rbc_codec_write_u32_be ( uint8_t * buf,
size_t cap,
size_t * offset,
uint32_t val )

Definition at line 72 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_codec_write_u64_be()

bool rbc_codec_write_u64_be ( uint8_t * buf,
size_t cap,
size_t * offset,
uint64_t val )

64-bit big-endian write, split into two rbc_codec_write_u32_be() calls (high word first) - needed only by NID_RADIO (Msg 33's own transition target radio number / Packet 131's own field), the sole 64-bit field in the track-to-train direction today.

Definition at line 90 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_read_0_position_report()

bool rbc_packet_read_0_position_report ( const uint8_t * buf,
size_t len,
size_t * offset,
rbc_packet_0_position_report_t * out_p0 )

Reads the FULL Subset-026 Packet 0 (Position Report) field set every Train-to-Track message that carries one uses (Msg 129/130/132/136/150) - q_scale, nid_lrbg, d_lrbg, q_dirlrbg, q_dlrbg, l_doubtover, l_doubtunder, v_train, m_mode, m_level, matching rbc_packet_0_position_report_t's own field order exactly. Was a pragmatic reduced subset (nid_lrbg/d_lrbg/ v_train/m_mode/m_level only) until this session's own wire-format extension, on direct request - q_scale/q_dirlrbg/q_dlrbg/l_doubtover/ l_doubtunder were never encoded/decoded anywhere before this. The Python mirror (TrainRBCSim's rbc_ertms_wire.py, _POSITION_REPORT) MUST be kept byte-identical - see that file's own doc.

Definition at line 112 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_read_1_position_report_2bg()

bool rbc_packet_read_1_position_report_2bg ( const uint8_t * buf,
size_t len,
size_t * offset,
rbc_packet_1_position_report_2bg_t * out_p1 )

Packet 1's own reduced field subset (nid_lrbg, d_lrbg, v_train, m_mode, m_level - real Subset-026 Packet 1 has no q_scale/q_dirlrbg/q_dlrbg/ l_doubtover/l_doubtunder of its own, unlike Packet 0 above), plus the one extra field Packet 1 adds (NID_PRVLRBG, itself a NID_C+NID_BG pair like NID_LRBG) - see rbc_packet_1_position_report_2bg_t's own doc. Only Msg 136 ever carries this variant today.

Definition at line 163 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_15_ma()

bool rbc_packet_write_15_ma ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_15_ma_t * ma )

Definition at line 203 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_21_gradient_profile()

bool rbc_packet_write_21_gradient_profile ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_21_gradient_profile_t * gradient )

Definition at line 216 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_27_ssp()

bool rbc_packet_write_27_ssp ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_27_ssp_t * ssp )

Definition at line 241 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_5_linking()

bool rbc_packet_write_5_linking ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_5_linking_t * linking )

Definition at line 265 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_3_national_values()

bool rbc_packet_write_3_national_values ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_3_national_values_t * nv )

Definition at line 290 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_57_ma_request_params()

bool rbc_packet_write_57_ma_request_params ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_57_ma_request_params_t * params )

Definition at line 305 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_58_pr_params()

bool rbc_packet_write_58_pr_params ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_58_pr_params_t * params )

Definition at line 317 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_65_tsr()

bool rbc_packet_write_65_tsr ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_65_tsr_t * tsr )

Definition at line 329 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_66_tsr_revoke()

bool rbc_packet_write_66_tsr_revoke ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_66_tsr_revoke_t * revoke )

Definition at line 343 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_72_text_message()

bool rbc_packet_write_72_text_message ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_72_text_message_t * text )

Definition at line 354 of file ab_gp_ertms_train_packet_codec.c.

◆ rbc_packet_write_131_rbc_transition()

bool rbc_packet_write_131_rbc_transition ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_packet_131_rbc_transition_t * transition )

Encodes Packet 131 (RBC Transition Order). NOTE: only d_rbctr/nid_c/ nid_rbc/nid_radio are written to the wire - transition->q_sleepingsession is deliberately NOT encoded (Msg 33's own field set, the only caller today, never modeled it either; keeping the wire format unchanged rather than silently growing it while lifting this code out of ab_gp_ertms_train_message_codec.c's old inline Msg 33 case).

Definition at line 385 of file ab_gp_ertms_train_packet_codec.c.