summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/servicelinking.mux17
-rw-r--r--src/ConfigParser.cpp22
-rw-r--r--src/ConfigParser.h3
-rw-r--r--src/MuxElements.h2
-rw-r--r--src/fig/FIG0_21.cpp19
-rw-r--r--src/fig/FIG0_21.h5
-rw-r--r--src/utils.cpp1
7 files changed, 58 insertions, 11 deletions
diff --git a/doc/servicelinking.mux b/doc/servicelinking.mux
index 03c842a..bdfbd90 100644
--- a/doc/servicelinking.mux
+++ b/doc/servicelinking.mux
@@ -105,6 +105,7 @@ linking {
; ETSI EN 300 401 Clause 8.1.8
frequency_information {
fi_1 {
+ oe false
fi_dab_1 {
range_modulation dab
continuity true
@@ -129,7 +130,23 @@ frequency_information {
frequencies "87.6 105.2"
}
}
+ fi_other_ensemble {
+ oe true
+ fi_dab_other {
+ range_modulation dab
+ continuity true
+ eid 0x4fee
+ frequencies {
+ entry_a {
+ signal_mode_1 true
+ adjacent true
+ frequency 230.784
+ }
+ }
+ }
+ }
fi_2 {
+ oe false
fi_drm_3 {
range_modulation drm
continuity true
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 <exception>
#include <iostream>
#include <vector>
-#include <stdint.h>
+#include <cstdint>
#include <string>
#include <map>
#include <cstring>
@@ -211,9 +211,14 @@ static void parse_freq_info(ptree& pt,
auto fi = make_shared<FrequencyInformation>();
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<bool>("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<FrequencyInformation>& first,
+ const shared_ptr<FrequencyInformation>& 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
}
diff --git a/src/ConfigParser.h b/src/ConfigParser.h
index ea48e94..9ca6c81 100644
--- a/src/ConfigParser.h
+++ b/src/ConfigParser.h
@@ -30,10 +30,7 @@
*/
#pragma once
-#include <vector>
-#include <string>
#include "MuxElements.h"
-#include "DabMux.h"
#include <boost/property_tree/ptree.hpp>
#include <memory>
diff --git a/src/MuxElements.h b/src/MuxElements.h
index 1f3f548..4efc720 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -549,6 +549,8 @@ struct FrequencyListEntry {
struct FrequencyInformation {
std::string uid;
+ bool other_ensemble = false;
+
// The latest draft spec does not specify the RegionId anymore, it's
// now a reserved field.
std::vector<FrequencyListEntry> frequency_information;
diff --git a/src/fig/FIG0_21.cpp b/src/fig/FIG0_21.cpp
index ad56439..1972a19 100644
--- a/src/fig/FIG0_21.cpp
+++ b/src/fig/FIG0_21.cpp
@@ -3,7 +3,7 @@
2011, 2012 Her Majesty the Queen in Right of Canada (Communications
Research Center Canada)
- Copyright (C) 2017
+ Copyright (C) 2018
Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
@@ -69,8 +69,7 @@ struct FIGtype0_21_fi_dab_entry {
FIG0_21::FIG0_21(FIGRuntimeInformation *rti) :
- m_rti(rti),
- m_initialised(false)
+ m_rti(rti)
{
}
@@ -86,6 +85,10 @@ FillStatus FIG0_21::fill(uint8_t *buf, size_t max_size)
if (not m_initialised) {
freqInfoFIG0_21 = ensemble->frequency_information.begin();
+
+ if (freqInfoFIG0_21 != ensemble->frequency_information.end()) {
+ m_last_oe = (*freqInfoFIG0_21)->other_ensemble;
+ }
m_initialised = true;
}
@@ -120,6 +123,14 @@ FillStatus FIG0_21::fill(uint8_t *buf, size_t max_size)
etiLog.level(FIG0_21_TRACE) << "FIG0_21::loop " << (*freqInfoFIG0_21)->uid;
+ if (m_last_oe != (*freqInfoFIG0_21)->other_ensemble) {
+ // Trigger resend of FIG0 when OE changes
+ fig0 = nullptr;
+ m_last_oe = (*freqInfoFIG0_21)->other_ensemble;
+ etiLog.level(FIG0_21_TRACE) << "FIG0_21::switch OE to " <<
+ (*freqInfoFIG0_21)->other_ensemble;
+ }
+
if (fig0 == nullptr) {
if (remaining < 2 + required_size) {
etiLog.level(FIG0_21_TRACE) << "FIG0_21::no space for fig0";
@@ -132,7 +143,7 @@ FillStatus FIG0_21::fill(uint8_t *buf, size_t max_size)
// Database start or continuation flag, EN 300 401 Clause 5.2.2.1 part b)
fig0->CN =
(freqInfoFIG0_21 == ensemble->frequency_information.begin() ? 0 : 1);
- fig0->OE = 0;
+ fig0->OE = (*freqInfoFIG0_21)->other_ensemble ? 1 : 0;
fig0->PD = false;
fig0->Extension = 21;
diff --git a/src/fig/FIG0_21.h b/src/fig/FIG0_21.h
index a321541..018727a 100644
--- a/src/fig/FIG0_21.h
+++ b/src/fig/FIG0_21.h
@@ -3,7 +3,7 @@
2011, 2012 Her Majesty the Queen in Right of Canada (Communications
Research Center Canada)
- Copyright (C) 2017
+ Copyright (C) 2018
Matthias P. Braendli, matthias.braendli@mpb.li
*/
/*
@@ -46,7 +46,8 @@ class FIG0_21 : public IFIG
private:
FIGRuntimeInformation *m_rti;
- bool m_initialised;
+ bool m_initialised = false;
+ bool m_last_oe = false;
std::vector<std::shared_ptr<FrequencyInformation> >::iterator
freqInfoFIG0_21;
diff --git a/src/utils.cpp b/src/utils.cpp
index 3e4c03b..a4881ab 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -419,6 +419,7 @@ static void printFrequencyInformation(const shared_ptr<dabEnsemble>& ensemble)
}
for (const auto& fi : ensemble->frequency_information) {
etiLog.level(info) << " FI " << fi->uid;
+ etiLog.level(info) << " OE=" << (fi->other_ensemble ? 1 : 0);
for (const auto& fle : fi->frequency_information) {
etiLog.level(info) << " continuity " << (fle.continuity ? "true" : "false");
switch (fle.rm) {