From 57fb9afea4c1db9d33c4ba94a681a36b0f80af40 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 2 Nov 2020 14:01:00 +0100 Subject: FIG0/13 fix user application data length for packet subchannels --- src/fig/FIG0_13.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/fig/FIG0_13.cpp b/src/fig/FIG0_13.cpp index 2fa9a54..5cd046c 100644 --- a/src/fig/FIG0_13.cpp +++ b/src/fig/FIG0_13.cpp @@ -101,26 +101,23 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) const size_t num_apps = uaTypes.size(); - const size_t xpadapp_length = 2; static_assert(sizeof(FIG0_13_shortAppInfo) == 3); static_assert(sizeof(FIG0_13_longAppInfo) == 5); static_assert(sizeof(FIG0_13_app) == 2); + size_t xpaddata_length = 0; int required_size = 0; if (m_transmit_programme) { required_size += sizeof(FIG0_13_shortAppInfo); + xpaddata_length = 2; // CAOrg is always absent } else { required_size += sizeof(FIG0_13_longAppInfo); + xpaddata_length = 0; // X-PAD data field is absent } for (const auto& ua : uaTypes) { - if (m_transmit_programme) { - required_size += sizeof(FIG0_13_app) + xpadapp_length; - } - else { - required_size += sizeof(FIG0_13_app); - } + required_size += sizeof(FIG0_13_app) + xpaddata_length; if (ua.uaType == FIG0_13_APPTYPE_SPI) { required_size += 2; // For the "basic profile" user application data @@ -167,7 +164,7 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) for (const auto& ua : uaTypes) { FIG0_13_app* app = (FIG0_13_app*)buf; app->setType(ua.uaType); - app->length = xpadapp_length; + app->length = xpaddata_length; if (ua.uaType == FIG0_13_APPTYPE_SPI) { app->length += 2; } -- cgit v1.2.3