library/PCUIF_CodecPort.ttcn: strip padding bytes from PCUIF_data

In Ieefa61232eb215a19a02e490255332e28e23b8f8, I had to revert
I5808954b5c67c3239e795e43ae77035152d359ef, because that change
broke encoding of messages on the PCU interface.

Since we cannot use 'PADDING' attribute until its implementation
is fixed in TITAN, let's work this around by stripping padding
bytes manually in UD_to_PCUIF().

Change-Id: Ibd698094c897d395208e80189457444a91018beb
This commit is contained in:
Vadim Yanitskiy 2019-09-18 15:22:32 +07:00 committed by fixeria
parent c524849e2d
commit 799cd3f55b
1 changed files with 10 additions and 0 deletions

View File

@ -26,9 +26,19 @@ private function PCUIF_to_UD(in PCUIF_send_data pin, out UD_send_data pout) {
pout.data := enc_PCUIF_Message(pin.data);
} with { extension "prototype(fast)" };
private function fix_padding(inout PCUIF_data data) {
data.data := substr(data.data, 0, data.len);
}
private function UD_to_PCUIF(in UD_send_data pin, out PCUIF_send_data pout) {
pout.id := pin.id;
pout.data := dec_PCUIF_Message(pin.data);
/* HACK: fix padding in decoded message. Due to a bug in TITAN, we
* cannot just use its 'PADDING' attribute because it breaks decoding. */
if (ischosen(pout.data.u.data_req)) { fix_padding(pout.data.u.data_req); }
if (ischosen(pout.data.u.data_cnf)) { fix_padding(pout.data.u.data_cnf); }
if (ischosen(pout.data.u.data_ind)) { fix_padding(pout.data.u.data_ind); }
} with { extension "prototype(fast)" };
type port PCUIF_CODEC_PT message {