diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-07-13 14:04:32 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-07-13 14:04:32 +0200 |
commit | 27326973988f4cc4dbf93b249b9819941d584f74 (patch) | |
tree | 8eaab81ede98182480718328af5dbc8287deabd6 /src/fig/FIG0_13.cpp | |
parent | f8ee21192238bb5858db9c473dde711e4584dc6a (diff) | |
download | dabmux-27326973988f4cc4dbf93b249b9819941d584f74.tar.gz dabmux-27326973988f4cc4dbf93b249b9819941d584f74.tar.bz2 dabmux-27326973988f4cc4dbf93b249b9819941d584f74.zip |
Set basic profile in FIG0/13 SPI user application
Diffstat (limited to 'src/fig/FIG0_13.cpp')
-rw-r--r-- | src/fig/FIG0_13.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/fig/FIG0_13.cpp b/src/fig/FIG0_13.cpp index 582e28e..84e426f 100644 --- a/src/fig/FIG0_13.cpp +++ b/src/fig/FIG0_13.cpp @@ -96,10 +96,16 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) const size_t num_apps = (*componentFIG0_13)->audio.uaTypes.size(); - const size_t app_length = 2; + const size_t xpadapp_length = 2; static_assert(sizeof(FIG0_13_shortAppInfo) == 3); static_assert(sizeof(FIG0_13_app) == 4); - const int required_size = sizeof(FIG0_13_shortAppInfo) + num_apps * (sizeof(FIG0_13_app) + app_length); + int required_size = sizeof(FIG0_13_shortAppInfo); + for (const auto& ua : (*componentFIG0_13)->audio.uaTypes) { + required_size += sizeof(FIG0_13_app) + xpadapp_length; + if (ua.uaType == FIG0_13_APPTYPE_SPI) { + required_size += 2; // For the "basic profile" user application data + } + } if (fig0 == NULL) { if (remaining < 2 + required_size) { @@ -130,7 +136,10 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) for (const auto& ua : (*componentFIG0_13)->audio.uaTypes) { FIG0_13_app* app = (FIG0_13_app*)buf; app->setType(ua.uaType); - app->length = app_length; + app->length = xpadapp_length; + if (ua.uaType == FIG0_13_APPTYPE_SPI) { + app->length += 2; + } const uint8_t dscty = 60; // TS 101 756 Table 2b (MOT) app->xpad = htons((ua.xpadAppType << 8) | dscty); @@ -147,6 +156,14 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size) buf += sizeof(FIG0_13_app); remaining -= sizeof(FIG0_13_app); fig0->Length += sizeof(FIG0_13_app); + + if (ua.uaType == FIG0_13_APPTYPE_SPI) { + buf[0] = 0x01; // = basic profile + buf[1] = 0x00; // = list terminator + buf += 2; + remaining -= 2; + fig0->Length += 2; + } } } else if (not m_transmit_programme and |