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_message_codec.c File Reference

ERTMS/ETCS Level 2 Message-Level Codec Implementation (GP). More...

#include "ab_gp_ertms_train_message_codec.h"
#include "ab_gp_ertms_train_packet_codec.h"
#include "rte/oal/memory/rte_mem_util.h"
Include dependency graph for ab_gp_ertms_train_message_codec.c:

Go to the source code of this file.

Functions

static void write_track_to_train_header (uint8_t *buf, size_t cap, size_t *offset, const rbc_track_to_train_header_t *h)
bool rbc_train_codec_encode_track_to_train (const rbc_train_outbound_msg_t *msg, uint8_t *out_buffer, size_t buffer_size, size_t *out_bytes_written)
 Encodes an outbound Track-to-Train message (Msg 2, 3, 6, 8, 9, 15, 16, 18, 24, 33, 34, 41) into wire bytes.
bool rbc_train_codec_decode_train_to_track (const uint8_t *in_buffer, size_t buffer_size, rbc_train_inbound_msg_t *out_msg)
 Decodes an inbound Train-to-Track message (Msg 129, 130, 132, 136, 146, 147, 150, 155, 156, 159) from wire bytes.

Detailed Description

ERTMS/ETCS Level 2 Message-Level Codec Implementation (GP).

See ab_gp_ertms_train_message_codec.h for this file's role relative to ab_gp_ertms_train_packet_codec.c - this file owns message structure (which packets a NID_MESSAGE carries, in what order, any has_X optionality) and calls into that one for every packet's own wire layout, so a packet shared by more than one message (Packet 15/MA: Msg 3 and Msg 9) is encoded once.

Definition in file ab_gp_ertms_train_message_codec.c.

Function Documentation

◆ write_track_to_train_header()

void write_track_to_train_header ( uint8_t * buf,
size_t cap,
size_t * offset,
const rbc_track_to_train_header_t * h )
static

Writes the common Track-to-Train radio header (Subset-026 8.4.1) shared by every case in rbc_train_codec_encode_track_to_train()'s own switch.

Definition at line 19 of file ab_gp_ertms_train_message_codec.c.

◆ rbc_train_codec_encode_track_to_train()

bool rbc_train_codec_encode_track_to_train ( const rbc_train_outbound_msg_t * msg,
uint8_t * out_buffer,
size_t buffer_size,
size_t * out_bytes_written )

Encodes an outbound Track-to-Train message (Msg 2, 3, 6, 8, 9, 15, 16, 18, 24, 33, 34, 41) into wire bytes.

Parameters
[in]msgStructured message to encode.
[out]out_bufferTarget buffer to receive encoded bytes.
[in]buffer_sizeCapacity of out_buffer (must be >= RBC_TRAIN_MAX_WIRE_MSG_SIZE).
[out]out_bytes_writtenReturns actual number of bytes written.
Returns
true on success, false if buffer too small or parameters invalid.

Definition at line 30 of file ab_gp_ertms_train_message_codec.c.

◆ rbc_train_codec_decode_train_to_track()

bool rbc_train_codec_decode_train_to_track ( const uint8_t * in_buffer,
size_t buffer_size,
rbc_train_inbound_msg_t * out_msg )

Decodes an inbound Train-to-Track message (Msg 129, 130, 132, 136, 146, 147, 150, 155, 156, 159) from wire bytes.

Parameters
[in]in_bufferInput raw wire bytes.
[in]buffer_sizeNumber of bytes available in in_buffer.
[out]out_msgTarget structured message struct to populate.
Returns
true on success, false if format is invalid or corrupted.

Definition at line 264 of file ab_gp_ertms_train_message_codec.c.