diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-06-17 07:50:31 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2017-06-17 07:50:31 +0200 |
commit | 27e489a4b40a139ace3c679215e44f109f006127 (patch) | |
tree | 239a8385c059dc9176270fe993276107adaa537e /src/ConfigParser.cpp | |
parent | 02bdb2a0eedbb3ffd4870df0c0e69fd5dbcec856 (diff) | |
download | dabmux-27e489a4b40a139ace3c679215e44f109f006127.tar.gz dabmux-27e489a4b40a139ace3c679215e44f109f006127.tar.bz2 dabmux-27e489a4b40a139ace3c679215e44f109f006127.zip |
Use enum for transmission mode
Diffstat (limited to 'src/ConfigParser.cpp')
-rw-r--r-- | src/ConfigParser.cpp | 21 |
1 files changed, 15 insertions, 6 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 *************/ |