diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-03-11 10:38:53 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-03-11 10:39:11 +0100 |
commit | b5d43cff287d75de370ee94193b1162b5ab1038c (patch) | |
tree | 779e4ac7c0eb92f661be34144b551074d353dc00 | |
parent | 79d31b0dfc67e33bab442c59b5c4d0d48d16872d (diff) | |
download | dabmux-b5d43cff287d75de370ee94193b1162b5ab1038c.tar.gz dabmux-b5d43cff287d75de370ee94193b1162b5ab1038c.tar.bz2 dabmux-b5d43cff287d75de370ee94193b1162b5ab1038c.zip |
Make FIG 0/7 optional and document
-rw-r--r-- | doc/advanced.mux | 6 | ||||
-rw-r--r-- | src/ConfigParser.cpp | 4 | ||||
-rw-r--r-- | src/MuxElements.h | 4 | ||||
-rw-r--r-- | src/fig/FIG0_7.cpp | 13 | ||||
-rw-r--r-- | src/fig/FIG0_7.h | 2 | ||||
-rw-r--r-- | src/fig/FIGCarousel.cpp | 6 |
6 files changed, 22 insertions, 13 deletions
diff --git a/doc/advanced.mux b/doc/advanced.mux index fba94ad..e010150 100644 --- a/doc/advanced.mux +++ b/doc/advanced.mux @@ -72,6 +72,12 @@ ensemble { ; 1 corresponds to the PTy used in RDS ; 2 corresponds to program types used in north america + ;reconfig-counter 1 ; Uncomment this option to enable FIG0/7, which specifies that + ; the ensemble is compliant to EN 300 401 version 2 + ; This setting sets the Count field of FIG0/7, which is a + ; modulo-1024 binary counter that increments by one for every multiplex reconfiguration. + + ; all labels are maximum 16 characters in length label "OpenDigitalRadio" ; The short label is built from the label by erasing letters, and cannot diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 6e50952..8da05ef 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -419,8 +419,8 @@ static void parse_general(ptree& pt, etiLog.level(warn) << "ECC is 0!"; } - ensemble->international_table = pt_ensemble.get("international-table", 1); - ensemble->reconfig_counter = pt_ensemble.get("reconfig-counter", 0); + ensemble->international_table = pt_ensemble.get("international-table", ensemble->international_table); + ensemble->reconfig_counter = pt_ensemble.get("reconfig-counter", ensemble->reconfig_counter); string lto_auto = pt_ensemble.get("local-time-offset", ""); if (lto_auto == "auto") { diff --git a/src/MuxElements.h b/src/MuxElements.h index d1f4441..ea7fee5 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -291,7 +291,9 @@ class dabEnsemble : public RemoteControllable { // 1 corresponds to the PTy used in RDS // 2 corresponds to program types used in north america int international_table = 1; - int reconfig_counter = 1; + + // Modulo-1024 counter for FIG0/7. Set to -1 to disable FIG0/7 + int reconfig_counter = -1; vec_sp_service services; vec_sp_component components; diff --git a/src/fig/FIG0_7.cpp b/src/fig/FIG0_7.cpp index e6df66b..50a12cf 100644 --- a/src/fig/FIG0_7.cpp +++ b/src/fig/FIG0_7.cpp @@ -43,12 +43,21 @@ struct FIGtype0_7 { uint8_t ReconfigCounter_low:8; } PACKED; -//=========== FIG 0/0 =========== +//=========== FIG 0/7 =========== FillStatus FIG0_7::fill(uint8_t *buf, size_t max_size) { FillStatus fs; + auto ensemble = m_rti->ensemble; + + if (ensemble->reconfig_counter < 0) { + // FIG 0/7 is disabled + fs.complete_fig_transmitted = true; + fs.num_bytes_written = 0; + return fs; + } + FIGtype0_7 *fig0_7; fig0_7 = (FIGtype0_7 *)buf; @@ -59,8 +68,6 @@ FillStatus FIG0_7::fill(uint8_t *buf, size_t max_size) fig0_7->PD = 0; fig0_7->Extension = 7; - auto ensemble = m_rti->ensemble; - fig0_7->ServiceCount = ensemble->services.size(); fig0_7->ReconfigCounter_high = (ensemble->reconfig_counter % 1024) / 256; fig0_7->ReconfigCounter_low = (ensemble->reconfig_counter % 1024) % 256; diff --git a/src/fig/FIG0_7.h b/src/fig/FIG0_7.h index 30de3dc..6e99d08 100644 --- a/src/fig/FIG0_7.h +++ b/src/fig/FIG0_7.h @@ -5,7 +5,7 @@ Copyright (C) 2020 Matthias P. Braendli, matthias.braendli@mpb.li - Mathisd Kuntze, mathias@kuntze.email + Mathias Kuntze, mathias@kuntze.email */ /* This file is part of ODR-DabMux. diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp index d823bc6..c791364 100644 --- a/src/fig/FIGCarousel.cpp +++ b/src/fig/FIGCarousel.cpp @@ -319,16 +319,10 @@ size_t FIGCarousel::carousel( << std::endl; #endif } - else { - throw std::logic_error("Failed to write FIG0/7"); - } if (status0_7.complete_fig_transmitted) { (*fig0_7)->increase_deadline(); } - else { - throw std::logic_error("FIG0/7 did not complete!"); - } } } |