From d5cd8ce81bbbd3a593a8f650b12c08aca8de40e7 Mon Sep 17 00:00:00 2001 From: Tobias Blomberg Date: Sun, 9 Jan 2022 11:00:18 +0100 Subject: [PATCH] Implement support for multitone CTCSS SNR offset New CTCSS configuration variable CTCSS_SNR_OFFSETS (note the plural S) which replace the old variable with a similar name. The new variable take a comma separated list of frequency:offset pairs to support the use of multiple CTCSS tone frequencies. The siglevdetcal utility has also been modified to output the new variable format. If you are using just one CTCSS frequency with a previously calibrated offet value you can keep using that. The older configuration variable will not be removed and it still work in the same way. --- src/async/ChangeLog | 8 ++- src/async/core/AsyncConfig.h | 86 ++++++++++++++++++++++- src/doc/man/svxlink.conf.5 | 51 ++++++++------ src/svxlink/ChangeLog | 9 +++ src/svxlink/remotetrx/remotetrx.conf | 2 + src/svxlink/siglevdetcal/siglevdetcal.cpp | 65 ++++++++++------- src/svxlink/svxlink/svxlink.conf.in | 1 + src/svxlink/trx/LocalRxBase.cpp | 13 +++- src/svxlink/trx/LocalRxBase.h | 27 +++++++ src/svxlink/trx/SquelchCtcss.h | 56 +++++++++------ src/versions | 10 +-- 11 files changed, 255 insertions(+), 73 deletions(-) diff --git a/src/async/ChangeLog b/src/async/ChangeLog index 9c114106..e010a82a 100644 --- a/src/async/ChangeLog +++ b/src/async/ChangeLog @@ -1,4 +1,4 @@ - 1.6.1 -- ?? ??? 2021 + 1.6.1 -- ?? ??? 2022 ---------------------- * ASYNC_AUDIO_ALSA_ZEROFILL is now enabled by default. @@ -44,6 +44,12 @@ will be written instead. Enable this behavior by setting the environment variable ASYNC_AUDIO_UDP_ZEROFILL=1. +* The Config class now also accept associative containers for getValue. This + for example make it possible to use a std::map to read a + configuration variable with a list of values on the form + VARNAME=88.5:-1,136.5:1. It is also possible to use other key/value + separators. + 1.6.0 -- 01 Sep 2019 diff --git a/src/async/core/AsyncConfig.h b/src/async/core/AsyncConfig.h index 98d1aa99..37115a51 100644 --- a/src/async/core/AsyncConfig.h +++ b/src/async/core/AsyncConfig.h @@ -325,6 +325,7 @@ class Config return true; } std::stringstream ssval(str_val); + ssval.imbue(std::locale(ssval.getloc(), new csv_whitespace)); while (!ssval.eof()) { Key tmp; @@ -342,6 +343,77 @@ class Config return true; } /* Config::getValue */ + /** + * @brief Get value of given config variable into associative container + * @param section The name of the section where the configuration + * variable is located + * @param tag The name of the configuration variable to get + * @param c The value is returned in this argument. + * Successful completion overwrites previous contents + * @param sep The character used to separate key and value + * @param missing_ok If set to \em true, return \em true if the + * configuration variable is missing + * @return Returns \em true on success or else \em false on failure. + * + * This function is used to get the value of a configuraiton variable. The + * config variable is read into an associative container (e.g. std::map or + * std::multimap). It's a template function meaning that it can take any + * key and value type that supports the operator>> function. + * Normally a missing configuration variable is seen as an error and the + * function returns \em false. If the missing_ok parameter is set to \em + * true, this function returns \em true for a missing variable but still + * returns \em false if an illegal value is specified. + */ + template