aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ConfigParser.cpp21
-rw-r--r--src/DabMultiplexer.cpp20
-rw-r--r--src/MuxElements.h9
-rw-r--r--src/utils.cpp15
4 files changed, 54 insertions, 11 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 3f977ad..8eed560 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -345,12 +345,21 @@ void parse_ptree(
ptree pt_general = pt.get_child("general");
/* Dab mode logic */
- ensemble->mode = pt_general.get("dabmode", 2);
- if ((ensemble->mode < 1) || (ensemble->mode > 4)) {
- throw runtime_error("Mode must be between 1-4");
- }
- if (ensemble->mode == 4) {
- ensemble->mode = 0;
+ switch (pt_general.get("dabmode", 1)) {
+ case 1:
+ ensemble->transmission_mode = TransmissionMode_e::TM_I;
+ break;
+ case 2:
+ ensemble->transmission_mode = TransmissionMode_e::TM_II;
+ break;
+ case 3:
+ ensemble->transmission_mode = TransmissionMode_e::TM_III;
+ break;
+ case 4:
+ ensemble->transmission_mode = TransmissionMode_e::TM_IV;
+ break;
+ default:
+ throw runtime_error("Mode must be between 1-4");
}
/******************** READ ENSEMBLE PARAMETERS *************/
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index a86a1c7..3421338 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -374,7 +374,8 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
vector<DabSubchannel*>::iterator subchannel;
// FIC Length, DAB Mode I, II, IV -> FICL = 24, DAB Mode III -> FICL = 32
- unsigned FICL = (ensemble->mode == 3 ? 32 : 24);
+ unsigned FICL =
+ (ensemble->transmission_mode == TransmissionMode_e::TM_III ? 32 : 24);
// For EDI, save ETI(LI) Management data into a TAG Item DETI
edi::TagDETI edi_tagDETI;
@@ -437,7 +438,20 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
//****** MID ******//
//Mode Identity, 2 bits, 01 ModeI, 10 modeII, 11 ModeIII, 00 ModeIV
- fc->MID = edi_tagDETI.mid = ensemble->mode; //mode 2 needs 3 FIB, 3*32octets = 96octets
+ switch (ensemble->transmission_mode) {
+ case TransmissionMode_e::TM_I:
+ fc->MID = edi_tagDETI.mid = 1;
+ break;
+ case TransmissionMode_e::TM_II:
+ fc->MID = edi_tagDETI.mid = 2;
+ break;
+ case TransmissionMode_e::TM_III:
+ fc->MID = edi_tagDETI.mid = 3;
+ break;
+ case TransmissionMode_e::TM_IV:
+ fc->MID = edi_tagDETI.mid = 0;
+ break;
+ }
//****** FL ******//
/* Frame Length, 11 bits, nb of words(4 bytes) in STC, EOH and MST
@@ -563,7 +577,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
// Insert all FIBs
fig_carousel.update(currentFrame);
- const bool fib3_present = ensemble->mode == 3;
+ const bool fib3_present = (ensemble->transmission_mode == TransmissionMode_e::TM_III);
index += fig_carousel.write_fibs(&etiFrame[index], currentFrame % 4, fib3_present);
/**********************************************************************
diff --git a/src/MuxElements.h b/src/MuxElements.h
index 6a1ca74..c5a8faa 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -193,6 +193,13 @@ class DabSubchannel;
class LinkageSet;
struct FrequencyInformation;
+enum class TransmissionMode_e {
+ TM_I,
+ TM_II,
+ TM_III,
+ TM_IV
+};
+
class dabEnsemble : public RemoteControllable {
public:
dabEnsemble()
@@ -213,7 +220,7 @@ class dabEnsemble : public RemoteControllable {
uint16_t id = 0;
uint8_t ecc = 0;
DabLabel label;
- uint8_t mode = 0;
+ TransmissionMode_e transmission_mode = TransmissionMode_e::TM_I;
/* Use the local time to calculate the lto */
bool lto_auto = true;
diff --git a/src/utils.cpp b/src/utils.cpp
index cfbe13b..8b4de67 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -494,7 +494,20 @@ void printEnsemble(const shared_ptr<dabEnsemble>& ensemble)
ensemble->label.short_label();
etiLog.log(info, " (0x%x)", ensemble->label.flag());
- etiLog.log(info, " mode: %u", ensemble->mode);
+ switch (ensemble->transmission_mode) {
+ case TransmissionMode_e::TM_I:
+ etiLog.log(info, " mode: TM I");
+ break;
+ case TransmissionMode_e::TM_II:
+ etiLog.log(info, " mode: TM II");
+ break;
+ case TransmissionMode_e::TM_III:
+ etiLog.log(info, " mode: TM III");
+ break;
+ case TransmissionMode_e::TM_IV:
+ etiLog.log(info, " mode: TM IV");
+ break;
+ }
if (ensemble->lto_auto) {
time_t now = time(nullptr);