From 07b303a738c82c53c835221f675d6d3b82948357 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 17 Feb 2018 17:12:56 +0100 Subject: Add OE=1 support for FrequencyInformation --- src/ConfigParser.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/ConfigParser.cpp') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 120ca09..a04d90d 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -211,9 +211,14 @@ static void parse_freq_info(ptree& pt, auto fi = make_shared(); fi->uid = fi_uid; + fi->other_ensemble = pt_fi.get("oe", false); for (const auto& it_fle : pt_fi) { const string fle_uid = it_fle.first; + if (fle_uid == "oe") { + continue; + } + const ptree pt_entry = it_fle.second; FrequencyListEntry fle; @@ -234,7 +239,8 @@ static void parse_freq_info(ptree& pt, fle.rm = RangeModulation::amss; } else { - throw runtime_error("Invalid range_modulation: " + rm_str); + throw runtime_error("Invalid range_modulation '" + rm_str + + "' in FI " + fi_uid); } fle.continuity = pt_entry.get("continuity"); @@ -326,6 +332,18 @@ static void parse_freq_info(ptree& pt, ensemble->frequency_information.push_back(fi); } // for over fi + + /* We sort all FI to have the OE=0 first and the OE=1 afterwards, to + * avoid having to send FIG0 headers every time it switches. */ + std::sort( + ensemble->frequency_information.begin(), + ensemble->frequency_information.end(), + [](const shared_ptr& first, + const shared_ptr& second) { + const int oe_first = first->other_ensemble ? 1 : 0; + const int oe_second = second->other_ensemble ? 1 : 0; + return oe_first < oe_second; + } ); } // if FI present } -- cgit v1.2.3