From 4f66603464b95ceea4bd812c5a50ad4430021fd0 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 14:46:48 +0200 Subject: [PATCH 01/14] Implemented a custom FIFO reading gnu radio block + adapter. Reads samples from unix fifo into gnss-sdr. Use cases: - multiplex signal streams outside of gnss-sdr - another program holds access to the SDR - the SDR is not supported by gnss-sdr but can dump the signal to a fifo --- conf/gnss-sdr_GPS_L1_fifo.conf | 47 ++++++++ .../signal_source/adapters/CMakeLists.txt | 2 + .../adapters/fifo_signal_source.cc | 93 +++++++++++++++ .../adapters/fifo_signal_source.h | 83 +++++++++++++ .../gnuradio_blocks/CMakeLists.txt | 2 + .../gnuradio_blocks/fifo_reader.cc | 111 ++++++++++++++++++ .../gnuradio_blocks/fifo_reader.h | 93 +++++++++++++++ src/core/receiver/gnss_block_factory.cc | 7 ++ 8 files changed, 438 insertions(+) create mode 100644 conf/gnss-sdr_GPS_L1_fifo.conf create mode 100644 src/algorithms/signal_source/adapters/fifo_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/fifo_signal_source.h create mode 100644 src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc create mode 100644 src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h diff --git a/conf/gnss-sdr_GPS_L1_fifo.conf b/conf/gnss-sdr_GPS_L1_fifo.conf new file mode 100644 index 000000000..d73a77e10 --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_fifo.conf @@ -0,0 +1,47 @@ +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=25000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fifo_Signal_Source +SignalSource.filename=fifo.fifo ; example usage: mkfifo fifo.fifo && cat path_to.bin >> fifo.fifo +SignalSource.sample_type=ishort; ; sample representation in fifo stream - will always output gr_complex +SignalSource.dump=false +;SignalSource.dump_filename=dump + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.iono_model=Broadcast +PVT.trop_model=Saastamoinen +PVT.output_path=./files diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 42ad129d8..d4ea3888f 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -95,6 +95,7 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES signal_source_base.cc file_source_base.cc file_signal_source.cc + fifo_signal_source.cc multichannel_file_signal_source.cc gen_signal_source.cc nsr_file_signal_source.cc @@ -111,6 +112,7 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS signal_source_base.h file_source_base.h file_signal_source.h + fifo_signal_source.h multichannel_file_signal_source.h gen_signal_source.h nsr_file_signal_source.h diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc new file mode 100644 index 000000000..c7854f809 --- /dev/null +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -0,0 +1,93 @@ +/*! + * \file file_source_base.cc + * + * \brief Implementation of the class for retrieving samples through a Unix fifo + * \author Malte Lenhart, 2021. malte.lenhart(at)mailbox.org + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "fifo_signal_source.h" +#include "configuration_interface.h" +#include "fifo_reader.h" +#include "gnss_sdr_filesystem.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include "gnss_sdr_valve.h" +#include +#include // ceil, floor +#include +#include // move + + +using namespace std::string_literals; + +FifoSignalSource::FifoSignalSource(ConfigurationInterface const* configuration, + std::string const& role, unsigned int in_streams, unsigned int out_streams, + Concurrent_Queue* queue) + : SignalSourceBase(configuration, role, "Fifo_Signal_Source"s), + item_size_(sizeof(gr_complex)), // currenty output item size is always gr_complex + fifo_reader_(FifoReader::make(configuration->property(role + ".filename"s, "../data/example_capture.dat"s), + configuration->property(role + ".sample_type"s, "ishort"s))), + dump_(configuration->property(role + ".dump", false)), + dump_filename_(configuration->property(role + ".dump_filename"s, "./data/signal_source.dat"s)) +{ + if (dump_) + { + DLOG(INFO) << "Dumping output into file " << (dump_filename_ + ".bin"s); + file_sink_ = gr::blocks::file_sink::make(item_size_, (dump_filename_ + ".bin").c_str()); + } + + if (in_streams > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + +void FifoSignalSource::connect(gr::top_block_sptr top_block) +{ + // here we could add a throttle as done in the file_source_base if required + if (dump_) + { + top_block->connect(fifo_reader_, 0, file_sink_, 0); + DLOG(INFO) << "connected source to file sink"; + } +} + +void FifoSignalSource::disconnect(gr::top_block_sptr top_block) +{ + if (dump_) + { + top_block->disconnect(fifo_reader_, 0, file_sink_, 0); + DLOG(INFO) << "disconnected source to file sink"; + } +} + +size_t FifoSignalSource::item_size() +{ + return item_size_; +} + +gr::basic_block_sptr FifoSignalSource::get_left_block() +{ + LOG(WARNING) << "Left block of a signal source should not be retrieved"; + return gr::blocks::file_source::sptr(); +} + + +gr::basic_block_sptr FifoSignalSource::get_right_block() +{ + return fifo_reader_; +} diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.h b/src/algorithms/signal_source/adapters/fifo_signal_source.h new file mode 100644 index 000000000..22ca60e3b --- /dev/null +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.h @@ -0,0 +1,83 @@ +/*! + * \file file_source_base.h + * + * \brief Header file of the class for retrieving samples through a Unix fifo + * \author Malte Lenhart, 2021. malte.lenhart(at)mailbox.org + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2021 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FIFO_SOURCE_BASE_H +#define GNSS_SDR_FIFO_SOURCE_BASE_H + +#include "concurrent_queue.h" +#include "file_source_base.h" +#include "gnss_block_interface.h" +#include +#include +#include +#include + +// for dump +#include +#include +#include + + +class ConfigurationInterface; + + +//! \brief Class that reads a sample stream from a Unix fifo +//! +//! This class supports the following properties: +//! +//! .filename - the path to the input file +//! - may be overridden by the -signal_source or -s command-line arguments +//! +//! .sample_type - data type read out from the fifo. default ishort ; +//! - note: not output format. that is always gr_complex +//! +//! .dump - whether to archive input data +//! +//! .dump_filename - if dumping, path to file for output + + +class FifoSignalSource : public SignalSourceBase +{ +public: + FifoSignalSource(const ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams, + Concurrent_Queue* queue); + + ~FifoSignalSource() = default; + + //! override methods from GNSSBlockInterface + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + size_t item_size() override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +protected: +private: + //! output size - always gr_complex + const size_t item_size_; + //! internal fifo_reader_ class acts as signal source + const gnss_shared_ptr fifo_reader_; + + gnss_shared_ptr file_sink_; + const bool dump_; + const std::string dump_filename_; +}; + + +#endif diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index cc88f2607..96fa168c2 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -14,6 +14,7 @@ endif() set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES + fifo_reader.cc unpack_byte_2bit_samples.cc unpack_byte_2bit_cpx_samples.cc unpack_byte_4bit_samples.cc @@ -27,6 +28,7 @@ set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES set(SIGNAL_SOURCE_GR_BLOCKS_HEADERS + fifo_reader.h unpack_byte_2bit_samples.h unpack_byte_2bit_cpx_samples.h unpack_byte_4bit_samples.h diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc new file mode 100644 index 000000000..82a99eb57 --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc @@ -0,0 +1,111 @@ +/*! + * \file fifo_reader.cc + * + * \brief Implementation of the class to retrieve samples from an existing Unix FIFO + * \author Malte Lenhart, 2021. malte.lenhart(at)mailbox.org + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "fifo_reader.h" +#include +#include +#include +#include +#include + +// initial construction; pass to private constructor +FifoReader::sptr FifoReader::make(const std::string &file_name, const std::string &sample_type) +{ + return gnuradio::get_initial_sptr(new FifoReader(file_name, sample_type)); +} + +// private constructor called by ::make +FifoReader::FifoReader(const std::string &file_name, const std::string &sample_type) + : gr::sync_block("fifo_reader", + gr::io_signature::make(0, 0, 0), // no input + gr::io_signature::make(1, 1, sizeof(gr_complex))), // <+MIN_OUT+>, <+MAX_OUT+>, sizeof(<+OTYPE+>) + file_name_(file_name), + sample_type_(sample_type) +{ + std::cout << "Starting FifoReader\n"; + // instream: https://en.cppreference.com/w/cpp/io/basic_ifstream +} + +bool FifoReader::start() +{ + fifo_.open(file_name_, std::ios::binary); + if (!fifo_.is_open()) + { + DLOG(ERROR) << "Error opening fifo\n"; + return false; + } + return true; +} + +// work loop +// taken from here: https://stackoverflow.com/questions/25546619/work-with-fifo-in-c-blocking-read +int FifoReader::work(int noutput_items, + __attribute__((unused)) gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + if (output_items.size() > 1) + { + DLOG(ERROR) << "FifoReader connected to too many outputs\n"; + } + + // read samples out + size_t items_retrieved = 0; + if (sample_type_ == "ishort") + { + // ishort == int16_t + items_retrieved = read_interleaved(noutput_items, output_items); + } + else if (sample_type_ == "gr_complex") + { + DLOG(WARNING) << sample_type_ << " is not yet tested. Please consider removing this warning if tested successfully\n"; + items_retrieved = read_gr_complex(noutput_items, output_items); + } + else + { + // please see gr_complex_ip_packet_source for inspiration on how to implement other sample types + DLOG(ERROR) << sample_type_ << " is unfortunately not yet implemented as sample type\n"; + } + + // we return varying number of data -> call produce & return flag + produce(0, items_retrieved); + return this->WORK_CALLED_PRODUCE; +} + +// read gr_complex items from fifo +size_t FifoReader::read_gr_complex(int noutput_items, gr_vector_void_star &output_items) +{ + size_t items_retrieved = 0; + for (int n = 0; n < noutput_items; n++) + { + std::vector buffer(4); + fifo_.read((char *)&buffer[0], buffer.size()); + if (fifo_.good()) + { + gr_complex sample; + memcpy(&sample, &buffer[0], sizeof(sample)); + static_cast(output_items.at(0))[n] = sample; + items_retrieved++; + } + else if (fifo_.eof() || fifo_.fail()) + { + // not enough samples.. what if we did not have a complete sample? need to reassemble in between loops + fifo_.clear(); + break; + } + } + return items_retrieved; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h new file mode 100644 index 000000000..9f45ffd13 --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h @@ -0,0 +1,93 @@ +/*! + * \file fifo_reader.h + * + * \brief Header file to retrieve samples from an existing Unix FIFO + * \author Malte Lenhart, 2021. malte.lenhart(at)mailbox.org + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FIFO_READER_H_ +#define GNSS_SDR_FIFO_READER_H_ + +#include "gnss_block_interface.h" +#include +#include // std::ifstream + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_gnuradio_blocks + * \{ */ + +class FifoReader : virtual public gr::sync_block +{ +public: + //! \brief static function to create a class instance + using sptr = gnss_shared_ptr; + static sptr make(const std::string &file_name, const std::string &sample_type); + + ~FifoReader() = default; + + //! initialize istream resource for fifo + bool start(); + + // gnu radio work cycle function + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + //! \brief Constructor + //! private constructor called by function make + //! (gr handles this with public and private header pair) + FifoReader(const std::string &file_name, const std::string &sample_type); + + + size_t read_gr_complex(int noutput_items, gr_vector_void_star &output_items); + //! function to read data out of fifo which is stored as interleaved I/Q stream. + //! template argument determines sample_type + template + size_t read_interleaved(int noutput_items, gr_vector_void_star &output_items) + { + size_t items_retrieved = 0; + for (int n = 0; n < noutput_items; n++) + { + // TODO: try if performance increases if we copy larger chunks to vector. + // read from fifo: https://en.cppreference.com/w/cpp/io/basic_ifstream + std::vector buffer(4); // dynamically change buffer size depending on read speed? where to throttle? + fifo_.read((char *)&buffer[0], buffer.size()); + if (fifo_.good()) + { + Type real; + Type imag; + memcpy(&real, &buffer[0], sizeof(real)); + memcpy(&imag, &buffer[2], sizeof(imag)); + static_cast(output_items.at(0))[n] = gr_complex(imag, real); + items_retrieved++; + } + else if (fifo_.eof() || fifo_.fail()) + { + // not enough samples.. what if we did not have a complete sample? need to reassemble in between loops + fifo_.clear(); + break; + } + } + return items_retrieved; + } + + const std::string file_name_; + const std::string sample_type_; + std::ifstream fifo_; +}; + +/** \} */ +/** \} */ +#endif /* GNSS_SDR_FIFO_READER_H_ */ diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 0085b9612..3d587b74b 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -38,6 +38,7 @@ #include "configuration_interface.h" #include "direct_resampler_conditioner.h" #include "file_signal_source.h" +#include "fifo_signal_source.h" #include "fir_filter.h" #include "freq_xlating_fir_filter.h" #include "galileo_e1_dll_pll_veml_tracking.h" @@ -647,6 +648,12 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } // SIGNAL SOURCES ---------------------------------------------------------- + else if (implementation == "Fifo_Signal_Source") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } else if (implementation == "File_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, From f9da05c783b436607fa288996e898ac3169cdc67 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 14:51:10 +0200 Subject: [PATCH 02/14] added missing std:: as suggested by clang-tidy --- .../signal_generator/gnuradio_blocks/signal_generator_c.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index a49f476fe..2f075b98d 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -272,7 +272,7 @@ void signal_generator_c::generate_codes() { for (unsigned int i = 0; i < vector_length_; i++) { - sampled_code_pilot_[sat][i] *= sqrt(std::pow(10.0F, CN0_dB_[sat] / 10.0F) / BW_BB_ / 2.0F); + sampled_code_pilot_[sat][i] *= std::sqrt(std::pow(10.0F, CN0_dB_[sat] / 10.0F) / BW_BB_ / 2.0F); } } } @@ -313,7 +313,7 @@ void signal_generator_c::generate_codes() { for (unsigned int i = 0; i < vector_length_; i++) { - sampled_code_pilot_[sat][i] *= sqrt(std::pow(10.0F, CN0_dB_[sat] / 10.0F) / BW_BB_ / 2.0F); + sampled_code_pilot_[sat][i] *= std::sqrt(std::pow(10.0F, CN0_dB_[sat] / 10.0F) / BW_BB_ / 2.0F); } } } From de57a26312514877ad3c10fce609bd4e98ee4d36 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 14:52:51 +0200 Subject: [PATCH 03/14] renamed is_complex to is_interleaved to better describe behavior, modernized c-style cast, fixed typo --- .../signal_source/adapters/file_source_base.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/algorithms/signal_source/adapters/file_source_base.cc b/src/algorithms/signal_source/adapters/file_source_base.cc index cdacaac5d..72758309a 100644 --- a/src/algorithms/signal_source/adapters/file_source_base.cc +++ b/src/algorithms/signal_source/adapters/file_source_base.cc @@ -261,7 +261,7 @@ uint64_t FileSourceBase::samples() const std::tuple FileSourceBase::itemTypeToSize() { - auto is_complex_t = false; + auto is_interleaved = false; auto item_size = size_t(0); if (item_type_ == "gr_complex") @@ -279,7 +279,7 @@ std::tuple FileSourceBase::itemTypeToSize() else if (item_type_ == "ishort") { item_size = sizeof(int16_t); - is_complex_t = true; + is_interleaved = true; } else if (item_type_ == "byte") { @@ -288,7 +288,7 @@ std::tuple FileSourceBase::itemTypeToSize() else if (item_type_ == "ibyte") { item_size = sizeof(int8_t); - is_complex_t = true; + is_interleaved = true; } else { @@ -297,7 +297,7 @@ std::tuple FileSourceBase::itemTypeToSize() item_size = sizeof(gr_complex); } - return std::make_tuple(item_size, is_complex_t); + return std::make_tuple(item_size, is_interleaved); } @@ -338,7 +338,7 @@ size_t FileSourceBase::samplesToSkip() const size_t FileSourceBase::computeSamplesInFile() const { - auto n_samples = size_t(samples()); + auto n_samples = static_cast(samples()); // if configured with 0 samples (read the whole file), figure out how many samples are in the file, and go from there if (n_samples == 0) @@ -467,7 +467,7 @@ gnss_shared_ptr FileSourceBase::create_valve() if (samples() > 0) { // if a number of samples is specified, honor it by creating a valve - // In practice, this is always true + // in practice, this is always true valve_ = gnss_sdr_make_valve(source_item_size(), samples(), queue_); DLOG(INFO) << "valve(" << valve_->unique_id() << ")"; @@ -499,7 +499,7 @@ void FileSourceBase::create_valve_hook() {} void FileSourceBase::create_sink_hook() {} -// Subclass hooks for connection/disconnectino +// Subclass hooks for connection/disconnection void FileSourceBase::pre_connect_hook(gr::top_block_sptr top_block [[maybe_unused]]) {} // NOLINT(performance-unnecessary-value-param) void FileSourceBase::post_connect_hook(gr::top_block_sptr top_block [[maybe_unused]]) {} // NOLINT(performance-unnecessary-value-param) void FileSourceBase::pre_disconnect_hook(gr::top_block_sptr top_block [[maybe_unused]]) {} // NOLINT(performance-unnecessary-value-param) From aaa0e09c1d10bcf4e9ccd6892922831ca3aa5bde Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 18:48:47 +0200 Subject: [PATCH 04/14] added ishort support into custom_udp_signal_source. removed redundant switch block, made overflow events less confusing with number 0 and added explanation to startup --- .../gr_complex_ip_packet_source.cc | 63 +++++++++++-------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index 6d43166a7..a5e878813 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -27,7 +27,7 @@ #include #endif -const int FIFO_SIZE = 1472000; +const int FIFO_SIZE = 1'472'000; /* 4 bytes IP address */ @@ -104,6 +104,7 @@ Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device, gr::io_signature::make(1, 4, item_size)) // 1 to 4 baseband complex channels { std::cout << "Start Ethernet packet capture\n"; + std::cout << "Overflow events will be indicated by o's\n"; d_n_baseband_channels = n_baseband_channels; if (wire_sample_type == "cbyte") @@ -121,6 +122,11 @@ Gr_Complex_Ip_Packet_Source::Gr_Complex_Ip_Packet_Source(std::string src_device, d_wire_sample_type = 3; d_bytes_per_sample = d_n_baseband_channels * 8; } + else if (wire_sample_type == "ishort") + { + d_wire_sample_type = 4; + d_bytes_per_sample = d_n_baseband_channels * 4; + } else { std::cout << "Unknown wire sample type\n"; @@ -307,7 +313,7 @@ void Gr_Complex_Ip_Packet_Source::pcap_callback(__attribute__((unused)) u_char * else { // notify overflow - std::cout << "O" << std::flush; + std::cout << "o" << std::flush; } } } @@ -397,6 +403,25 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu } } break; + case 4: // interleaved short samples + for (const auto &output_item : output_items) + { + int16_t real; + int16_t imag; + memcpy(&real, &fifo_buff[fifo_read_ptr], sizeof(real)); + fifo_read_ptr += 2; // two bytes in short + memcpy(&imag, &fifo_buff[fifo_read_ptr], sizeof(imag)); + fifo_read_ptr += 2; // two bytes in short + if (d_IQ_swap) + { + static_cast(output_item)[n] = gr_complex(real, imag); + } + else + { + static_cast(output_item)[n] = gr_complex(imag, real); + } + } + break; default: std::cout << "Unknown wire sample type\n"; exit(0); @@ -422,36 +447,20 @@ int Gr_Complex_Ip_Packet_Source::work(int noutput_items, if (output_items.size() > static_cast(d_n_baseband_channels)) { - std::cout << "Configuration error: more baseband channels connected than the available in the UDP source\n"; + std::cout << "Configuration error: more baseband channels connected than available in the UDP source\n"; exit(0); } int num_samples_readed; int bytes_requested; - switch (d_wire_sample_type) + + bytes_requested = noutput_items * d_bytes_per_sample; + if (bytes_requested < fifo_items) { - case 1: // complex byte samples - case 2: // complex 4 bits samples - case 3: // complex float samples - bytes_requested = noutput_items * d_bytes_per_sample; - if (bytes_requested < fifo_items) - { - num_samples_readed = noutput_items; // read all - } - else - { - num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have - } - break; - default: // complex byte samples - bytes_requested = noutput_items * d_bytes_per_sample; - if (bytes_requested < fifo_items) - { - num_samples_readed = noutput_items; // read all - } - else - { - num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have - } + num_samples_readed = noutput_items; // read all + } + else + { + num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have } bytes_requested = num_samples_readed * d_bytes_per_sample; From cad8659116b73070a7a857e299bf79bb3009ecbe Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 19:32:10 +0200 Subject: [PATCH 05/14] added license to config file, applied clang-formatting rules to overlooked files --- conf/gnss-sdr_GPS_L1_fifo.conf | 9 +++++++++ src/core/receiver/gnss_block_factory.cc | 12 ++++++------ src/core/system_parameters/galileo_inav_message.h | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/conf/gnss-sdr_GPS_L1_fifo.conf b/conf/gnss-sdr_GPS_L1_fifo.conf index d73a77e10..a339ffb35 100644 --- a/conf/gnss-sdr_GPS_L1_fifo.conf +++ b/conf/gnss-sdr_GPS_L1_fifo.conf @@ -1,3 +1,12 @@ +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + [GNSS-SDR] ;######### GLOBAL OPTIONS ################## diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 3d587b74b..b99f5a686 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -37,8 +37,8 @@ #include "channel.h" #include "configuration_interface.h" #include "direct_resampler_conditioner.h" -#include "file_signal_source.h" #include "fifo_signal_source.h" +#include "file_signal_source.h" #include "fir_filter.h" #include "freq_xlating_fir_filter.h" #include "galileo_e1_dll_pll_veml_tracking.h" @@ -649,11 +649,11 @@ std::unique_ptr GNSSBlockFactory::GetBlock( // SIGNAL SOURCES ---------------------------------------------------------- else if (implementation == "Fifo_Signal_Source") - { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, - out_streams, queue); - block = std::move(block_); - } + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } else if (implementation == "File_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index f2e6273d6..5fbc960ec 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -366,7 +366,7 @@ private: int32_t current_IODnav{}; - std::vector rs_buffer; // Reed-Solomon buffer + std::vector rs_buffer; // Reed-Solomon buffer uint8_t IODnav_LSB17{}; uint8_t IODnav_LSB18{}; From 170e4666d138fd67fbab4d9cad2643e6b86cda95 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 19:40:47 +0200 Subject: [PATCH 06/14] overlooked one tab in a comment section which clang-tidy does not fix this should fix the failing clang-tidy check --- src/algorithms/signal_source/adapters/fifo_signal_source.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.h b/src/algorithms/signal_source/adapters/fifo_signal_source.h index 22ca60e3b..e46d22855 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.h +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.h @@ -44,7 +44,7 @@ class ConfigurationInterface; //! - may be overridden by the -signal_source or -s command-line arguments //! //! .sample_type - data type read out from the fifo. default ishort ; -//! - note: not output format. that is always gr_complex +//! - note: not output format. that is always gr_complex //! //! .dump - whether to archive input data //! From 2072197f0f3d2e9b811f975c594cb4f3bfcf95fd Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sat, 17 Apr 2021 22:51:29 +0200 Subject: [PATCH 07/14] header cleanup, added documentation comments --- .../adapters/fifo_signal_source.cc | 6 ++--- .../adapters/fifo_signal_source.h | 24 ++++++++----------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index c7854f809..3730a9e52 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -18,14 +18,12 @@ #include "fifo_signal_source.h" #include "configuration_interface.h" #include "fifo_reader.h" -#include "gnss_sdr_filesystem.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" -#include "gnss_sdr_valve.h" #include +#include +#include #include // ceil, floor -#include -#include // move using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.h b/src/algorithms/signal_source/adapters/fifo_signal_source.h index e46d22855..1a637445f 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.h +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.h @@ -16,26 +16,21 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_FIFO_SOURCE_BASE_H -#define GNSS_SDR_FIFO_SOURCE_BASE_H +#ifndef GNSS_SDR_FIFO_SIGNAL_SOURCE_H +#define GNSS_SDR_FIFO_SIGNAL_SOURCE_H #include "concurrent_queue.h" -#include "file_source_base.h" -#include "gnss_block_interface.h" -#include -#include +#include "signal_source_base.h" #include -#include -// for dump -#include -#include -#include +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ class ConfigurationInterface; - //! \brief Class that reads a sample stream from a Unix fifo //! //! This class supports the following properties: @@ -79,5 +74,6 @@ private: const std::string dump_filename_; }; - -#endif +/** \} */ +/** \} */ +#endif // GNSS_SDR_FIFO_SIGNAL_SOURCE_H From dbc8ea18bfd6fbe604261a97fc53562b79b3ed15 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Sun, 18 Apr 2021 13:22:12 +0200 Subject: [PATCH 08/14] addressing feedback by @jwmelto - documentation file name mismatch - removed unnecc. headers - changed std::cout to GLOG - simlified read process for gr_complex data types - seperated fifo end of file check from fail/other types (also added default case for unforseen events) - changed vector to array for interleaved read fct other changes: - harmonized FIFO capitalization in docs - changed gr_complex constructor. Real/Imaginary parts were swapped in upd source class used for reference. Not intuitive there though (swap= false will call constructor w/ (imag, real). Swapping should introduce just a phase shift, so it didn't break functionality for me either way. --- .../adapters/fifo_signal_source.cc | 8 ++--- .../adapters/fifo_signal_source.h | 12 ++++---- .../gnuradio_blocks/fifo_reader.cc | 30 +++++++++---------- .../gnuradio_blocks/fifo_reader.h | 20 ++++++++----- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 3730a9e52..27b96a0e6 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -1,7 +1,7 @@ /*! - * \file file_source_base.cc + * \file fifo_signal_source.cc * - * \brief Implementation of the class for retrieving samples through a Unix fifo + * \brief Implementation of the class for retrieving samples through a Unix FIFO * \author Malte Lenhart, 2021. malte.lenhart(at)mailbox.org * * ----------------------------------------------------------------------------- @@ -18,12 +18,10 @@ #include "fifo_signal_source.h" #include "configuration_interface.h" #include "fifo_reader.h" -#include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include #include #include -#include // ceil, floor using namespace std::string_literals; @@ -69,7 +67,7 @@ void FifoSignalSource::disconnect(gr::top_block_sptr top_block) if (dump_) { top_block->disconnect(fifo_reader_, 0, file_sink_, 0); - DLOG(INFO) << "disconnected source to file sink"; + DLOG(INFO) << "disconnected source from file sink"; } } diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.h b/src/algorithms/signal_source/adapters/fifo_signal_source.h index 1a637445f..c3c83be9f 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.h +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.h @@ -1,7 +1,7 @@ /*! - * \file file_source_base.h + * \file fifo_signal_source.h * - * \brief Header file of the class for retrieving samples through a Unix fifo + * \brief Header file of the class for retrieving samples through a Unix FIFO * \author Malte Lenhart, 2021. malte.lenhart(at)mailbox.org * * @@ -29,23 +29,23 @@ /** \addtogroup Signal_Source_adapters * \{ */ +// forward declaration to avoid include in header class ConfigurationInterface; -//! \brief Class that reads a sample stream from a Unix fifo +//! \brief Class that reads a sample stream from a Unix FIFO. //! //! This class supports the following properties: //! //! .filename - the path to the input file //! - may be overridden by the -signal_source or -s command-line arguments //! -//! .sample_type - data type read out from the fifo. default ishort ; +//! .sample_type - data type read out from the FIFO. default ishort ; //! - note: not output format. that is always gr_complex //! //! .dump - whether to archive input data //! //! .dump_filename - if dumping, path to file for output - - +//! class FifoSignalSource : public SignalSourceBase { public: diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc index 82a99eb57..092d6dcd3 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc @@ -17,10 +17,6 @@ #include "fifo_reader.h" #include -#include -#include -#include -#include // initial construction; pass to private constructor FifoReader::sptr FifoReader::make(const std::string &file_name, const std::string &sample_type) @@ -36,8 +32,7 @@ FifoReader::FifoReader(const std::string &file_name, const std::string &sample_t file_name_(file_name), sample_type_(sample_type) { - std::cout << "Starting FifoReader\n"; - // instream: https://en.cppreference.com/w/cpp/io/basic_ifstream + DLOG(INFO) << "Starting FifoReader"; } bool FifoReader::start() @@ -45,7 +40,7 @@ bool FifoReader::start() fifo_.open(file_name_, std::ios::binary); if (!fifo_.is_open()) { - DLOG(ERROR) << "Error opening fifo\n"; + LOG(ERROR) << "Error opening FIFO"; return false; } return true; @@ -59,7 +54,7 @@ int FifoReader::work(int noutput_items, { if (output_items.size() > 1) { - DLOG(ERROR) << "FifoReader connected to too many outputs\n"; + LOG(ERROR) << "FifoReader connected to too many outputs"; } // read samples out @@ -71,13 +66,13 @@ int FifoReader::work(int noutput_items, } else if (sample_type_ == "gr_complex") { - DLOG(WARNING) << sample_type_ << " is not yet tested. Please consider removing this warning if tested successfully\n"; + LOG(WARNING) << sample_type_ << " is not yet tested. Please consider removing this warning if tested successfully"; items_retrieved = read_gr_complex(noutput_items, output_items); } else { // please see gr_complex_ip_packet_source for inspiration on how to implement other sample types - DLOG(ERROR) << sample_type_ << " is unfortunately not yet implemented as sample type\n"; + LOG(ERROR) << sample_type_ << " is unfortunately not yet implemented as sample type"; } // we return varying number of data -> call produce & return flag @@ -86,26 +81,29 @@ int FifoReader::work(int noutput_items, } // read gr_complex items from fifo +// this fct has duplicate code with the templated read_interleaved fct in header size_t FifoReader::read_gr_complex(int noutput_items, gr_vector_void_star &output_items) { size_t items_retrieved = 0; for (int n = 0; n < noutput_items; n++) { - std::vector buffer(4); - fifo_.read((char *)&buffer[0], buffer.size()); + gr_complex sample; + fifo_.read(reinterpret_cast(&sample), sizeof(sample)); if (fifo_.good()) { - gr_complex sample; - memcpy(&sample, &buffer[0], sizeof(sample)); static_cast(output_items.at(0))[n] = sample; items_retrieved++; } - else if (fifo_.eof() || fifo_.fail()) + else if (fifo_.eof()) { - // not enough samples.. what if we did not have a complete sample? need to reassemble in between loops fifo_.clear(); break; } + else + { + LOG(ERROR) << "unhandled FIFO event"; + break; + } } return items_retrieved; } diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h index 9f45ffd13..a955bd474 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h @@ -36,7 +36,7 @@ public: ~FifoReader() = default; - //! initialize istream resource for fifo + //! initialize istream resource for FIFO bool start(); // gnu radio work cycle function @@ -52,7 +52,7 @@ private: size_t read_gr_complex(int noutput_items, gr_vector_void_star &output_items); - //! function to read data out of fifo which is stored as interleaved I/Q stream. + //! function to read data out of FIFO which is stored as interleaved I/Q stream. //! template argument determines sample_type template size_t read_interleaved(int noutput_items, gr_vector_void_star &output_items) @@ -61,24 +61,28 @@ private: for (int n = 0; n < noutput_items; n++) { // TODO: try if performance increases if we copy larger chunks to vector. - // read from fifo: https://en.cppreference.com/w/cpp/io/basic_ifstream - std::vector buffer(4); // dynamically change buffer size depending on read speed? where to throttle? - fifo_.read((char *)&buffer[0], buffer.size()); + // how to read from stream: https://en.cppreference.com/w/cpp/io/basic_ifstream + std::array buffer; // gr_complex is 32bit = 4*char + fifo_.read(reinterpret_cast(&buffer[0]), buffer.size()); if (fifo_.good()) { Type real; Type imag; memcpy(&real, &buffer[0], sizeof(real)); memcpy(&imag, &buffer[2], sizeof(imag)); - static_cast(output_items.at(0))[n] = gr_complex(imag, real); + static_cast(output_items.at(0))[n] = gr_complex(real, imag); items_retrieved++; } - else if (fifo_.eof() || fifo_.fail()) + else if (fifo_.eof()) { - // not enough samples.. what if we did not have a complete sample? need to reassemble in between loops fifo_.clear(); break; } + else + { + LOG(ERROR) << "unhandled FIFO event"; + break; + } } return items_retrieved; } From 595733bf67ad17f9c0a737f6cff3ea4a97e1b7f8 Mon Sep 17 00:00:00 2001 From: Lenhart Date: Mon, 19 Apr 2021 16:05:53 +0200 Subject: [PATCH 09/14] moved logging output from template fct in header to source file to not have to include logging in header. Added maybe_unused to constructor argument which is unused to fix warning --- .../signal_source/adapters/fifo_signal_source.cc | 2 +- .../signal_source/gnuradio_blocks/fifo_reader.cc | 7 ++++++- src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h | 7 +++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 27b96a0e6..9ab222ebf 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -28,7 +28,7 @@ using namespace std::string_literals; FifoSignalSource::FifoSignalSource(ConfigurationInterface const* configuration, std::string const& role, unsigned int in_streams, unsigned int out_streams, - Concurrent_Queue* queue) + [[maybe_unused]] Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "Fifo_Signal_Source"s), item_size_(sizeof(gr_complex)), // currenty output item size is always gr_complex fifo_reader_(FifoReader::make(configuration->property(role + ".filename"s, "../data/example_capture.dat"s), diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc index 092d6dcd3..4eb7d53cf 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc @@ -101,9 +101,14 @@ size_t FifoReader::read_gr_complex(int noutput_items, gr_vector_void_star &outpu } else { - LOG(ERROR) << "unhandled FIFO event"; + fifo_error_output(); break; } } return items_retrieved; } + +void FifoReader::fifo_error_output() const +{ + LOG(ERROR) << "unhandled FIFO event"; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h index a955bd474..4ddf281cd 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h @@ -26,7 +26,6 @@ * \{ */ /** \addtogroup Signal_Source_gnuradio_blocks * \{ */ - class FifoReader : virtual public gr::sync_block { public: @@ -80,13 +79,17 @@ private: } else { - LOG(ERROR) << "unhandled FIFO event"; + fifo_error_output(); break; } } return items_retrieved; } + //! this function moves logging output from this header into the source file + //! thereby eliminating the need to include glog/logging.h in this header + void fifo_error_output() const; + const std::string file_name_; const std::string sample_type_; std::ifstream fifo_; From b43f2e356ab2de3e33238193fe9b4697dd02d6ea Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Apr 2021 16:24:26 +0200 Subject: [PATCH 10/14] Update changelog and add Malte to the list of contributors --- AUTHORS | 1 + docs/changelog.md | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/AUTHORS b/AUTHORS index aa7b0c2f5..4d7536e6c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -54,6 +54,7 @@ Gerald LaMountain gerald@gece.neu.edu Contributor Jim Melton jim.melton@sncorp.com Contributor Josh Schindehette jschindehette@geontech.com Contributor Leonardo Tonetto tonetto.dev@gmail.com Contributor +Malte Lenhart malte.lenhart@mailbox.org Contributor Mara Branzanti mara.branzanti@gmail.com Contributor Marc Molina marc.molina.pena@gmail.com Contributor Marc Sales marcsales92@gmail.com Contributor diff --git a/docs/changelog.md b/docs/changelog.md index b814caef2..380cf2f63 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -62,6 +62,11 @@ SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades Date: Mon, 19 Apr 2021 21:21:34 +0200 Subject: [PATCH 11/14] removing c++14 digit seperator language feature --- .../gnuradio_blocks/gr_complex_ip_packet_source.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index a5e878813..0269dfd33 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -27,7 +27,7 @@ #include #endif -const int FIFO_SIZE = 1'472'000; +const int FIFO_SIZE = 1472000; /* 4 bytes IP address */ From 0b156a27412ce09304851e24e005827e2ccd57bc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Apr 2021 08:35:22 +0200 Subject: [PATCH 12/14] Fix prettier-markdown CI job --- docs/changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 380cf2f63..09f833599 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -62,8 +62,8 @@ SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades Date: Tue, 20 Apr 2021 08:59:37 +0200 Subject: [PATCH 13/14] Improve wording --- docs/changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 09f833599..aca552202 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -65,8 +65,8 @@ SPDX-FileCopyrightText: 2011-2021 Carles Fernandez-Prades Date: Tue, 20 Apr 2021 09:11:59 +0200 Subject: [PATCH 14/14] Apply minor cosmetic changes Two blank lines within methods, for consistency with other files --- src/algorithms/signal_source/adapters/fifo_signal_source.cc | 4 ++++ src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 9ab222ebf..47b4620d5 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -52,6 +52,7 @@ FifoSignalSource::FifoSignalSource(ConfigurationInterface const* configuration, } } + void FifoSignalSource::connect(gr::top_block_sptr top_block) { // here we could add a throttle as done in the file_source_base if required @@ -62,6 +63,7 @@ void FifoSignalSource::connect(gr::top_block_sptr top_block) } } + void FifoSignalSource::disconnect(gr::top_block_sptr top_block) { if (dump_) @@ -71,11 +73,13 @@ void FifoSignalSource::disconnect(gr::top_block_sptr top_block) } } + size_t FifoSignalSource::item_size() { return item_size_; } + gr::basic_block_sptr FifoSignalSource::get_left_block() { LOG(WARNING) << "Left block of a signal source should not be retrieved"; diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h index 4ddf281cd..3d4e0c520 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.h @@ -49,7 +49,6 @@ private: //! (gr handles this with public and private header pair) FifoReader(const std::string &file_name, const std::string &sample_type); - size_t read_gr_complex(int noutput_items, gr_vector_void_star &output_items); //! function to read data out of FIFO which is stored as interleaved I/Q stream. //! template argument determines sample_type