From 9b5dad36648022a1d78f4060a30edc0fb8e32001 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 21 Feb 2018 16:10:36 +0100 Subject: Check Linkage set key service on startup --- src/MuxElements.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/MuxElements.cpp') diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 954e712..ef04507 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -650,6 +650,27 @@ const string dabEnsemble::get_parameter(const string& parameter) const return ss.str(); } +bool dabEnsemble::validate_linkage_sets() +{ + for (const auto& ls : linkagesets) { + const std::string keyserviceuid = ls->keyservice; + const auto& keyservice = std::find_if( + services.cbegin(), + services.cend(), + [&](const std::shared_ptr& srv) { + return srv->uid == keyserviceuid; + }); + + if (keyservice == services.end()) { + etiLog.log(error, "Invalid key service %s in linkage set 0x%04x", + keyserviceuid.c_str(), ls->lsn); + return false; + } + } + + return true; +} + unsigned short DabSubchannel::getSizeCu() const { if (protection.form == UEP) { -- cgit v1.2.3