From d178111329fb42b64d26c160fb6d8f40219b69e9 Mon Sep 17 00:00:00 2001 From: tanneberger Date: Sun, 12 May 2024 01:22:47 +0200 Subject: [PATCH] google style and debugging problems with toml11 --- .gitignore | 2 + CMakeLists.txt | 9 +- README.md | 18 +- nixos-modules/tetra-receiver.nix | 4 +- pkgs/tetra-receiver.nix | 19 +- src/config.h | 300 ------------------------------- src/config/config.cpp | 90 ++++++++++ src/config/config.hh | 236 ++++++++++++++++++++++++ src/main.cpp | 10 +- test/CMakeLists.txt | 16 +- 10 files changed, 376 insertions(+), 328 deletions(-) delete mode 100644 src/config.h create mode 100644 src/config/config.cpp create mode 100644 src/config/config.hh diff --git a/.gitignore b/.gitignore index b2be92b..fe205ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ result +.idea +cmake-build-debug diff --git a/CMakeLists.txt b/CMakeLists.txt index bacb1e0..9895a56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,12 @@ cmake_minimum_required(VERSION 3.22) +project(tetra-receiver) + +SET(CMAKE_CXX_STANDARD 17) add_executable(tetra-receiver - src/main.cpp) + src/main.cpp + src/config/config.cpp +) target_compile_options(tetra-receiver PUBLIC -std=c++17 -Wall) @@ -15,7 +20,7 @@ find_package(cxxopts REQUIRED) include_directories(${GNURADIO_ALL_INCLUDE_DIRS}) -target_link_libraries(tetra-receiver log4cpp gnuradio-digital gnuradio-analog gnuradio-filter gnuradio-blocks gnuradio-fft gnuradio-runtime gnuradio-pmt volk gnuradio-osmosdr) +target_link_libraries(tetra-receiver log4cpp volk gnuradio-osmosdr gnuradio-digital gnuradio-analog gnuradio-filter gnuradio-blocks gnuradio-fft gnuradio-runtime gnuradio-pmt ) enable_testing() diff --git a/README.md b/README.md index f1efb0e..c40f22b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ # Tetra Receiver -Receive multiple TETRA streams at once and send the bits out via UDP. +Receive multiple TETRA streams_ at once and send the bits out via UDP. -The tetra streams can be decoding using [`tetra-rx` from the osmocom tetra project](https://github.com/osmocom/osmo-tetra) or [`decoder` from the tetra-kit project](https://gitlab.com/larryth/tetra-kit). +The tetra streams_ can be decoding using [`tetra-rx` from the osmocom tetra project](https://github.com/osmocom/osmo-tetra) or [`decoder` from the tetra-kit project](https://gitlab.com/larryth/tetra-kit). Usage with tetra-rx: `socat STDIO UDP-LISTEN:42000 | stdbuf -i0 -o0 tetra-rx /dev/stdin` ## Usage ``` -Receive multiple TETRA streams at once and send the bits out via UDP +Receive multiple TETRA streams_ at once and send the bits out via UDP Usage: tetra-receiver [OPTION...] @@ -20,18 +20,18 @@ Usage: https://projects.osmocom.org/projects/gr-osmos dr/wiki/GrOsmoSDR (default: "") --center-frequency arg Center frequency of the SDR (default: 0) - --offsets arg Offsets of the TETRA streams + --offsets arg Offsets of the TETRA streams_ --samp-rate arg Sample rate of the sdr (default: 1000000) - --udp-start arg Start UDP port. Each stream gets its own UDP - port, starting at udp-start (default: 42000) + --udp-start arg Start UDP port_. Each Stream gets its own UDP + port_, starting at udp-start (default: 42000) ``` ## Toml Config Format -When decoding TETRA streams the downlink and uplink are often a number of MHz apart. -To solve the problem of decoding multiple uplinks and downlinks without having big FIR filters operating at the SDRs sampling rate, one wants to first decimate into two smaller streams. One for all uplink and downlink channels respectively. +When decoding TETRA streams_ the downlink and uplink are often a number of MHz apart. +To solve the problem of decoding multiple uplinks and downlinks without having big FIR filters operating at the SDRs sampling rate, one wants to first Decimate into two smaller streams_. One for all uplink and downlink channels respectively. -Therefore this application supports multiple stages of decimation. +Therefore this application supports multiple stages of decimation_. The config has mandatory global arguments `CenterFrequency`, `DeviceString` and `SampleRate` for the SDR. diff --git a/nixos-modules/tetra-receiver.nix b/nixos-modules/tetra-receiver.nix index 3c75c85..08a3212 100644 --- a/nixos-modules/tetra-receiver.nix +++ b/nixos-modules/tetra-receiver.nix @@ -32,7 +32,7 @@ in { offsets = mkOption { type = types.listOf types.int; default = [ ]; - description = " Offsets of the TETRA streams\n"; + description = " Offsets of the TETRA streams_\n"; }; sampRate = mkOption { type = types.int; @@ -43,7 +43,7 @@ in { type = types.int; default = 42000; description = - " Start UDP port. Each stream gets its own UDP port, starting at udp-start (default: 42000)\n"; + " Start UDP port_. Each Stream gets its own UDP port_, starting at udp-start (default: 42000)\n"; }; user = mkOption { type = types.str; diff --git a/pkgs/tetra-receiver.nix b/pkgs/tetra-receiver.nix index c097512..6c3e6a8 100644 --- a/pkgs/tetra-receiver.nix +++ b/pkgs/tetra-receiver.nix @@ -7,11 +7,26 @@ , mpir , gmpxx , cxxopts -, toml11 , gtest -, toml11 +, fetchFromGitHub +, stdenv }: let + toml11 = stdenv.mkDerivation { + pname = "toml11"; + version = "3.7.1"; + + src = fetchFromGitHub { + owner = "ToruNiina"; + repo = "toml11"; + rev = "v3.8.1"; + hash = "sha256-HnhXBvIjo1JXhp+hUQvjs83t5IBVbNN6o3ZGhB4WESQ="; + }; + + nativeBuildInputs = [ + cmake + ]; + }; osmosdr = gnuradioPackages.osmosdr.overrideAttrs(_oldAttrs: { outputs = [ "out" ]; }); diff --git a/src/config.h b/src/config.h deleted file mode 100644 index 773e455..0000000 --- a/src/config.h +++ /dev/null @@ -1,300 +0,0 @@ -#include -#include -#include -#include - -#include - -#ifndef INCLUDE_CONFIG_H -#define INCLUDE_CONFIG_H - -namespace config { - -const std::string default_host = "localhost"; -constexpr unsigned int default_port = 42000; - -/// The sample rate of the TETRA stream -static constexpr unsigned int tetra_sample_rate = 25000; - -template class range { -public: - /// A class takes two values of type T and stores the minimum value in min, - /// the maximum in max respectively. - range(const T lhs, const T rhs) { - if (lhs < rhs) { - this->min = lhs; - this->max = rhs; - } else { - this->min = rhs; - this->max = lhs; - } - } - - /// Check that the given range is inside the bounds (inclusive) of this range. - bool contains(const range &other) const { - if (other.min < min || other.max > max) - return false; - return true; - } - -private: - T min; - T max; -}; - -template class spectrum_slice { -public: - /// Get different properties for a slice of EM spectrum - /// \param frequency the center frequency of the slice - /// \param sample_rate the sample rate of this spectrum - spectrum_slice(const T center_frequency, const T sample_rate) - : center_frequency(center_frequency), - frequency_range(center_frequency - sample_rate / 2, - center_frequency + sample_rate / 2), - sample_rate(sample_rate){}; - - /// the center frequency of this slice of EM spectrum - T center_frequency; - /// the frequency range of this slice of EM spectrum - range frequency_range; - /// the sampling frequency for this slice of EM spectrum - T sample_rate; - - friend bool operator==(const spectrum_slice &, const spectrum_slice &); - friend bool operator!=(const spectrum_slice &, const spectrum_slice &); -}; - -template -bool operator==(const spectrum_slice &lhs, const spectrum_slice &rhs) { - return lhs.center_frequency == rhs.center_frequency && - lhs.sample_rate == rhs.sample_rate; -}; - -template -bool operator!=(const spectrum_slice &lhs, const spectrum_slice &rhs) { - return !(lhs == rhs); -} - -class stream { -public: - /// Describe the on which frequency a TETRA stream should be extracted and - /// where data should be sent to. - /// \param input_spectrum the slice of spectrum that is input to this block - /// \param spectrum the slice of spectrum of the TETRA stream - /// \param host the to send the data to - /// \param port the port to send the data to - stream(const spectrum_slice &input_spectrum, - const spectrum_slice &spectrum, const std::string &host, - const unsigned int port) - : input_spectrum(input_spectrum), spectrum(spectrum), host(host), - port(port) { - // check that this stream is valid - if (!input_spectrum.frequency_range.contains(spectrum.frequency_range)) { - throw std::invalid_argument("Frequency range of the Streams in not " - "inside the frequency range of the input."); - } - - const auto &input_sample_rate = input_spectrum.sample_rate; - const auto &sample_rate = spectrum.sample_rate; - decimation = input_sample_rate / sample_rate; - auto rem = input_sample_rate % sample_rate; - if (rem != 0) { - throw std::invalid_argument( - "Input sample rate is not divisible by stream block sample rate."); - } - } - - /// the slice of spectrum that is input to this block - const spectrum_slice input_spectrum; - /// the slice of spectrum of the TETRA stream - const spectrum_slice spectrum; - /// the decimation of this block - unsigned int decimation; - /// Optional field - /// The host to which the samples of the stream should be sent. This defaults - /// to "locahost". - const std::string host; - /// Optional field - /// The port to which the samples of the stream should be sent. This defaults - /// to 42000. - const unsigned int port; -}; - -class decimate { -public: - /// Describe the decimation of the SDR stream by the frequency where we want - /// to extract a signal with a width of sample_rate - /// \param input_spectrum the slice of spectrum that is input to this block - /// \param spectrum the slice of spectrum after decimation - /// \param streams the vector of streams the decimated signal should be sent - /// to - decimate(const spectrum_slice &input_spectrum, - const spectrum_slice &spectrum) - : input_spectrum(input_spectrum), spectrum(spectrum) { - // check that this stream is valid - if (!input_spectrum.frequency_range.contains(spectrum.frequency_range)) { - throw std::invalid_argument( - "Decimator frequency range is not inside the one of the SDR"); - } - - const auto &input_sample_rate = input_spectrum.sample_rate; - const auto &sample_rate = spectrum.sample_rate; - decimation = input_sample_rate / sample_rate; - auto rem = input_sample_rate % sample_rate; - if (rem != 0) { - throw std::invalid_argument( - "Input sample rate is not divisible by decimate block sample rate."); - } - - for (const auto &stream : streams) { - if (stream.input_spectrum != spectrum) { - throw std::invalid_argument( - "The output of decimate does not match to the input of stream."); - } - } - } - - /// the slice of spectrum that is input to this block - const spectrum_slice input_spectrum; - /// the slice of spectrum after decimation - const spectrum_slice spectrum; - - /// the decimation of this block - unsigned int decimation; - - /// The vector of streams the output of this decimate block should be - /// connected to. - std::vector streams; -}; - -class toplevel { -public: - toplevel(const spectrum_slice &spectrum, - const std::string device_string, const std::vector &streams, - const std::vector &decimators) - : spectrum(spectrum), device_string(device_string), streams(streams), - decimators(decimators) { - for (const auto &stream : streams) { - if (stream.input_spectrum != spectrum) { - throw std::invalid_argument( - "The output of decimate does not match to the input of stream."); - } - } - for (const auto &decimator : decimators) { - if (decimator.input_spectrum != spectrum) { - throw std::invalid_argument( - "The output of decimate does not match to the input of stream."); - } - } - }; - - /// The spectrum of the SDR - const spectrum_slice spectrum; - /// The device string for the SDR source block - const std::string device_string; - /// The vector of Streams which should be directly decoded from the input of - /// the SDR. - const std::vector streams; - /// The vector of decimators which should first decimate a signal of the SDR - /// and then sent it to the vector of streams inside them. - const std::vector decimators; -}; - -using decimate_or_stream = std::variant; - -}; // namespace config - -namespace toml { - -static config::decimate_or_stream get_decimate_or_stream( - const config::spectrum_slice &input_spectrum, - const value &v) { - std::optional sample_rate; - - const unsigned int frequency = find(v, "Frequency"); - if (v.contains("SampleRate")) - sample_rate = find(v, "SampleRate"); - const std::string host = find_or(v, "Host", config::default_host); - const unsigned int port = find_or(v, "Port", config::default_port); - - // If we have a sample rate specified this is a decimate, otherwhise this is - // a stream. - if (sample_rate.has_value()) { - return config::decimate( - input_spectrum, - config::spectrum_slice(frequency, *sample_rate)); - } else { - return config::stream(input_spectrum, - config::spectrum_slice( - frequency, config::tetra_sample_rate), - host, port); - } -} - -template <> struct from { - static config::toplevel from_toml(const value &v) { - const unsigned int center_frequency = - find(v, "CenterFrequency"); - const std::string device_string = find(v, "DeviceString"); - const unsigned int sample_rate = find(v, "SampleRate"); - - config::spectrum_slice sdr_spectrum(center_frequency, - sample_rate); - - std::vector streams; - std::vector decimators; - - // Iterate over all elements in the root table - for (const auto &root_kv : v.as_table()) { - const auto &table = root_kv.second; - - // Find table entries. These can be decimators or streams. - if (!table.is_table()) - continue; - - const auto element = get_decimate_or_stream(sdr_spectrum, table); - - // Save the stream - if (std::holds_alternative(element)) { - const auto &stream_element = std::get(element); - streams.push_back(stream_element); - } - - // Found a decimator entry - if (std::holds_alternative(element)) { - auto decimate_element = std::get(element); - - // Find all subtables, that must be stream entries and add them to the - // decimtor - for (const auto &stream_pair : table.as_table()) { - auto &stream_table = stream_pair.second; - - if (!stream_table.is_table()) - continue; - - const auto stream_element = - get_decimate_or_stream(decimate_element.spectrum, stream_table); - - if (!std::holds_alternative(stream_element)) { - throw std::invalid_argument( - "Did not find a stream block under the decimate block"); - } - - decimate_element.streams.push_back( - std::get(stream_element)); - } - - decimators.push_back(decimate_element); - } - - throw std::invalid_argument( - "Did not handle a derived type of decimate_or_stream"); - } - - return config::toplevel(sdr_spectrum, device_string, streams, decimators); - } -}; - -}; // namespace toml - -#endif diff --git a/src/config/config.cpp b/src/config/config.cpp new file mode 100644 index 0000000..435d88d --- /dev/null +++ b/src/config/config.cpp @@ -0,0 +1,90 @@ + + +#include "config.hh" + +namespace config { +template + Range::Range(const T lhs, const T rhs) noexcept { + if (lhs < rhs) { + this->min_ = lhs; + this->max_ = rhs; + } else { + this->min_ = rhs; + this->max_ = lhs; + } + } + + template + auto Range::contains(const Range &other) const noexcept -> bool{ + if (other.min_ < min_ || other.max_ > max_) + return false; + return true; + } + + + Stream::Stream(const SpectrumSlice &input_spectrum, + const SpectrumSlice &spectrum, + std::string host, + unsigned int port) + : input_spectrum_(input_spectrum), spectrum_(spectrum), host_(std::move(host)), port_(port) { + // check that this Stream is valid + if (!input_spectrum.frequency_range_.contains(spectrum.frequency_range_)) { + throw std::invalid_argument("Frequency Range of the Streams in not " + "inside the frequency Range of the input."); + } + + const auto &input_sample_rate = input_spectrum.sample_rate_; + const auto &sample_rate = spectrum.sample_rate_; + decimation = input_sample_rate / sample_rate; + auto rem = input_sample_rate % sample_rate; + if (rem != 0) { + throw std::invalid_argument( + "Input sample rate is not divisible by Stream block sample rate."); + } + } + + Decimate::Decimate(const SpectrumSlice &input_spectrum, + const SpectrumSlice &spectrum) + : input_spectrum_(input_spectrum), spectrum_(spectrum) { + // check that this Stream is valid + if (!input_spectrum.frequency_range_.contains(spectrum.frequency_range_)) { + throw std::invalid_argument( + "Decimator frequency Range is not inside the one of the SDR"); + } + + const auto &input_sample_rate = input_spectrum.sample_rate_; + const auto &sample_rate = spectrum.sample_rate_; + decimation_ = input_sample_rate / sample_rate; + auto rem = input_sample_rate % sample_rate; + + if (rem != 0) { + throw std::invalid_argument( + "Input sample rate is not divisible by Decimate block sample rate."); + } + + for (const auto &stream : streams_) { + if (stream.input_spectrum_ != spectrum) { + throw std::invalid_argument( + "The output of Decimate does not match to the input of Stream."); + } + } + } + TopLevel::TopLevel(const SpectrumSlice &spectrum, + std::string device_string, const std::vector &streams, + const std::vector &decimators) + : spectrum_(spectrum), device_string_(std::move(device_string)), streams_(streams), decimators_(decimators) { + for (const auto &stream : streams) { + if (stream.input_spectrum_ != spectrum) { + throw std::invalid_argument( + "The output of Decimate does not match to the input of Stream."); + } + } + for (const auto&decimator : decimators) { + if (decimator.input_spectrum_ != spectrum) { + throw std::invalid_argument( + "The output of Decimate does not match to the input of Stream."); + } + } + }; + +} // namespace config \ No newline at end of file diff --git a/src/config/config.hh b/src/config/config.hh new file mode 100644 index 0000000..8f84719 --- /dev/null +++ b/src/config/config.hh @@ -0,0 +1,236 @@ +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifndef INCLUDE_CONFIG_H +#define INCLUDE_CONFIG_H + +namespace config { + +/// The sample rate of the TETRA Stream +[[maybe_unused]] static constexpr unsigned int kTetraSampleRate = 25000; + +[[maybe_unused]] constexpr const char* kDefaultHost = "localhost"; +[[maybe_unused]] constexpr unsigned int kDefaultPort = 42000; + +template class Range { +private: + T min_ = 0; + T max_ = 0; +public: + /// A class takes two values of type T and stores the minimum value in min_, + /// the maximum in max_ respectively. + Range(T lhs, T rhs) noexcept; + + /// Check that the given Range is inside the bounds (inclusive) of this Range. + [[nodiscard]] auto contains(const Range &other) const noexcept -> bool; +}; + +template class SpectrumSlice { +public: + /// the center frequency of this slice of EM spectrum_ + T center_frequency_; + /// the frequency Range of this slice of EM spectrum_ + Range frequency_range_; + /// the sampling frequency for this slice of EM spectrum_ + T sample_rate_; + + /// Get different properties for a slice of EM spectrum_ + /// \param frequency the center frequency of the slice + /// \param sample_rate the sample rate of this spectrum_ + SpectrumSlice(const T center_frequency, const T sample_rate) noexcept + : center_frequency_(center_frequency), frequency_range_(center_frequency - sample_rate / 2, + center_frequency + sample_rate / 2), sample_rate_(sample_rate) {}; + + + friend bool operator==(const SpectrumSlice &, const SpectrumSlice &); + friend bool operator!=(const SpectrumSlice &, const SpectrumSlice &); +}; + +template +bool operator==(const SpectrumSlice &lhs, const SpectrumSlice &rhs) { + return lhs.center_frequency_ == rhs.center_frequency_ && + lhs.sample_rate_ == rhs.sample_rate_; +}; + +template +bool operator!=(const SpectrumSlice &lhs, const SpectrumSlice &rhs) { + return !(lhs == rhs); +} + +class Stream { +public: + /// the slice of spectrum_ that is input to this block + const SpectrumSlice input_spectrum_; + /// the slice of spectrum_ of the TETRA Stream + const SpectrumSlice spectrum_; + /// the decimation_ of this block + unsigned int decimation = 0; + /// Optional field + /// The host_ to which the samples of the Stream should be sent. This defaults + /// to "locahost". + const std::string host_{}; + /// Optional field + /// The port_ to which the samples of the Stream should be sent. This defaults + /// to 42000. + const unsigned int port_ = 0; + + /// Describe the on which frequency a TETRA Stream should be extracted and + /// where data should be sent to. + /// \param input_spectrum the slice of spectrum_ that is input to this block + /// \param spectrum the slice of spectrum_ of the TETRA Stream + /// \param host the to send the data to + /// \param port the port_ to send the data to + Stream(const SpectrumSlice &input_spectrum, + const SpectrumSlice &spectrum, std::string host, + unsigned int port); + +}; + +class Decimate { +public: + /// the slice of spectrum_ that is input to this block + const SpectrumSlice input_spectrum_; + /// the slice of spectrum_ after decimation_ + const SpectrumSlice spectrum_; + + /// the decimation_ of this block + unsigned int decimation_ = 0; + + /// The vector of streams_ the output of this Decimate block should be + /// connected to. + std::vector streams_; + + /// Describe the decimation_ of the SDR Stream by the frequency where we want + /// to extract a signal with a width of sample_rate_ + /// \param input_spectrum the slice of spectrum_ that is input to this block + /// \param spectrum the slice of spectrum_ after decimation_ + /// \param streams the vector of streams_ the decimated signal should be sent + /// to + Decimate(const SpectrumSlice &input_spectrum, + const SpectrumSlice &spectrum); +}; + +class TopLevel { +public: + /// The spectrum_ of the SDR + const SpectrumSlice spectrum_; + /// The device string for the SDR source block + const std::string device_string_{}; + /// The vector of Streams which should be directly decoded from the input of + /// the SDR. + const std::vector streams_{}; + /// The vector of decimators_ which should first Decimate a signal of the SDR + /// and then sent it to the vector of streams_ inside them. + const std::vector decimators_{}; + + TopLevel(const SpectrumSlice &spectrum, + std::string device_string, const std::vector &streams, + const std::vector &decimators); +}; + +using decimate_or_stream = std::variant; + +}; // namespace config + +namespace toml { + +static config::decimate_or_stream get_decimate_or_stream( + const config::SpectrumSlice &input_spectrum, + const value &v) { + std::optional sample_rate; + + const unsigned int frequency = find(v, "Frequency"); + if (v.contains("SampleRate")) + sample_rate = find(v, "SampleRate"); + + const std::string host = find_or(v, "Host", config::kDefaultHost); + const unsigned int port = find_or(v, "Port", config::kDefaultPort); + + // If we have a sample rate specified this is a Decimate, otherwhise this is + // a Stream. + if (sample_rate.has_value()) { + return config::Decimate( + input_spectrum, + config::SpectrumSlice(frequency, *sample_rate)); + } else { + return config::Stream(input_spectrum, + config::SpectrumSlice( + frequency, config::kTetraSampleRate), + host, port); + } +} + +template <> struct from { + static config::TopLevel from_toml(const value &v) { + const unsigned int center_frequency = + find(v, "CenterFrequency"); + const std::string device_string = find(v, "DeviceString"); + const unsigned int sample_rate = find(v, "SampleRate"); + + config::SpectrumSlice sdr_spectrum(center_frequency, + sample_rate); + + std::vector streams; + std::vector decimators; + + // Iterate over all elements in the root table + for (const auto &root_kv : v.as_table()) { + const auto &table = root_kv.second; + + // Find table entries. These can be decimators_ or streams_. + if (!table.is_table()) + continue; + + const auto element = get_decimate_or_stream(sdr_spectrum, table); + + // Save the Stream + if (std::holds_alternative(element)) { + const auto &stream_element = std::get(element); + streams.push_back(stream_element); + } + + // Found a decimator entry + if (std::holds_alternative(element)) { + auto decimate_element = std::get(element); + + // Find all subtables, that must be Stream entries and add them to the + // decimtor + for (const auto &stream_pair : table.as_table()) { + auto &stream_table = stream_pair.second; + + if (!stream_table.is_table()) + continue; + + const auto stream_element = + get_decimate_or_stream(decimate_element.spectrum_, stream_table); + + if (!std::holds_alternative(stream_element)) { + throw std::invalid_argument( + "Did not find a Stream block under the Decimate block"); + } + + decimate_element.streams_.push_back( + std::get(stream_element)); + } + + decimators.push_back(decimate_element); + } + + throw std::invalid_argument( + "Did not handle a derived type of decimate_or_stream"); + } + + return config::TopLevel(sdr_spectrum, device_string, streams, decimators); + } +}; + +}; // namespace toml + +#endif diff --git a/src/main.cpp b/src/main.cpp index 82fca86..8dd8268 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,7 @@ #include #include -#include "config.h" +#include "config/config.hh" static void print_gnuradio_diagnostics() { const auto ver = gr::version(); @@ -59,7 +59,7 @@ void receiver_main(const unsigned int sample_rate, src->set_gain(bb_gain, "BB", 0); src->set_bandwidth(sample_rate / 2, 0); - // create the decoding blocks for each tetra stream + // create the decoding blocks for each tetra Stream for (auto offsets_it = offsets.begin(); offsets_it != offsets.end(); ++offsets_it) { auto offset = *offsets_it; @@ -121,7 +121,7 @@ int main(int argc, char **argv) { try { cxxopts::Options options( "tetra-receiver", - "Receive multiple TETRA streams at once and send the bits out via UDP"); + "Receive multiple TETRA streams_ at once and send the bits out via UDP"); // clang-format off options.add_options() @@ -131,9 +131,9 @@ int main(int argc, char **argv) { ("bb", "BB gain", cxxopts::value()->default_value("10")) ("device-string", "additional device arguments for osmosdr, see https://projects.osmocom.org/projects/gr-osmosdr/wiki/GrOsmoSDR", cxxopts::value()->default_value("")) ("center-frequency", "Center frequency of the SDR", cxxopts::value()->default_value("0")) - ("offsets", "offsets of the TETRA streams", cxxopts::value>()) + ("offsets", "offsets of the TETRA streams_", cxxopts::value>()) ("samp-rate", "Sample rate of the sdr", cxxopts::value()->default_value("1000000")) - ("udp-start", "Start UDP port. Each stream gets its own UDP port, starting at udp-start", cxxopts::value()->default_value("42000")) + ("udp-start", "Start UDP port_. Each Stream gets its own UDP port_, starting at udp-start", cxxopts::value()->default_value("42000")) ; // clang-format on diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 33b56d5..e50a075 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,14 +12,14 @@ add_executable( mockup_test.cpp ) -target_include_directories(unit_tests PUBLIC ${GTEST_INCLUDE_DIR}) +#target_include_directories(unit_tests PUBLIC ${GTEST_INCLUDE_DIR}) target_link_libraries(unit_tests PUBLIC ${GTEST_LIBRARIES}) # automatic discovery of unit tests -include(GoogleTest) -gtest_discover_tests(unit_tests - PROPERTIES - LABELS "unit" - DISCOVERY_TIMEOUT # how long to wait (in seconds) before crashing - 240 - ) +#include(GoogleTest) +#gtest_discover_tests(unit_tests +# PROPERTIES +# LABELS "unit" +# DISCOVERY_TIMEOUT # how long to wait (in seconds) before crashing +# 240 +# )