mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 19:50:34 +00:00
add signal_source_interface
also adds a base implementation that most signal sources should inherit from. The gen_signal_source is inexplicably different (probably as a test fixture, commonality was not valued). Only the file_signal_source has been tested; all the sources are modified in the same way, but we all know the only proof of correctness is testing. The block factory was simplified a bit. Handling for legacy config files was pulled out of the flowgraph; now when the "0" instance of a component (Foo0) is created, if there is no config for it, then the legacy version (Foo) will be tried. This is different from passing -1 for the item number (which is still supported). Theoretically, all existing config files should still work.
This commit is contained in:
parent
8407acb7a7
commit
78362e7cba
@ -586,14 +586,14 @@ endif()
|
||||
################################################################################
|
||||
# Log4cpp - http://log4cpp.sourceforge.net/
|
||||
################################################################################
|
||||
#find_package(LOG4CPP)
|
||||
#set_package_properties(LOG4CPP PROPERTIES
|
||||
# PURPOSE "Required by GNU Radio."
|
||||
# TYPE REQUIRED
|
||||
#)
|
||||
#if(NOT LOG4CPP_FOUND)
|
||||
# message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
|
||||
#endif()
|
||||
find_package(LOG4CPP)
|
||||
set_package_properties(LOG4CPP PROPERTIES
|
||||
PURPOSE "Required by GNU Radio."
|
||||
TYPE REQUIRED
|
||||
)
|
||||
if(NOT LOG4CPP_FOUND)
|
||||
message(FATAL_ERROR "*** Log4cpp is required to build gnss-sdr")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
|
@ -92,6 +92,7 @@ endif()
|
||||
|
||||
|
||||
set(SIGNAL_SOURCE_ADAPTER_SOURCES
|
||||
signal_source_base.cc
|
||||
file_signal_source.cc
|
||||
multichannel_file_signal_source.cc
|
||||
gen_signal_source.cc
|
||||
@ -106,6 +107,7 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES
|
||||
)
|
||||
|
||||
set(SIGNAL_SOURCE_ADAPTER_HEADERS
|
||||
signal_source_base.h
|
||||
file_signal_source.h
|
||||
multichannel_file_signal_source.h
|
||||
gen_signal_source.h
|
||||
|
@ -42,9 +42,12 @@
|
||||
#include <vector>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *configuration,
|
||||
const std::string &role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused)))
|
||||
: SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_gain_mode("slow_attack");
|
||||
const double default_tx_attenuation_db = -10.0;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "fpga_dynamic_bit_selection.h"
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class Ad9361FpgaSignalSource : public SignalSourceInterface
|
||||
class Ad9361FpgaSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
Ad9361FpgaSignalSource(const ConfigurationInterface *configuration,
|
||||
@ -51,17 +51,12 @@ public:
|
||||
|
||||
void start() override;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Ad9361_Fpga_Signal_Source"
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Ad9361_Fpga_Signal_Source";
|
||||
return ;
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
@ -93,8 +88,6 @@ private:
|
||||
std::shared_ptr<Fpga_Switch> switch_fpga;
|
||||
std::shared_ptr<Fpga_dynamic_bit_selection> dynamic_bit_selection_fpga;
|
||||
|
||||
std::string role_;
|
||||
|
||||
// Front-end settings
|
||||
std::string gain_mode_rx1_;
|
||||
std::string gain_mode_rx2_;
|
||||
|
@ -21,9 +21,13 @@
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused)))
|
||||
: SignalSourceBase(configuration, role, "Custom_UDP_Signal_Source"s)
|
||||
, in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
|
@ -18,10 +18,9 @@
|
||||
#ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "gr_complex_ip_packet_source.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
@ -42,29 +41,15 @@ class ConfigurationInterface;
|
||||
* \brief This class reads from UDP packets, which streams interleaved
|
||||
* I/Q samples over a network.
|
||||
*/
|
||||
class CustomUDPSignalSource : public SignalSourceInterface
|
||||
class CustomUDPSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
CustomUDPSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~CustomUDPSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Custom_UDP_Signal_Source"
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Custom_UDP_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -81,7 +66,6 @@ private:
|
||||
std::vector<gnss_shared_ptr<gr::block>> null_sinks_;
|
||||
std::vector<gnss_shared_ptr<gr::block>> file_sink_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
|
||||
|
@ -27,10 +27,13 @@
|
||||
#include <iostream> // for std::cerr
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
FileSignalSource::FileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
FileSignalSource::FileSignalSource(ConfigurationInterface const* configuration,
|
||||
std::string const& role, unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "File_Signal_Source"s)
|
||||
, in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("./example_capture.dat");
|
||||
const std::string default_item_type("short");
|
||||
|
@ -21,10 +21,9 @@
|
||||
#ifndef GNSS_SDR_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/blocks/throttle.h>
|
||||
@ -47,29 +46,15 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from a file
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class FileSignalSource : public SignalSourceInterface
|
||||
class FileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
FileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
||||
FileSignalSource(ConfigurationInterface const* configuration, std::string const& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~FileSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "File_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -111,7 +96,6 @@ private:
|
||||
gr::blocks::file_sink::sptr sink_;
|
||||
gr::blocks::throttle::sptr throttle_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string filename_;
|
||||
std::string dump_filename_;
|
||||
|
@ -23,12 +23,15 @@
|
||||
#include <teleorbit/frontend.h>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
FlexibandSignalSource::FlexibandSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_stream,
|
||||
unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused)))
|
||||
: SignalSourceBase(configuration, role, "Flexiband_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_item_type("byte");
|
||||
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||
|
@ -20,10 +20,9 @@
|
||||
#ifndef GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/char_to_float.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/blocks/float_to_complex.h>
|
||||
@ -47,7 +46,7 @@ class ConfigurationInterface;
|
||||
* \brief This class configures and reads samples from Teleorbit Flexiband front-end.
|
||||
* This software requires a Flexiband GNU Radio driver installed (not included with GNSS-SDR).
|
||||
*/
|
||||
class FlexibandSignalSource : public SignalSourceInterface
|
||||
class FlexibandSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
FlexibandSignalSource(const ConfigurationInterface* configuration,
|
||||
@ -56,19 +55,6 @@ public:
|
||||
|
||||
~FlexibandSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Flexiband_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Flexiband_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -87,7 +73,6 @@ private:
|
||||
std::vector<boost::shared_ptr<gr::block>> float_to_complex_;
|
||||
std::vector<gr::blocks::null_sink::sptr> null_sinks_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string firmware_filename_;
|
||||
std::string signal_file;
|
||||
|
@ -29,10 +29,12 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configuration,
|
||||
const std::string &role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t> *queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t> *queue)
|
||||
: SignalSourceBase(configuration, role, "Fmcomms2_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_item_type("gr_complex");
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
|
@ -20,9 +20,8 @@
|
||||
#ifndef GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#if GRIIO_INCLUDE_HAS_GNURADIO
|
||||
#include <gnuradio/iio/fmcomms2_source.h>
|
||||
@ -43,7 +42,7 @@
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class Fmcomms2SignalSource : public SignalSourceInterface
|
||||
class Fmcomms2SignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
Fmcomms2SignalSource(const ConfigurationInterface* configuration,
|
||||
@ -52,19 +51,6 @@ public:
|
||||
|
||||
~Fmcomms2SignalSource();
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Fmcomms2_Signal_Source"
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Fmcomms2_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -80,7 +66,6 @@ private:
|
||||
gnss_shared_ptr<gr::block> valve_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
|
||||
|
@ -55,6 +55,8 @@ public:
|
||||
//! Returns "Signal Source"
|
||||
inline std::string implementation() override { return "Signal Source"; }
|
||||
inline size_t item_size() override { return 0; }
|
||||
inline size_t getRfChannels() const final { return 0; }
|
||||
|
||||
inline std::shared_ptr<GNSSBlockInterface> signal_generator() const { return signal_generator_; }
|
||||
|
||||
private:
|
||||
|
@ -20,12 +20,15 @@
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gn3s/gn3s_source_cc.h>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
Gn3sSignalSource::Gn3sSignalSource(const ConfigurationInterface* configuration,
|
||||
std::string role,
|
||||
unsigned int in_stream,
|
||||
unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Gn3s_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_item_type("short");
|
||||
const std::string default_dump_file("./data/gn3s_source.dat");
|
||||
|
@ -18,10 +18,9 @@
|
||||
#ifndef GNSS_SDR_GN3S_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_GN3S_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <pmt/pmt.h>
|
||||
@ -40,7 +39,7 @@ class ConfigurationInterface;
|
||||
/*!
|
||||
* \brief This class reads samples from a GN3S USB dongle, a RF front-end signal sampler
|
||||
*/
|
||||
class Gn3sSignalSource : public SignalSourceInterface
|
||||
class Gn3sSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
Gn3sSignalSource(const ConfigurationInterface* configuration,
|
||||
@ -49,19 +48,6 @@ public:
|
||||
|
||||
~Gn3sSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Gn3s_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Gn3s_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -75,11 +61,10 @@ public:
|
||||
private:
|
||||
gr::block_sptr gn3s_source_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
size_t item_size_;
|
||||
int64_t samples_;
|
||||
[[maybe_unused]] int64_t samples_;
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
bool dump_;
|
||||
|
@ -18,12 +18,13 @@
|
||||
#include "configuration_interface.h"
|
||||
#include "labsat23_source.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cstdint>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Labsat_Signal_Source"s)
|
||||
, in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_item_type("gr_complex");
|
||||
const std::string default_dump_file("./labsat_output.dat");
|
||||
|
@ -18,7 +18,7 @@
|
||||
#ifndef GNSS_SDR_LABSAT_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_LABSAT_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
@ -40,29 +40,15 @@ class ConfigurationInterface;
|
||||
/*!
|
||||
* \brief This class reads samples stored by a LabSat 2 or LabSat 3 device
|
||||
*/
|
||||
class LabsatSignalSource : public SignalSourceInterface
|
||||
class LabsatSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
LabsatSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream,
|
||||
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~LabsatSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Labsat_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Labsat_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -78,7 +64,6 @@ private:
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
gr::blocks::throttle::sptr throttle_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string filename_;
|
||||
std::string dump_filename_;
|
||||
|
@ -27,18 +27,22 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
MultichannelFileSignalSource::MultichannelFileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Multichannel_File_Signal_Source"s)
|
||||
, in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("./example_capture.dat");
|
||||
const std::string default_item_type("short");
|
||||
const std::string default_dump_filename("./my_capture.dat");
|
||||
const std::string default_filename("./example_capture.dat"s);
|
||||
const std::string default_item_type("short"s);
|
||||
const std::string default_dump_filename("./my_capture.dat"s);
|
||||
|
||||
const double default_seconds_to_skip = 0.0;
|
||||
samples_ = configuration->property(role + ".samples", static_cast<uint64_t>(0));
|
||||
sampling_frequency_ = configuration->property(role + ".sampling_frequency", static_cast<int64_t>(0));
|
||||
n_channels_ = configuration->property(role + ".total_channels", 1);
|
||||
samples_ = configuration->property(role + ".samples"s, static_cast<uint64_t>(0));
|
||||
sampling_frequency_ = configuration->property(role + ".sampling_frequency"s, static_cast<int64_t>(0));
|
||||
n_channels_ = configuration->property(role + ".total_channels"s, 1);
|
||||
|
||||
for (int32_t n = 0; n < n_channels_; n++)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
@ -47,29 +47,15 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from files at different frequency bands
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class MultichannelFileSignalSource : public SignalSourceInterface
|
||||
class MultichannelFileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
MultichannelFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~MultichannelFileSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Multichannel_File_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Multichannel_File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -112,7 +98,6 @@ private:
|
||||
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
|
||||
std::vector<std::string> filename_vec_;
|
||||
std::string item_type_;
|
||||
std::string role_;
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
size_t item_size_;
|
||||
|
@ -27,10 +27,13 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
NsrFileSignalSource::NsrFileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Nsr_File_Signal_Source"s)
|
||||
, in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("../data/my_capture.dat");
|
||||
const std::string default_item_type("byte");
|
||||
@ -76,14 +79,14 @@ NsrFileSignalSource::NsrFileSignalSource(const ConfigurationInterface* configura
|
||||
<< "The receiver was configured to work with a file signal source\n"
|
||||
<< "but the specified file is unreachable by GNSS-SDR.\n"
|
||||
<< "Please modify your configuration file\n"
|
||||
<< "and point SignalSource.filename to a valid raw data file. Then:\n"
|
||||
<< "and point " << role << ".filename to a valid raw data file. Then:\n"
|
||||
<< "$ gnss-sdr --config_file=/path/to/my_GNSS_SDR_configuration.conf\n"
|
||||
<< "Examples of configuration files available at:\n"
|
||||
<< GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/\n";
|
||||
|
||||
LOG(WARNING) << "file_signal_source: Unable to open the samples file "
|
||||
<< filename_.c_str() << ", exiting the program.";
|
||||
throw(e);
|
||||
LOG(WARNING) << "nsr_file_signal_source: Unable to open the samples file "
|
||||
<< filename_ << ", exiting the program.";
|
||||
throw;
|
||||
}
|
||||
|
||||
DLOG(INFO) << "file_source(" << file_source_->unique_id() << ")";
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
@ -44,27 +44,14 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from a file
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class NsrFileSignalSource : public SignalSourceInterface
|
||||
class NsrFileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
NsrFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~NsrFileSignalSource() = default;
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Nsr_File_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Nsr_File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
@ -113,7 +100,6 @@ private:
|
||||
std::string filename_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
uint32_t in_streams_;
|
||||
uint32_t out_streams_;
|
||||
bool repeat_;
|
||||
|
@ -25,9 +25,13 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Osmosdr_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string empty;
|
||||
|
@ -19,10 +19,9 @@
|
||||
#ifndef GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <pmt/pmt.h>
|
||||
#include <cstdint>
|
||||
@ -44,7 +43,7 @@ class ConfigurationInterface;
|
||||
* HackRF or Realtek's RTL2832U-based USB dongle DVB-T receivers
|
||||
* (see https://osmocom.org/projects/rtl-sdr/wiki)
|
||||
*/
|
||||
class OsmosdrSignalSource : public SignalSourceInterface
|
||||
class OsmosdrSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
OsmosdrSignalSource(const ConfigurationInterface* configuration,
|
||||
@ -53,19 +52,6 @@ public:
|
||||
|
||||
~OsmosdrSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Osmosdr_Signal_Source"
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Osmosdr_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -83,7 +69,6 @@ private:
|
||||
gnss_shared_ptr<gr::block> valve_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string osmosdr_args_;
|
||||
|
@ -24,9 +24,13 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
PlutosdrSignalSource::PlutosdrSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Plutosdr_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_item_type("gr_complex");
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
|
@ -19,9 +19,8 @@
|
||||
#ifndef GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#if GRIIO_INCLUDE_HAS_GNURADIO
|
||||
#include <gnuradio/iio/pluto_source.h>
|
||||
@ -44,7 +43,7 @@ class ConfigurationInterface;
|
||||
|
||||
/*!
|
||||
*/
|
||||
class PlutosdrSignalSource : public SignalSourceInterface
|
||||
class PlutosdrSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
PlutosdrSignalSource(const ConfigurationInterface* configuration,
|
||||
@ -53,18 +52,6 @@ public:
|
||||
|
||||
~PlutosdrSignalSource() = default;
|
||||
|
||||
std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Plutosdr_Signal_Source"
|
||||
*/
|
||||
std::string implementation() override
|
||||
{
|
||||
return "Plutosdr_Signal_Source";
|
||||
}
|
||||
size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -81,7 +68,6 @@ private:
|
||||
gnss_shared_ptr<gr::block> valve_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
|
||||
std::string role_;
|
||||
std::string dump_filename_;
|
||||
|
||||
// Front-end settings
|
||||
|
@ -23,8 +23,11 @@
|
||||
#include <dbfcttc/raw_array.h>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
RawArraySignalSource::RawArraySignalSource(const ConfigurationInterface* configuration,
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
std::string role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Raw_Array_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
const std::string default_item_type("gr_complex");
|
||||
const std::string default_dump_file("./data/raw_array_source.dat");
|
||||
|
@ -18,10 +18,9 @@
|
||||
#ifndef GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
#include <gnuradio/hier_block2.h>
|
||||
#include <pmt/pmt.h>
|
||||
@ -41,7 +40,7 @@ class ConfigurationInterface;
|
||||
/*!
|
||||
* \brief This class reads samples from a GN3S USB dongle, a RF front-end signal sampler
|
||||
*/
|
||||
class RawArraySignalSource : public SignalSourceInterface
|
||||
class RawArraySignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
RawArraySignalSource(const ConfigurationInterface* configuration,
|
||||
@ -50,19 +49,6 @@ public:
|
||||
|
||||
~RawArraySignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "RawArraySignalSource".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Raw_Array_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -76,12 +62,11 @@ public:
|
||||
private:
|
||||
gr::block_sptr raw_array_source_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string eth_device_;
|
||||
size_t item_size_;
|
||||
int64_t samples_;
|
||||
[[maybe_unused]] int64_t samples_;
|
||||
unsigned int in_stream_;
|
||||
unsigned int out_stream_;
|
||||
bool dump_;
|
||||
|
@ -25,14 +25,15 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
RtlTcpSignalSource::RtlTcpSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_stream,
|
||||
unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
|
||||
in_stream_(in_stream),
|
||||
out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "RtlTcp_Signal_Source"s)
|
||||
, in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string default_dump_file("./data/signal_source.dat");
|
||||
|
@ -18,10 +18,9 @@
|
||||
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "rtl_tcp_signal_source_c.h"
|
||||
#include <gnuradio/blocks/deinterleave.h>
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
@ -44,10 +43,9 @@ class ConfigurationInterface;
|
||||
* I/Q samples over TCP.
|
||||
* (see https://osmocom.org/projects/rtl-sdr/wiki)
|
||||
*/
|
||||
class RtlTcpSignalSource : public SignalSourceInterface
|
||||
class RtlTcpSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
RtlTcpSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_stream,
|
||||
@ -56,19 +54,6 @@ public:
|
||||
|
||||
~RtlTcpSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "RtlTcp_Signal_Source"
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "RtlTcp_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -87,7 +72,6 @@ private:
|
||||
gnss_shared_ptr<gr::block> valve_;
|
||||
gr::blocks::file_sink::sptr file_sink_;
|
||||
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
|
||||
|
46
src/algorithms/signal_source/adapters/signal_source_base.cc
Normal file
46
src/algorithms/signal_source/adapters/signal_source_base.cc
Normal file
@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* \file signal_source_base.cc
|
||||
* \brief Base class for signal sources
|
||||
* \author Jim Melton, 2020. jim.melton(at)sncorp.com
|
||||
*
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "configuration_interface.h"
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
std::string SignalSourceBase::role()
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
std::string SignalSourceBase::implementation()
|
||||
{
|
||||
return implementation_;
|
||||
}
|
||||
|
||||
size_t SignalSourceBase::getRfChannels() const
|
||||
{
|
||||
return rfChannels_;
|
||||
}
|
||||
|
||||
SignalSourceBase::SignalSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl)
|
||||
: SignalSourceInterface(), role_(role), implementation_(impl), connected_(false), rfChannels_(configuration->property(role + ".RF_channels"s, 1u))
|
||||
{
|
||||
}
|
||||
|
52
src/algorithms/signal_source/adapters/signal_source_base.h
Normal file
52
src/algorithms/signal_source/adapters/signal_source_base.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*!
|
||||
* \file signal_source_base.h
|
||||
* \brief Header file of the base class to signal_source GNSS blocks.
|
||||
* \author Jim Melton, 2020. jim.melton(at)sncorp.com
|
||||
*
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_SIGNAL_SOURCE_BASE_H
|
||||
#define GNSS_SDR_SIGNAL_SOURCE_BASE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
|
||||
class ConfigurationInterface;
|
||||
|
||||
class SignalSourceBase : public SignalSourceInterface
|
||||
{
|
||||
public:
|
||||
std::string role() final;
|
||||
std::string implementation() final;
|
||||
|
||||
size_t getRfChannels() const override;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
SignalSourceBase(ConfigurationInterface const* configuration, std::string role, std::string impl);
|
||||
|
||||
private:
|
||||
std::string const role_;
|
||||
std::string const implementation_;
|
||||
bool connected_;
|
||||
size_t rfChannels_;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -28,9 +28,13 @@
|
||||
#include <utility>
|
||||
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpirFileSignalSource::SpirFileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Spir_File_Signal_Source"s)
|
||||
, in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("../data/my_capture.dat");
|
||||
const std::string default_item_type("int");
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_interface.h"
|
||||
@ -47,28 +47,15 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from a file
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class SpirFileSignalSource : public SignalSourceInterface
|
||||
class SpirFileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
SpirFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~SpirFileSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Spir_File_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Spir_File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
@ -114,7 +101,6 @@ private:
|
||||
std::string filename_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
|
@ -25,9 +25,12 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, uint32_t in_streams, uint32_t out_streams, Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
|
||||
const std::string& role, uint32_t in_streams, uint32_t out_streams, Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Spir_GSS6450_File_Signal_Source"s)
|
||||
, in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("../data/my_capture.dat");
|
||||
const std::string default_dump_filename("../data/my_capture_dump.dat");
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef GNSS_SDR_SPIR_GSS6450_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_SPIR_GSS6450_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
@ -51,23 +51,12 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from a file
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class SpirGSS6450FileSignalSource : public SignalSourceInterface
|
||||
class SpirGSS6450FileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
SpirGSS6450FileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
||||
uint32_t in_streams, uint32_t out_streams, Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Spir_GSS6450_File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -115,7 +104,6 @@ private:
|
||||
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
|
||||
std::string filename_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
std::string item_type_;
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
|
@ -26,15 +26,16 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Two_Bit_Cpx_File_Signal_Source"s), in_streams_(in_streams), out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("../data/my_capture.dat");
|
||||
const std::string default_item_type("byte");
|
||||
|
@ -20,7 +20,7 @@
|
||||
#ifndef GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "unpack_byte_2bit_cpx_samples.h"
|
||||
@ -45,10 +45,9 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from a file
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class TwoBitCpxFileSignalSource : public SignalSourceInterface
|
||||
class TwoBitCpxFileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
TwoBitCpxFileSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
@ -56,18 +55,6 @@ public:
|
||||
Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~TwoBitCpxFileSignalSource() = default;
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Two_Bit_Cpx_File_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Two_Bit_Cpx_File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
@ -114,7 +101,6 @@ private:
|
||||
std::string filename_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
size_t item_size_;
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
|
@ -28,15 +28,17 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(
|
||||
const ConfigurationInterface* configuration,
|
||||
const std::string& role,
|
||||
unsigned int in_streams,
|
||||
unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
|
||||
in_streams_(in_streams),
|
||||
out_streams_(out_streams)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "Two_Bit_Packed_File_Signal_Source"s)
|
||||
, in_streams_(in_streams)
|
||||
, out_streams_(out_streams)
|
||||
{
|
||||
const std::string default_filename("../data/my_capture.dat");
|
||||
const std::string default_item_type("byte");
|
||||
|
@ -21,7 +21,7 @@
|
||||
#ifndef GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include "unpack_2bit_samples.h"
|
||||
@ -47,27 +47,14 @@ class ConfigurationInterface;
|
||||
* \brief Class that reads signals samples from a file
|
||||
* and adapts it to a SignalSourceInterface
|
||||
*/
|
||||
class TwoBitPackedFileSignalSource : public SignalSourceInterface
|
||||
class TwoBitPackedFileSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
void fixme() final {}
|
||||
TwoBitPackedFileSignalSource(const ConfigurationInterface* configuration, const std::string& role,
|
||||
unsigned int in_streams, unsigned int out_streams,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue);
|
||||
|
||||
~TwoBitPackedFileSignalSource() = default;
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "Two_Bit_Packed_File_Signal_Source".
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "Two_Bit_Packed_File_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
@ -134,7 +121,6 @@ private:
|
||||
std::string filename_;
|
||||
std::string item_type_;
|
||||
std::string dump_filename_;
|
||||
std::string role_;
|
||||
std::string sample_type_;
|
||||
uint64_t samples_;
|
||||
int64_t sampling_frequency_;
|
||||
|
@ -25,10 +25,13 @@
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
|
||||
using namespace std::string_literals;
|
||||
|
||||
|
||||
UhdSignalSource::UhdSignalSource(const ConfigurationInterface* configuration,
|
||||
const std::string& role, unsigned int in_stream, unsigned int out_stream,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
|
||||
Concurrent_Queue<pmt::pmt_t>* queue)
|
||||
: SignalSourceBase(configuration, role, "UHD_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream)
|
||||
{
|
||||
// DUMP PARAMETERS
|
||||
const std::string empty;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef GNSS_SDR_UHD_SIGNAL_SOURCE_H
|
||||
#define GNSS_SDR_UHD_SIGNAL_SOURCE_H
|
||||
|
||||
#include "signal_source_interface.h"
|
||||
#include "signal_source_base.h"
|
||||
|
||||
#include "concurrent_queue.h"
|
||||
#include <gnuradio/blocks/file_sink.h>
|
||||
@ -39,7 +39,7 @@ class ConfigurationInterface;
|
||||
/*!
|
||||
* \brief This class reads samples from a UHD device (see http://code.ettus.com/redmine/ettus/projects/uhd/wiki)
|
||||
*/
|
||||
class UhdSignalSource : public SignalSourceInterface
|
||||
class UhdSignalSource : public SignalSourceBase
|
||||
{
|
||||
public:
|
||||
UhdSignalSource(const ConfigurationInterface* configuration,
|
||||
@ -48,19 +48,6 @@ public:
|
||||
|
||||
~UhdSignalSource() = default;
|
||||
|
||||
inline std::string role() override
|
||||
{
|
||||
return role_;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns "UHD_Signal_Source"
|
||||
*/
|
||||
inline std::string implementation() override
|
||||
{
|
||||
return "UHD_Signal_Source";
|
||||
}
|
||||
|
||||
inline size_t item_size() override
|
||||
{
|
||||
return item_size_;
|
||||
@ -90,7 +77,6 @@ private:
|
||||
std::string item_type_;
|
||||
std::string subdevice_;
|
||||
std::string clock_source_;
|
||||
std::string role_;
|
||||
|
||||
double sample_rate_;
|
||||
size_t item_size_;
|
||||
|
@ -42,18 +42,19 @@
|
||||
* implemented by that class or a parent class.
|
||||
*/
|
||||
|
||||
#include <glog/logging.h>
|
||||
class SignalSourceInterface : public GNSSBlockInterface
|
||||
{
|
||||
virtual std::string role() = 0;
|
||||
virtual std::string implementation() = 0;
|
||||
virtual size_t item_size() = 0;
|
||||
virtual void connect(gr::top_block_sptr top_block) = 0;
|
||||
virtual void disconnect(gr::top_block_sptr top_block) = 0;
|
||||
|
||||
virtual gr::basic_block_sptr get_left_block() = 0;
|
||||
virtual gr::basic_block_sptr get_right_block() = 0;
|
||||
|
||||
virtual void fixme() = 0;
|
||||
public:
|
||||
virtual size_t getRfChannels() const = 0;
|
||||
protected:
|
||||
SignalSourceInterface() {
|
||||
VLOG(1) << "SignalSourceInterface: " << this << " ctor";
|
||||
}
|
||||
public: // required for polymorphic destruction
|
||||
~SignalSourceInterface() {
|
||||
VLOG(1) << "SignalSourceInterface: " << this << " dtor";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -38,6 +38,7 @@
|
||||
|
||||
class ConfigurationInterface;
|
||||
class GNSSBlockInterface;
|
||||
class SignalSourceInterface;
|
||||
class AcquisitionInterface;
|
||||
class TrackingInterface;
|
||||
class TelemetryDecoderInterface;
|
||||
@ -51,7 +52,7 @@ public:
|
||||
GNSSBlockFactory() = default;
|
||||
~GNSSBlockFactory() = default;
|
||||
|
||||
std::unique_ptr<GNSSBlockInterface> GetSignalSource(const ConfigurationInterface* configuration,
|
||||
std::unique_ptr<SignalSourceInterface> GetSignalSource(const ConfigurationInterface* configuration,
|
||||
Concurrent_Queue<pmt::pmt_t>* queue, int ID = -1);
|
||||
|
||||
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(const ConfigurationInterface* configuration, int ID = -1);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gnss_satellite.h"
|
||||
#include "gnss_sdr_make_unique.h"
|
||||
#include "gnss_synchro_monitor.h"
|
||||
#include "signal_source_interface.h"
|
||||
#include <boost/lexical_cast.hpp> // for boost::lexical_cast
|
||||
#include <boost/tokenizer.hpp> // for boost::tokenizer
|
||||
#include <glog/logging.h> // for LOG
|
||||
@ -100,50 +101,19 @@ void GNSSFlowgraph::init()
|
||||
// 1. read the number of RF front-ends available (one file_source per RF front-end)
|
||||
sources_count_ = configuration_->property("Receiver.sources_count", 1);
|
||||
|
||||
int RF_Channels = 0;
|
||||
int signal_conditioner_ID = 0;
|
||||
|
||||
if (sources_count_ > 1)
|
||||
for (int i = 0; i < sources_count_; i++)
|
||||
{
|
||||
for (int i = 0; i < sources_count_; i++)
|
||||
std::cout << "Creating source " << i << '\n';
|
||||
sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i));
|
||||
auto& src = sig_source_.back();
|
||||
auto RF_Channels = src->getRfChannels();
|
||||
std::cout << "RF Channels " << RF_Channels << '\n';
|
||||
for (int j = 0; j < RF_Channels; j++)
|
||||
{
|
||||
std::cout << "Creating source " << i << '\n';
|
||||
sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i));
|
||||
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
||||
// Include GetRFChannels in the interface to avoid read config parameters here
|
||||
// read the number of RF channels for each front-end
|
||||
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
||||
std::cout << "RF Channels " << RF_Channels << '\n';
|
||||
for (int j = 0; j < RF_Channels; j++)
|
||||
{
|
||||
sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
|
||||
signal_conditioner_ID++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// backwards compatibility for old config files
|
||||
sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), -1));
|
||||
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
||||
// Include GetRFChannels in the interface to avoid read config parameters here
|
||||
// read the number of RF channels for each front-end
|
||||
if (sig_source_.at(0) != nullptr)
|
||||
{
|
||||
RF_Channels = configuration_->property(sig_source_.at(0)->role() + ".RF_channels", 0);
|
||||
}
|
||||
if (RF_Channels != 0)
|
||||
{
|
||||
for (int j = 0; j < RF_Channels; j++)
|
||||
{
|
||||
sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
|
||||
signal_conditioner_ID++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// old config file, single signal source and single channel, not specified
|
||||
sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), -1));
|
||||
sig_conditioner_.push_back(block_factory->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
|
||||
signal_conditioner_ID++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1028,42 +998,40 @@ int GNSSFlowgraph::disconnect_fpga_sample_counter()
|
||||
|
||||
int GNSSFlowgraph::connect_signal_sources_to_signal_conditioners()
|
||||
{
|
||||
int RF_Channels = 0;
|
||||
unsigned int signal_conditioner_ID = 0;
|
||||
for (int i = 0; i < sources_count_; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto& src = sig_source_.at(i);
|
||||
|
||||
// TODO: Remove this array implementation and create generic multistream connector
|
||||
// (if a signal source has more than 1 stream, then connect it to the multistream signal conditioner)
|
||||
if (sig_source_.at(i)->implementation() == "Raw_Array_Signal_Source")
|
||||
if (src->implementation() == "Raw_Array_Signal_Source")
|
||||
{
|
||||
// Multichannel Array
|
||||
std::cout << "ARRAY MODE\n";
|
||||
for (int j = 0; j < GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS; j++)
|
||||
{
|
||||
std::cout << "connecting ch " << j << '\n';
|
||||
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
||||
top_block_->connect(src->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
||||
// Include GetRFChannels in the interface to avoid read config parameters here
|
||||
// read the number of RF channels for each front-end
|
||||
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
||||
auto RF_Channels = src->getRfChannels();
|
||||
|
||||
for (int j = 0; j < RF_Channels; j++)
|
||||
{
|
||||
// Connect the multichannel signal source to multiple signal conditioners
|
||||
// GNURADIO max_streams=-1 means infinite ports!
|
||||
size_t output_size = sig_source_.at(i)->item_size();
|
||||
size_t output_size = src->item_size();
|
||||
size_t input_size = sig_conditioner_.at(signal_conditioner_ID)->get_left_block()->input_signature()->sizeof_stream_item(0);
|
||||
// Check configuration inconsistencies
|
||||
if (output_size != input_size)
|
||||
{
|
||||
help_hint_ += " * The Signal Source implementation " + sig_source_.at(i)->implementation() + " has an output with a ";
|
||||
help_hint_ += sig_source_.at(i)->role() + ".item_size of " + std::to_string(output_size);
|
||||
help_hint_ += " * The Signal Source implementation " + src->implementation() + " has an output with a ";
|
||||
help_hint_ += src->role() + ".item_size of " + std::to_string(output_size);
|
||||
help_hint_ += " bytes, but it is connected to the Signal Conditioner implementation ";
|
||||
help_hint_ += sig_conditioner_.at(signal_conditioner_ID)->implementation() + " with input item size of " + std::to_string(input_size) + " bytes.\n";
|
||||
help_hint_ += " Output ports must be connected to input ports with the same item size.\n";
|
||||
@ -1071,12 +1039,12 @@ int GNSSFlowgraph::connect_signal_sources_to_signal_conditioners()
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sig_source_.at(i)->get_right_block()->output_signature()->max_streams() > 1 or sig_source_.at(i)->get_right_block()->output_signature()->max_streams() == -1)
|
||||
if (src->get_right_block()->output_signature()->max_streams() > 1 or src->get_right_block()->output_signature()->max_streams() == -1)
|
||||
{
|
||||
if (sig_conditioner_.size() > signal_conditioner_ID)
|
||||
{
|
||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
||||
top_block_->connect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << signal_conditioner_ID;
|
||||
top_block_->connect(src->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1084,14 +1052,14 @@ int GNSSFlowgraph::connect_signal_sources_to_signal_conditioners()
|
||||
if (j == 0)
|
||||
{
|
||||
// RF_channel 0 backward compatibility with single channel sources
|
||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << 0 << " to conditioner " << j;
|
||||
top_block_->connect(sig_source_.at(i)->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << 0 << " to conditioner " << signal_conditioner_ID;
|
||||
top_block_->connect(src->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Multiple channel sources using multiple output blocks of single channel (requires RF_channel selector in call)
|
||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << j;
|
||||
top_block_->connect(sig_source_.at(i)->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
LOG(INFO) << "connecting sig_source_ " << i << " stream " << j << " to conditioner " << signal_conditioner_ID;
|
||||
top_block_->connect(src->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
}
|
||||
}
|
||||
signal_conditioner_ID++;
|
||||
@ -1127,46 +1095,44 @@ int GNSSFlowgraph::connect_signal_sources_to_signal_conditioners()
|
||||
|
||||
int GNSSFlowgraph::disconnect_signal_sources_from_signal_conditioners()
|
||||
{
|
||||
int RF_Channels = 0;
|
||||
int signal_conditioner_ID = 0;
|
||||
for (int i = 0; i < sources_count_; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto& src = sig_source_.at(i);
|
||||
|
||||
// TODO: Remove this array implementation and create generic multistream connector
|
||||
// (if a signal source has more than 1 stream, then connect it to the multistream signal conditioner)
|
||||
if (sig_source_.at(i)->implementation() == "Raw_Array_Signal_Source")
|
||||
if (src->implementation() == "Raw_Array_Signal_Source")
|
||||
{
|
||||
// Multichannel Array
|
||||
for (int j = 0; j < GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS; j++)
|
||||
{
|
||||
top_block_->disconnect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
||||
top_block_->disconnect(src->get_right_block(), j, sig_conditioner_.at(i)->get_left_block(), j);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
|
||||
// Include GetRFChannels in the interface to avoid read config parameters here
|
||||
// read the number of RF channels for each front-end
|
||||
RF_Channels = configuration_->property(sig_source_.at(i)->role() + ".RF_channels", 1);
|
||||
auto RF_Channels = src->getRfChannels();
|
||||
|
||||
for (int j = 0; j < RF_Channels; j++)
|
||||
{
|
||||
if (sig_source_.at(i)->get_right_block()->output_signature()->max_streams() > 1 or sig_source_.at(i)->get_right_block()->output_signature()->max_streams() == -1)
|
||||
if (src->get_right_block()->output_signature()->max_streams() > 1 or src->get_right_block()->output_signature()->max_streams() == -1)
|
||||
{
|
||||
top_block_->disconnect(sig_source_.at(i)->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
top_block_->disconnect(src->get_right_block(), j, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (j == 0)
|
||||
{
|
||||
// RF_channel 0 backward compatibility with single channel sources
|
||||
top_block_->disconnect(sig_source_.at(i)->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
top_block_->disconnect(src->get_right_block(), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Multiple channel sources using multiple output blocks of single channel (requires RF_channel selector in call)
|
||||
top_block_->disconnect(sig_source_.at(i)->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
top_block_->disconnect(src->get_right_block(j), 0, sig_conditioner_.at(signal_conditioner_ID)->get_left_block(), 0);
|
||||
}
|
||||
}
|
||||
signal_conditioner_ID++;
|
||||
|
@ -53,6 +53,7 @@ class ChannelInterface;
|
||||
class ConfigurationInterface;
|
||||
class GNSSBlockInterface;
|
||||
class Gnss_Satellite;
|
||||
class SignalSourceInterface;
|
||||
|
||||
/*! \brief This class represents a GNSS flow graph.
|
||||
*
|
||||
@ -230,7 +231,7 @@ private:
|
||||
std::shared_ptr<ConfigurationInterface> configuration_;
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
|
||||
|
||||
std::vector<std::shared_ptr<GNSSBlockInterface>> sig_source_;
|
||||
std::vector<std::shared_ptr<SignalSourceInterface>> sig_source_;
|
||||
std::vector<std::shared_ptr<GNSSBlockInterface>> sig_conditioner_;
|
||||
std::vector<std::shared_ptr<ChannelInterface>> channels_;
|
||||
std::shared_ptr<GNSSBlockInterface> observables_;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "concurrent_queue.h"
|
||||
#include "gnss_block_factory.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "signal_source_interface.h"
|
||||
#include "gnss_sdr_make_unique.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "observables_interface.h"
|
||||
@ -45,7 +46,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource)
|
||||
// Example of a factory as a shared_ptr
|
||||
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
|
||||
// Example of a block as a shared_ptr
|
||||
std::shared_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
auto signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
EXPECT_STREQ("SignalSource", signal_source->role().c_str());
|
||||
EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str());
|
||||
}
|
||||
@ -59,7 +60,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongSignalSource)
|
||||
// Example of a factory as a unique_ptr
|
||||
std::unique_ptr<GNSSBlockFactory> factory = std::make_unique<GNSSBlockFactory>();
|
||||
// Example of a block as a unique_ptr
|
||||
std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
auto signal_source = factory->GetSignalSource(configuration.get(), queue.get());
|
||||
EXPECT_EQ(nullptr, signal_source);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@
|
||||
#include "gps_iono.h"
|
||||
#include "gps_l1_ca_pcps_acquisition_fine_doppler.h"
|
||||
#include "gps_utc_model.h"
|
||||
#include <boost/any.hpp> // for bad_any_cast
|
||||
#include "signal_source_interface.h" // for SignalSourceInterface
|
||||
#include <boost/any.hpp> // for bad_any_cast
|
||||
#include <boost/exception/exception.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <gflags/gflags.h>
|
||||
@ -181,6 +182,10 @@ void wait_message()
|
||||
|
||||
bool front_end_capture(const std::shared_ptr<ConfigurationInterface>& configuration)
|
||||
{
|
||||
auto success = false;
|
||||
|
||||
std::string trace_step;
|
||||
|
||||
gr::top_block_sptr top_block;
|
||||
GNSSBlockFactory block_factory;
|
||||
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
|
||||
@ -188,43 +193,37 @@ bool front_end_capture(const std::shared_ptr<ConfigurationInterface>& configurat
|
||||
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> source;
|
||||
try
|
||||
{
|
||||
// Note: the block_factory returns a unique_ptr (what you would get with an "auto"
|
||||
// declaration), but the flowgraph uses shared_ptr. Without further understanding of why
|
||||
// it should matter in this context, used shared_ptr throughout
|
||||
std::shared_ptr<SignalSourceInterface> source;
|
||||
std::shared_ptr<GNSSBlockInterface> conditioner;
|
||||
|
||||
trace_step = "creating source";
|
||||
source = block_factory.GetSignalSource(configuration.get(), queue.get());
|
||||
}
|
||||
catch (const boost::exception_ptr& e)
|
||||
{
|
||||
std::cout << "Exception caught in creating source " << e << '\n';
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<GNSSBlockInterface> conditioner;
|
||||
try
|
||||
{
|
||||
trace_step = "creating signal conditioner";
|
||||
conditioner = block_factory.GetSignalConditioner(configuration.get());
|
||||
}
|
||||
catch (const boost::exception_ptr& e)
|
||||
{
|
||||
std::cout << "Exception caught in creating signal conditioner " << e << '\n';
|
||||
return false;
|
||||
}
|
||||
gr::block_sptr sink;
|
||||
sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat");
|
||||
|
||||
// -- Find number of samples per spreading code ---
|
||||
int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000);
|
||||
int samples_per_code = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
int nsamples = samples_per_code * 50;
|
||||
trace_step = "unexpected in setup code";
|
||||
|
||||
int skip_samples = fs_in_ * 5; // skip 5 seconds
|
||||
gr::block_sptr sink;
|
||||
sink = gr::blocks::file_sink::make(sizeof(gr_complex), "tmp_capture.dat");
|
||||
|
||||
gr::block_sptr head = gr::blocks::head::make(sizeof(gr_complex), nsamples);
|
||||
// -- Find number of samples per spreading code ---
|
||||
int64_t fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", 2048000);
|
||||
int samples_per_code = round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS));
|
||||
int nsamples = samples_per_code * 50;
|
||||
|
||||
gr::block_sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), skip_samples);
|
||||
int skip_samples = fs_in_ * 5; // skip 5 seconds
|
||||
|
||||
try
|
||||
{
|
||||
gr::block_sptr head = gr::blocks::head::make(sizeof(gr_complex), nsamples);
|
||||
|
||||
gr::block_sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), skip_samples);
|
||||
|
||||
trace_step = "connecting the GNU Radio blocks";
|
||||
source->connect(top_block);
|
||||
conditioner->connect(top_block);
|
||||
top_block->connect(source->get_right_block(), 0, conditioner->get_left_block(), 0);
|
||||
@ -232,14 +231,15 @@ bool front_end_capture(const std::shared_ptr<ConfigurationInterface>& configurat
|
||||
top_block->connect(skiphead, 0, head, 0);
|
||||
top_block->connect(head, 0, sink, 0);
|
||||
top_block->run();
|
||||
|
||||
success = true;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
std::cout << "Failure connecting the GNU Radio blocks " << e.what() << '\n';
|
||||
return false;
|
||||
std::cout << "Exception caught " << trace_step << ": " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user