From 0fa7f1d17cd8554db8e3d3bbe7603495b2ac07c7 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 2 Oct 2016 15:50:58 +0200 Subject: Set IdLQ properly in FIG0/6 --- src/fig/FIG0_6.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/fig/FIG0_6.cpp b/src/fig/FIG0_6.cpp index 8c0e53d..fa8cbfa 100644 --- a/src/fig/FIG0_6.cpp +++ b/src/fig/FIG0_6.cpp @@ -104,7 +104,22 @@ FillStatus FIG0_6::fill(uint8_t *buf, size_t max_size) throw MuxInitException(); } - header->IdLQ = 0; // TODO not only DAB + // update() guarantees us that all entries in a linkage set + // have the same type + for (const auto& l : linkageSetFIG0_6->id_list) { + if (l.type != linkageSetFIG0_6->id_list.front().type) { + etiLog.log(error, "INTERNAL ERROR: invalid linkage subset 0x%04x", + linkageSetFIG0_6->lsn); + throw std::runtime_error("INTERNAL ERROR"); + } + } + + switch (linkageSetFIG0_6->id_list.front().type) { + case ServiceLinkType::DAB: header->IdLQ = FIG0_6_IDLQ_DAB; break; + case ServiceLinkType::FM: header->IdLQ = FIG0_6_IDLQ_RDS; break; + case ServiceLinkType::DRM: header->IdLQ = FIG0_6_IDLQ_DRM_AMSS; break; + case ServiceLinkType::AMSS: header->IdLQ = FIG0_6_IDLQ_DRM_AMSS; break; + } header->rfa = 0; header->num_ids = num_ids; @@ -126,13 +141,6 @@ FillStatus FIG0_6::fill(uint8_t *buf, size_t max_size) keyserviceuid.c_str(), linkageSetFIG0_6->lsn); throw MuxInitException(); } - for (const auto& l : linkageSetFIG0_6->id_list) { - if (l.type != ServiceLinkType::DAB) { - etiLog.log(error, "TODO only DAB links supported. (linkage set 0x%04x)", - linkageSetFIG0_6->lsn); - throw MuxInitException(); - } - } if (not PD and not ILS) { buf[0] = (*keyservice)->id >> 8; -- cgit v1.2.3