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
Go to the documentation of this file.
1
20
21#ifndef AB_GP_ERTMS_TRAIN_PACKET_CODEC_H
22#define AB_GP_ERTMS_TRAIN_PACKET_CODEC_H
23
24#include <stddef.h>
25#include <stdint.h>
26#include <stdbool.h>
27
29
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35/* ========================================================================= */
36/* Low-level bounded big-endian byte primitives. */
37/* */
38/* Shared by the per-packet functions below AND by */
39/* ab_gp_ertms_train_message_codec.c's own message-header encode/decode - a */
40/* message header is not itself a Subset-026 "packet" so it has no */
41/* dedicated function here, but needs the same bounds-checked primitives. */
42/* ========================================================================= */
43bool rbc_codec_read_u8(const uint8_t *buf, size_t len, size_t *offset, uint8_t *val);
44bool rbc_codec_read_u16_be(const uint8_t *buf, size_t len, size_t *offset, uint16_t *val);
45bool rbc_codec_read_u32_be(const uint8_t *buf, size_t len, size_t *offset, uint32_t *val);
46bool rbc_codec_write_u8(uint8_t *buf, size_t cap, size_t *offset, uint8_t val);
47bool rbc_codec_write_u16_be(uint8_t *buf, size_t cap, size_t *offset, uint16_t val);
48bool rbc_codec_write_u32_be(uint8_t *buf, size_t cap, size_t *offset, uint32_t val);
49bool rbc_codec_write_u64_be(uint8_t *buf, size_t cap, size_t *offset, uint64_t val);
50
51/* ========================================================================= */
52/* Packet decode (Train -> RBC): Packet 0 / Packet 1, carried bare (Msg */
53/* 129/130/132) or behind a leading NID_PACKET choice byte (Msg 136). */
54/* ========================================================================= */
55bool rbc_packet_read_0_position_report(const uint8_t *buf, size_t len, size_t *offset,
57bool rbc_packet_read_1_position_report_2bg(const uint8_t *buf, size_t len, size_t *offset,
59
60/* ========================================================================= */
61/* Packet encode (RBC -> Train), one per optional/mandatory packet a */
62/* track-to-train message can carry. */
63/* ========================================================================= */
64bool rbc_packet_write_15_ma(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_15_ma_t *ma);
65bool rbc_packet_write_21_gradient_profile(uint8_t *buf, size_t cap, size_t *offset,
66 const rbc_packet_21_gradient_profile_t *gradient);
67bool rbc_packet_write_27_ssp(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_27_ssp_t *ssp);
68bool rbc_packet_write_5_linking(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_5_linking_t *linking);
69bool rbc_packet_write_3_national_values(uint8_t *buf, size_t cap, size_t *offset,
71bool rbc_packet_write_57_ma_request_params(uint8_t *buf, size_t cap, size_t *offset,
73bool rbc_packet_write_58_pr_params(uint8_t *buf, size_t cap, size_t *offset,
74 const rbc_packet_58_pr_params_t *params);
75bool rbc_packet_write_65_tsr(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_65_tsr_t *tsr);
76bool rbc_packet_write_66_tsr_revoke(uint8_t *buf, size_t cap, size_t *offset,
77 const rbc_packet_66_tsr_revoke_t *revoke);
78bool rbc_packet_write_72_text_message(uint8_t *buf, size_t cap, size_t *offset,
88bool rbc_packet_write_131_rbc_transition(uint8_t *buf, size_t cap, size_t *offset,
89 const rbc_packet_131_rbc_transition_t *transition);
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif /* RBC_TRAIN_PACKET_CODEC_H */
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_57_ma_request_params(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_57_ma_request_params_t *params)
bool rbc_codec_read_u8(const uint8_t *buf, size_t len, size_t *offset, uint8_t *val)
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...
bool rbc_codec_write_u8(uint8_t *buf, size_t cap, size_t *offset, uint8_t val)
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_codec_read_u32_be(const uint8_t *buf, size_t len, size_t *offset, uint32_t *val)
bool rbc_codec_read_u16_be(const uint8_t *buf, size_t len, size_t *offset, uint16_t *val)
bool rbc_packet_write_27_ssp(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_27_ssp_t *ssp)
bool rbc_codec_write_u16_be(uint8_t *buf, size_t cap, size_t *offset, uint16_t val)
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_5_linking(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_5_linking_t *linking)
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_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_3_national_values(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_3_national_values_t *nv)
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_codec_write_u64_be(uint8_t *buf, size_t cap, size_t *offset, uint64_t val)
bool rbc_packet_write_15_ma(uint8_t *buf, size_t cap, size_t *offset, const rbc_packet_15_ma_t *ma)
bool rbc_codec_write_u32_be(uint8_t *buf, size_t cap, size_t *offset, uint32_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)