1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-12 13:23:09 +00:00

Redesign of pointer management

Avoid indirection caused by passing shared_ptr by reference

The block factory does not have responsability on the lifetime of their inputs

Define std::make_unique when using C++11 and make use of it

Printers are turned into unique_ptr to express ownership

Printers do not participate on the lifelime of the data, so they take const raw pointers

Modernize tests code
This commit is contained in:
Carles Fernandez
2020-06-18 11:49:28 +02:00
parent 7307e82d48
commit 81af1a531b
135 changed files with 1295 additions and 1302 deletions

View File

@@ -35,6 +35,7 @@
#include "glonass_gnav_utc_model.h"
#include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gps_almanac.h"
#include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h"
@@ -137,13 +138,11 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
mapStringValues_["B2"] = evBDS_B2;
mapStringValues_["B3"] = evBDS_B3;
initial_carrier_phase_offset_estimation_rads = std::vector<double>(nchannels, 0.0);
channel_initialized = std::vector<bool>(nchannels, false);
max_obs_block_rx_clock_offset_ms = conf_.max_obs_block_rx_clock_offset_ms;
d_output_rate_ms = conf_.output_rate_ms;
d_display_rate_ms = conf_.display_rate_ms;
d_report_rate_ms = 1000; // report every second PVT to gnss_synchro
@@ -211,7 +210,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
}
if (d_kml_output_enabled)
{
d_kml_dump = std::make_shared<Kml_Printer>(conf_.kml_output_path);
d_kml_dump = std::make_unique<Kml_Printer>(conf_.kml_output_path);
d_kml_dump->set_headers(kml_dump_filename);
}
else
@@ -230,7 +229,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
}
if (d_gpx_output_enabled)
{
d_gpx_dump = std::make_shared<Gpx_Printer>(conf_.gpx_output_path);
d_gpx_dump = std::make_unique<Gpx_Printer>(conf_.gpx_output_path);
d_gpx_dump->set_headers(gpx_dump_filename);
}
else
@@ -249,7 +248,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
}
if (d_geojson_output_enabled)
{
d_geojson_printer = std::make_shared<GeoJSON_Printer>(conf_.geojson_output_path);
d_geojson_printer = std::make_unique<GeoJSON_Printer>(conf_.geojson_output_path);
d_geojson_printer->set_headers(geojson_dump_filename);
}
else
@@ -267,7 +266,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
if (d_nmea_output_file_enabled)
{
d_nmea_printer = std::make_shared<Nmea_Printer>(conf_.nmea_dump_filename, conf_.nmea_output_file_enabled, conf_.flag_nmea_tty_port, conf_.nmea_dump_devname, conf_.nmea_output_file_path);
d_nmea_printer = std::make_unique<Nmea_Printer>(conf_.nmea_dump_filename, conf_.nmea_output_file_enabled, conf_.flag_nmea_tty_port, conf_.nmea_dump_devname, conf_.nmea_output_file_path);
}
else
{
@@ -279,7 +278,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
rtcm_dump_filename = d_dump_filename;
if (conf_.flag_rtcm_server or conf_.flag_rtcm_tty_port or conf_.rtcm_output_file_enabled)
{
d_rtcm_printer = std::make_shared<Rtcm_Printer>(rtcm_dump_filename, conf_.rtcm_output_file_enabled, conf_.flag_rtcm_server, conf_.flag_rtcm_tty_port, conf_.rtcm_tcp_port, conf_.rtcm_station_id, conf_.rtcm_dump_devname, true, conf_.rtcm_output_file_path);
d_rtcm_printer = std::make_unique<Rtcm_Printer>(rtcm_dump_filename, conf_.rtcm_output_file_enabled, conf_.flag_rtcm_server, conf_.flag_rtcm_tty_port, conf_.rtcm_tcp_port, conf_.rtcm_station_id, conf_.rtcm_dump_devname, true, conf_.rtcm_output_file_path);
std::map<int, int> rtcm_msg_rate_ms = conf_.rtcm_msg_rate_ms;
if (rtcm_msg_rate_ms.find(1019) != rtcm_msg_rate_ms.end())
{
@@ -355,7 +354,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
d_rinex_version = conf_.rinex_version;
if (b_rinex_output_enabled)
{
rp = std::make_shared<Rinex_Printer>(d_rinex_version, conf_.rinex_output_path, conf_.rinex_name);
rp = std::make_unique<Rinex_Printer>(d_rinex_version, conf_.rinex_output_path, conf_.rinex_name);
rp->set_pre_2009_file(conf_.pre_2009_file);
}
else
@@ -413,7 +412,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
std::sort(udp_addr_vec.begin(), udp_addr_vec.end());
udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end());
udp_sink_ptr = std::unique_ptr<Monitor_Pvt_Udp_Sink>(new Monitor_Pvt_Udp_Sink(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled));
udp_sink_ptr = std::make_unique<Monitor_Pvt_Udp_Sink>(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled);
}
else
{
@@ -2283,28 +2282,28 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
if (current_RX_time_ms % d_kml_rate_ms == 0)
{
d_kml_dump->print_position(d_user_pvt_solver, false);
d_kml_dump->print_position(d_user_pvt_solver.get(), false);
}
}
if (d_gpx_output_enabled)
{
if (current_RX_time_ms % d_gpx_rate_ms == 0)
{
d_gpx_dump->print_position(d_user_pvt_solver, false);
d_gpx_dump->print_position(d_user_pvt_solver.get(), false);
}
}
if (d_geojson_output_enabled)
{
if (current_RX_time_ms % d_geojson_rate_ms == 0)
{
d_geojson_printer->print_position(d_user_pvt_solver, false);
d_geojson_printer->print_position(d_user_pvt_solver.get(), false);
}
}
if (d_nmea_output_file_enabled)
{
if (current_RX_time_ms % d_nmea_rate_ms == 0)
{
d_nmea_printer->Print_Nmea_Line(d_user_pvt_solver, false);
d_nmea_printer->Print_Nmea_Line(d_user_pvt_solver.get(), false);
}
}

View File

@@ -191,12 +191,12 @@ private:
int32_t d_display_rate_ms;
int32_t d_report_rate_ms;
std::shared_ptr<Rinex_Printer> rp;
std::shared_ptr<Kml_Printer> d_kml_dump;
std::shared_ptr<Gpx_Printer> d_gpx_dump;
std::shared_ptr<Nmea_Printer> d_nmea_printer;
std::shared_ptr<GeoJSON_Printer> d_geojson_printer;
std::shared_ptr<Rtcm_Printer> d_rtcm_printer;
std::unique_ptr<Rinex_Printer> rp;
std::unique_ptr<Kml_Printer> d_kml_dump;
std::unique_ptr<Gpx_Printer> d_gpx_dump;
std::unique_ptr<Nmea_Printer> d_nmea_printer;
std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
double d_rx_time;
bool d_geojson_output_enabled;

View File

@@ -176,25 +176,23 @@ bool GeoJSON_Printer::set_headers(const std::string& filename, bool time_tag_nam
}
bool GeoJSON_Printer::print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values)
bool GeoJSON_Printer::print_position(const Pvt_Solution* position, bool print_average_values)
{
double latitude;
double longitude;
double height;
const std::shared_ptr<Pvt_Solution>& position_ = position;
if (print_average_values == false)
{
latitude = position_->get_latitude();
longitude = position_->get_longitude();
height = position_->get_height();
latitude = position->get_latitude();
longitude = position->get_longitude();
height = position->get_height();
}
else
{
latitude = position_->get_avg_latitude();
longitude = position_->get_avg_longitude();
height = position_->get_avg_height();
latitude = position->get_avg_latitude();
longitude = position->get_avg_longitude();
height = position->get_avg_height();
}
if (geojson_file.is_open())

View File

@@ -40,7 +40,7 @@ public:
explicit GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Pvt_Solution>& position, bool print_average_values);
bool print_position(const Pvt_Solution* position, bool print_average_values);
bool close_file();
private:

View File

@@ -20,7 +20,7 @@
#include "gpx_printer.h"
#include "rtklib_solver.h"
#include "pvt_solution.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <ctime> // for tm
@@ -162,22 +162,21 @@ bool Gpx_Printer::set_headers(const std::string& filename, bool time_tag_name)
}
bool Gpx_Printer::print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values)
bool Gpx_Printer::print_position(const Pvt_Solution* position, bool print_average_values)
{
double latitude;
double longitude;
double height;
positions_printed = true;
const std::shared_ptr<Rtklib_Solver>& position_ = position;
double speed_over_ground = position_->get_speed_over_ground(); // expressed in m/s
double course_over_ground = position_->get_course_over_ground(); // expressed in deg
double speed_over_ground = position->get_speed_over_ground(); // expressed in m/s
double course_over_ground = position->get_course_over_ground(); // expressed in deg
double hdop = position_->get_hdop();
double vdop = position_->get_vdop();
double pdop = position_->get_pdop();
std::string utc_time = to_iso_extended_string(position_->get_position_UTC_time());
double hdop = position->get_hdop();
double vdop = position->get_vdop();
double pdop = position->get_pdop();
std::string utc_time = to_iso_extended_string(position->get_position_UTC_time());
if (utc_time.length() < 23)
{
utc_time += ".";
@@ -187,15 +186,15 @@ bool Gpx_Printer::print_position(const std::shared_ptr<Rtklib_Solver>& position,
if (print_average_values == false)
{
latitude = position_->get_latitude();
longitude = position_->get_longitude();
height = position_->get_height();
latitude = position->get_latitude();
longitude = position->get_longitude();
height = position->get_height();
}
else
{
latitude = position_->get_avg_latitude();
longitude = position_->get_avg_longitude();
height = position_->get_avg_height();
latitude = position->get_avg_latitude();
longitude = position->get_avg_longitude();
height = position->get_avg_height();
}
if (gpx_file.is_open())

View File

@@ -27,7 +27,7 @@
#include <memory>
#include <string>
class Rtklib_Solver;
class Pvt_Solution;
/*!
* \brief Prints PVT information to GPX format file
@@ -40,7 +40,7 @@ public:
explicit Gpx_Printer(const std::string& base_path = ".");
~Gpx_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool print_position(const Pvt_Solution* position, bool print_average_values);
bool close_file();
private:

View File

@@ -20,7 +20,7 @@
*/
#include "kml_printer.h"
#include "rtklib_solver.h"
#include "pvt_solution.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h>
#include <cstdlib> // for mkstemp
@@ -231,7 +231,7 @@ bool Kml_Printer::set_headers(const std::string& filename, bool time_tag_name)
}
bool Kml_Printer::print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values)
bool Kml_Printer::print_position(const Pvt_Solution* position, bool print_average_values)
{
double latitude;
double longitude;
@@ -239,15 +239,13 @@ bool Kml_Printer::print_position(const std::shared_ptr<Rtklib_Solver>& position,
positions_printed = true;
const std::shared_ptr<Rtklib_Solver>& position_ = position;
double speed_over_ground = position->get_speed_over_ground(); // expressed in m/s
double course_over_ground = position->get_course_over_ground(); // expressed in deg
double speed_over_ground = position_->get_speed_over_ground(); // expressed in m/s
double course_over_ground = position_->get_course_over_ground(); // expressed in deg
double hdop = position_->get_hdop();
double vdop = position_->get_vdop();
double pdop = position_->get_pdop();
std::string utc_time = to_iso_extended_string(position_->get_position_UTC_time());
double hdop = position->get_hdop();
double vdop = position->get_vdop();
double pdop = position->get_pdop();
std::string utc_time = to_iso_extended_string(position->get_position_UTC_time());
if (utc_time.length() < 23)
{
utc_time += ".";
@@ -257,15 +255,15 @@ bool Kml_Printer::print_position(const std::shared_ptr<Rtklib_Solver>& position,
if (print_average_values == false)
{
latitude = position_->get_latitude();
longitude = position_->get_longitude();
height = position_->get_height();
latitude = position->get_latitude();
longitude = position->get_longitude();
height = position->get_height();
}
else
{
latitude = position_->get_avg_latitude();
longitude = position_->get_avg_longitude();
height = position_->get_avg_height();
latitude = position->get_avg_latitude();
longitude = position->get_avg_longitude();
height = position->get_avg_height();
}
if (kml_file.is_open() && tmp_file.is_open())

View File

@@ -26,7 +26,7 @@
#include <memory> // for shared_ptr
#include <string>
class Rtklib_Solver;
class Pvt_Solution;
/*!
* \brief Prints PVT information to OGC KML format file (can be viewed with Google Earth)
@@ -39,7 +39,7 @@ public:
explicit Kml_Printer(const std::string& base_path = std::string("."));
~Kml_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true);
bool print_position(const std::shared_ptr<Rtklib_Solver>& position, bool print_average_values);
bool print_position(const Pvt_Solution* position, bool print_average_values);
bool close_file();
private:

View File

@@ -22,6 +22,7 @@
#include <boost/archive/binary_oarchive.hpp>
#include <iostream>
#include <sstream>
#include <utility>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
@@ -40,19 +41,20 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addre
}
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const std::shared_ptr<Monitor_Pvt>& monitor_pvt)
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt)
{
monitor_pvt_ = std::move(monitor_pvt);
std::string outbound_data;
if (use_protobuf == false)
{
std::ostringstream archive_stream;
boost::archive::binary_oarchive oa{archive_stream};
oa << *monitor_pvt.get();
oa << *monitor_pvt_.get();
outbound_data = archive_stream.str();
}
else
{
outbound_data = serdes.createProtobuffer(monitor_pvt);
outbound_data = serdes.createProtobuffer(monitor_pvt_);
}
for (const auto& endpoint : endpoints)

View File

@@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink
{
public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
bool write_monitor_pvt(const std::shared_ptr<Monitor_Pvt>& monitor_pvt);
bool write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt);
private:
b_io_context io_context;
@@ -46,6 +46,7 @@ private:
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
Serdes_Monitor_Pvt serdes;
std::shared_ptr<Monitor_Pvt> monitor_pvt_;
bool use_protobuf;
};

View File

@@ -119,6 +119,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
nmea_dev_descriptor = -1;
}
print_avg_pos = false;
d_PVT_data = nullptr;
}
@@ -213,7 +214,7 @@ void Nmea_Printer::close_serial()
}
bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr<Rtklib_Solver>& pvt_data, bool print_average_values)
bool Nmea_Printer::Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values)
{
std::string GPRMC;
std::string GPGGA;

View File

@@ -49,7 +49,7 @@ public:
/*!
* \brief Print NMEA PVT and satellite info to the initialized device
*/
bool Print_Nmea_Line(const std::shared_ptr<Rtklib_Solver>& pvt_data, bool print_average_values);
bool Print_Nmea_Line(const Rtklib_Solver* pvt_data, bool print_average_values);
/*!
* \brief Default destructor.
@@ -62,7 +62,7 @@ private:
std::ofstream nmea_file_descriptor; // Output file stream for NMEA log file
std::string nmea_devname;
int nmea_dev_descriptor; // NMEA serial device descriptor (i.e. COM port)
std::shared_ptr<Rtklib_Solver> d_PVT_data;
const Rtklib_Solver* d_PVT_data;
int init_serial(const std::string& serial_device); // serial port control
void close_serial();
std::string get_GPGGA(); // fix data

View File

@@ -38,6 +38,7 @@ class Pvt_Solution
{
public:
Pvt_Solution();
virtual ~Pvt_Solution() = default;
void set_pre_2009_file(bool pre_2009_file); //!< Flag for the week rollover computation in post processing mode for signals older than 2009
double get_time_offset_s() const; //!< Get RX time offset [s]
void set_time_offset_s(double offset); //!< Set RX time offset [s]
@@ -123,6 +124,11 @@ public:
*/
int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
virtual double get_hdop() const = 0;
virtual double get_vdop() const = 0;
virtual double get_pdop() const = 0;
virtual double get_gdop() const = 0;
protected:
bool d_pre_2009_file; // Flag to correct week rollover in post processing mode for signals older than 2009
private:

View File

@@ -75,10 +75,10 @@ public:
sol_t pvt_sol{};
std::array<ssat_t, MAXSAT> pvt_ssat{};
double get_hdop() const;
double get_vdop() const;
double get_pdop() const;
double get_gdop() const;
double get_hdop() const override;
double get_vdop() const override;
double get_pdop() const override;
double get_gdop() const override;
Monitor_Pvt get_monitor_pvt() const;
std::map<int, Galileo_Ephemeris> galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris

View File

@@ -118,6 +118,7 @@ endif()
if(ENABLE_FPGA)
target_link_libraries(acquisition_adapters
PRIVATE
algorithms_libs
Gnuradio::fft
Volk::volk
Volkgnsssdr::volkgnsssdr

View File

@@ -23,6 +23,7 @@
#include "configuration_interface.h"
#include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
@@ -87,8 +88,8 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
// compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
volk_gnsssdr::vector<gr_complex> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@@ -23,6 +23,7 @@
#include "configuration_interface.h"
#include "galileo_e5_signal_processing.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_complex
@@ -88,7 +89,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
// compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32

View File

@@ -25,6 +25,7 @@
#include "GPS_L1_CA.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gps_sdr_signal_processing.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h>
@@ -80,7 +81,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true));
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true);
// allocate memory to compute all the PRNs and compute all the possible codes
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@@ -24,6 +24,7 @@
#include "GPS_L2C.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h"
#include "gps_l2c_signal.h"
#include <glog/logging.h>
@@ -81,7 +82,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
// compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
// allocate memory to compute all the PRNs and compute all the possible codes
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@@ -25,6 +25,7 @@
#include "GPS_L5.h"
#include "configuration_interface.h"
#include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gps_l5_signal.h"
#include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex
@@ -85,7 +86,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
// compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
// a channel is assigned)
auto fft_if = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(nsamples_total, true)); // Direct FFT
auto fft_if = std::make_unique<gr::fft::fft_complex>(nsamples_total, true); // Direct FFT
volk_gnsssdr::vector<std::complex<float>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);
d_all_fft_codes_ = std::vector<uint32_t>(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32

View File

@@ -29,17 +29,17 @@
#include <utility> // for std::move
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr<AcquisitionInterface>& acq,
const std::shared_ptr<TrackingInterface>& trk, const std::shared_ptr<TelemetryDecoderInterface>& nav,
const std::string& role, const std::string& implementation, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t> >& queue)
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* queue)
{
acq_ = acq;
trk_ = trk;
nav_ = nav;
acq_ = std::move(acq);
trk_ = std::move(trk);
nav_ = std::move(nav);
queue_ = queue;
role_ = role;
implementation_ = implementation;
channel_ = channel;
queue_ = queue;
channel_fsm_ = std::make_shared<ChannelFsm>();
flag_enable_fpga = configuration->property("GNSS-SDR.enable_FPGA", false);

View File

@@ -54,9 +54,9 @@ class Channel : public ChannelInterface
{
public:
//! Constructor
Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr<AcquisitionInterface>& acq,
const std::shared_ptr<TrackingInterface>& trk, const std::shared_ptr<TelemetryDecoderInterface>& nav,
const std::string& role, const std::string& implementation, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* queue);
~Channel() = default; //!< Destructor
@@ -97,7 +97,7 @@ private:
bool connected_;
bool repeat_;
std::shared_ptr<ChannelFsm> channel_fsm_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
Concurrent_Queue<pmt::pmt_t>* queue_;
std::mutex mx;
};

View File

@@ -30,6 +30,7 @@ ChannelFsm::ChannelFsm()
trk_ = nullptr;
channel_ = 0U;
d_state = 0U;
queue_ = nullptr;
}
@@ -38,6 +39,7 @@ ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_
trk_ = nullptr;
channel_ = 0U;
d_state = 0U;
queue_ = nullptr;
}
@@ -168,10 +170,10 @@ void ChannelFsm::set_telemetry(std::shared_ptr<TelemetryDecoderInterface> teleme
}
void ChannelFsm::set_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
void ChannelFsm::set_queue(Concurrent_Queue<pmt::pmt_t>* queue)
{
std::lock_guard<std::mutex> lk(mx);
queue_ = std::move(queue);
queue_ = queue;
}

View File

@@ -45,7 +45,7 @@ public:
void set_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
void set_tracking(std::shared_ptr<TrackingInterface> tracking);
void set_telemetry(std::shared_ptr<TelemetryDecoderInterface> telemetry);
void set_queue(std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
void set_queue(Concurrent_Queue<pmt::pmt_t>* queue);
void set_channel(uint32_t channel);
void start_acquisition();
// FSM EVENTS
@@ -67,7 +67,7 @@ private:
std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_;
std::shared_ptr<TelemetryDecoderInterface> nav_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
Concurrent_Queue<pmt::pmt_t>* queue_;
uint32_t channel_;
uint32_t d_state;
std::mutex mx;

View File

@@ -55,6 +55,7 @@ set(GNSS_SPLIBS_HEADERS
conjugate_sc.h
conjugate_ic.h
gnss_sdr_create_directory.h
gnss_sdr_make_unique.h
gnss_circular_deque.h
geofunctions.h
item_type_helpers.h

View File

@@ -0,0 +1,76 @@
/*!
* \file gnss_sdr_make_unique.h
* \brief This file implements std::make_unique for C++11
*
* \author Carles Fernandez-Prades, 2020. cfernandez(at)cttc.es
*
* Based on https://stackoverflow.com/a/17902439
*
*
* -------------------------------------------------------------------------
*
* 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_GNSS_SDR_MAKE_UNIQUE_H
#define GNSS_SDR_GNSS_SDR_MAKE_UNIQUE_H
#if __cplusplus == 201103L
#include <cstddef>
#include <memory>
#include <type_traits>
#include <utility>
namespace std
{
template <class T>
struct _Unique_if
{
typedef unique_ptr<T> _Single_object;
};
template <class T>
struct _Unique_if<T[]>
{
typedef unique_ptr<T[]> _Unknown_bound;
};
template <class T, size_t N>
struct _Unique_if<T[N]>
{
typedef void _Known_bound;
};
template <class T, class... Args>
typename _Unique_if<T>::_Single_object
make_unique(Args&&... args)
{
return unique_ptr<T>(new T(std::forward<Args>(args)...));
}
template <class T>
typename _Unique_if<T>::_Unknown_bound
make_unique(size_t n)
{
typedef typename remove_extent<T>::type U;
return unique_ptr<T>(new U[n]());
}
template <class T, class... Args>
typename _Unique_if<T>::_Known_bound
make_unique(Args&&...) = delete;
} // namespace std
#endif // __cplusplus == 201103L
#endif // GNSS_SDR_GNSS_SDR_MAKE_UNIQUE_H

View File

@@ -33,7 +33,8 @@
SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t> > queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
unsigned int out_stream,
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/gen_source.dat";

View File

@@ -44,7 +44,7 @@ class SignalGenerator : public GNSSBlockInterface
public:
SignalGenerator(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t> > queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~SignalGenerator() = default;
@@ -86,7 +86,6 @@ private:
#endif
gr::blocks::vector_to_stream::sptr vector_to_stream_;
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t> > queue_;
};
#endif // GNSS_SDR_SIGNAL_GENERATOR_H

View File

@@ -40,238 +40,10 @@
#include <utility>
#include <vector>
void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA)
{
const int MAX_INPUT_SAMPLES_TOTAL = 16384;
int max_value = 0;
int tx_fd; // DMA descriptor
std::ifstream infile1;
infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
infile1.open(Filename1, std::ios::binary);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception opening file " << Filename1 << std::endl;
return;
}
std::ifstream infile2;
infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
infile2.open(Filename2, std::ios::binary);
}
catch (const std::ifstream::failure &e)
{
// could not exist
}
// rx signal
std::vector<int8_t> input_samples(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> input_samples_dma(MAX_INPUT_SAMPLES_TOTAL * 2 * 2);
int nread_elements;
int nread_elements2;
int file_completed = 0;
int num_transferred_bytes;
//**************************************************************************
// Open DMA device
//**************************************************************************
tx_fd = open("/dev/loop_tx", O_WRONLY);
if (tx_fd < 0)
{
std::cout << "Cannot open loop device" << std::endl;
return;
}
//**************************************************************************
// Open input file
//**************************************************************************
int nsamples = 0;
while ((file_completed == 0) && (enable_DMA == true))
{
unsigned int dma_index = 0;
if (FreqBand == "L1")
{
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile1)
{
nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements = 0;
}
nsamples += (nread_elements / 2);
for (int index0 = 0; index0 < (nread_elements); index0 += 2)
{
// channel 1 (queue 1)
input_samples_dma[dma_index] = 0;
input_samples_dma[dma_index + 1] = 0;
// channel 0 (queue 0)
input_samples_dma[dma_index + 2] = input_samples[index0];
input_samples_dma[dma_index + 3] = input_samples[index0 + 1];
dma_index += 4;
}
}
else if (FreqBand == "L2")
{
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile1)
{
nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements = 0;
}
nsamples += (nread_elements / 2);
for (int index0 = 0; index0 < (nread_elements); index0 += 2)
{
// channel 1 (queue 1)
input_samples_dma[dma_index] = input_samples[index0];
input_samples_dma[dma_index + 1] = input_samples[index0 + 1];
// channel 0 (queue 0)
input_samples_dma[dma_index + 2] = 0;
input_samples_dma[dma_index + 3] = 0;
dma_index += 4;
}
}
else if (FreqBand == "L1L2")
{
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile1)
{
nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements = 0;
}
try
{
infile2.read(reinterpret_cast<char *>(input_samples2.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile2)
{
nread_elements2 = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements2 = 0;
}
if (nread_elements > nread_elements2)
{
nread_elements = nread_elements2; // take the smallest
}
nsamples += (nread_elements / 2);
for (int index0 = 0; index0 < (nread_elements); index0 += 2)
{
input_samples[index0] = input_samples[index0];
input_samples[index0 + 1] = input_samples[index0 + 1];
if (input_samples[index0] > max_value)
{
max_value = input_samples[index0];
}
else if (-input_samples[index0] > max_value)
{
max_value = -input_samples[index0];
}
if (input_samples[index0 + 1] > max_value)
{
max_value = input_samples[index0 + 1];
}
else if (-input_samples[index0 + 1] > max_value)
{
max_value = -input_samples[index0 + 1];
}
// channel 1 (queue 1)
input_samples_dma[dma_index] = input_samples2[index0];
input_samples_dma[dma_index + 1] = input_samples2[index0 + 1];
// channel 0 (queue 0)
input_samples_dma[dma_index + 2] = input_samples[index0];
input_samples_dma[dma_index + 3] = input_samples[index0 + 1];
dma_index += 4;
}
}
if (nread_elements > 0)
{
num_transferred_bytes = nread_elements * 2;
int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2);
if (num_bytes_sent != num_transferred_bytes)
{
std::cerr << "Error: DMA could not send all the required samples " << std::endl;
}
// Throttle the DMA
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2)
{
file_completed = 1;
}
}
try
{
infile1.close();
infile2.close();
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception closing files " << Filename1 << " and " << Filename2 << std::endl;
}
}
Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_gain_mode("slow_attack");
double default_tx_attenuation_db = -10.0;
@@ -564,6 +336,235 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource()
}
void Ad9361FpgaSignalSource::run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA)
{
const int MAX_INPUT_SAMPLES_TOTAL = 16384;
int max_value = 0;
int tx_fd; // DMA descriptor
std::ifstream infile1;
infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
infile1.open(Filename1, std::ios::binary);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception opening file " << Filename1 << std::endl;
return;
}
std::ifstream infile2;
infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try
{
infile2.open(Filename2, std::ios::binary);
}
catch (const std::ifstream::failure &e)
{
// could not exist
}
// rx signal
std::vector<int8_t> input_samples(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> input_samples2(MAX_INPUT_SAMPLES_TOTAL * 2);
std::vector<int8_t> input_samples_dma(MAX_INPUT_SAMPLES_TOTAL * 2 * 2);
int nread_elements;
int nread_elements2;
int file_completed = 0;
int num_transferred_bytes;
//**************************************************************************
// Open DMA device
//**************************************************************************
tx_fd = open("/dev/loop_tx", O_WRONLY);
if (tx_fd < 0)
{
std::cout << "Cannot open loop device" << std::endl;
return;
}
//**************************************************************************
// Open input file
//**************************************************************************
int nsamples = 0;
while ((file_completed == 0) && (enable_DMA == true))
{
unsigned int dma_index = 0;
if (FreqBand == "L1")
{
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile1)
{
nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements = 0;
}
nsamples += (nread_elements / 2);
for (int index0 = 0; index0 < (nread_elements); index0 += 2)
{
// channel 1 (queue 1)
input_samples_dma[dma_index] = 0;
input_samples_dma[dma_index + 1] = 0;
// channel 0 (queue 0)
input_samples_dma[dma_index + 2] = input_samples[index0];
input_samples_dma[dma_index + 3] = input_samples[index0 + 1];
dma_index += 4;
}
}
else if (FreqBand == "L2")
{
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile1)
{
nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements = 0;
}
nsamples += (nread_elements / 2);
for (int index0 = 0; index0 < (nread_elements); index0 += 2)
{
// channel 1 (queue 1)
input_samples_dma[dma_index] = input_samples[index0];
input_samples_dma[dma_index + 1] = input_samples[index0 + 1];
// channel 0 (queue 0)
input_samples_dma[dma_index + 2] = 0;
input_samples_dma[dma_index + 3] = 0;
dma_index += 4;
}
}
else if (FreqBand == "L1L2")
{
try
{
infile1.read(reinterpret_cast<char *>(input_samples.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile1)
{
nread_elements = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements = 0;
}
try
{
infile2.read(reinterpret_cast<char *>(input_samples2.data()), MAX_INPUT_SAMPLES_TOTAL * 2);
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception reading file " << Filename1 << std::endl;
}
if (infile2)
{
nread_elements2 = MAX_INPUT_SAMPLES_TOTAL * 2;
}
else
{
nread_elements2 = 0;
}
if (nread_elements > nread_elements2)
{
nread_elements = nread_elements2; // take the smallest
}
nsamples += (nread_elements / 2);
for (int index0 = 0; index0 < (nread_elements); index0 += 2)
{
input_samples[index0] = input_samples[index0];
input_samples[index0 + 1] = input_samples[index0 + 1];
if (input_samples[index0] > max_value)
{
max_value = input_samples[index0];
}
else if (-input_samples[index0] > max_value)
{
max_value = -input_samples[index0];
}
if (input_samples[index0 + 1] > max_value)
{
max_value = input_samples[index0 + 1];
}
else if (-input_samples[index0 + 1] > max_value)
{
max_value = -input_samples[index0 + 1];
}
// channel 1 (queue 1)
input_samples_dma[dma_index] = input_samples2[index0];
input_samples_dma[dma_index + 1] = input_samples2[index0 + 1];
// channel 0 (queue 0)
input_samples_dma[dma_index + 2] = input_samples[index0];
input_samples_dma[dma_index + 3] = input_samples[index0 + 1];
dma_index += 4;
}
}
if (nread_elements > 0)
{
num_transferred_bytes = nread_elements * 2;
int num_bytes_sent = write(tx_fd, input_samples_dma.data(), nread_elements * 2);
if (num_bytes_sent != num_transferred_bytes)
{
std::cerr << "Error: DMA could not send all the required samples " << std::endl;
}
// Throttle the DMA
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
if (nread_elements != MAX_INPUT_SAMPLES_TOTAL * 2)
{
file_completed = 1;
}
}
try
{
infile1.close();
infile2.close();
}
catch (const std::ifstream::failure &e)
{
std::cerr << "Exception closing files " << Filename1 << " and " << Filename2 << std::endl;
}
}
void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block)
{
if (top_block)

View File

@@ -35,9 +35,9 @@ class ConfigurationInterface;
class Ad9361FpgaSignalSource : public GNSSBlockInterface
{
public:
Ad9361FpgaSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Ad9361FpgaSignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream,
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t> *queue);
~Ad9361FpgaSignalSource();
@@ -102,8 +102,6 @@ private:
size_t item_size_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
std::shared_ptr<Fpga_Switch> switch_fpga;
int32_t switch_position;
@@ -114,6 +112,7 @@ private:
bool enable_DMA_;
bool rf_shutdown_;
void run_DMA_process(const std::string &FreqBand, const std::string &Filename1, const std::string &Filename2, const bool &enable_DMA);
};
#endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H

View File

@@ -29,7 +29,7 @@
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
// DUMP PARAMETERS
std::string empty = "";

View File

@@ -48,7 +48,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface
public:
CustomUDPSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~CustomUDPSignalSource() = default;
@@ -98,8 +98,6 @@ private:
#endif
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H

View File

@@ -33,7 +33,7 @@
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_filename = "./example_capture.dat";
std::string default_item_type = "short";
@@ -211,7 +211,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_)

View File

@@ -50,7 +50,7 @@ class FileSignalSource : public GNSSBlockInterface
public:
FileSignalSource(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~FileSignalSource() = default;
@@ -121,7 +121,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@@ -31,10 +31,7 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role),
in_stream_(in_stream),
out_stream_(out_stream),
queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue __attribute__((unused))) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "byte";
item_type_ = configuration->property(role + ".item_type", default_item_type);

View File

@@ -47,7 +47,7 @@ class FlexibandSignalSource : public GNSSBlockInterface
public:
FlexibandSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~FlexibandSignalSource() = default;
@@ -94,13 +94,11 @@ private:
int n_channels_;
int sel_ch_;
gr::block_sptr flexiband_source_;
boost::shared_ptr<gr::block> flexiband_source_;
std::vector<std::shared_ptr<gr::block>> char_to_float;
std::vector<std::shared_ptr<gr::block>> float_to_complex_;
std::vector<boost::shared_ptr<gr::block>> char_to_float;
std::vector<boost::shared_ptr<gr::block>> float_to_complex_;
std::vector<gr::blocks::null_sink::sptr> null_sinks_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H

View File

@@ -34,7 +34,7 @@
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t> *queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/signal_source.dat";
@@ -320,7 +320,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration
if (samples_ != 0)
{
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}

View File

@@ -46,7 +46,7 @@ class Fmcomms2SignalSource : public GNSSBlockInterface
public:
Fmcomms2SignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~Fmcomms2SignalSource();
@@ -127,7 +127,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H

View File

@@ -29,24 +29,17 @@
// Constructor
GenSignalSource::GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter,
std::string role, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : signal_generator_(signal_generator),
filter_(filter),
role_(std::move(role)),
queue_(std::move(queue))
GenSignalSource::GenSignalSource(std::shared_ptr<GNSSBlockInterface> signal_generator,
std::shared_ptr<GNSSBlockInterface> filter,
std::string role,
Concurrent_Queue<pmt::pmt_t> *queue __attribute__((unused))) : signal_generator_(std::move(signal_generator)),
filter_(std::move(filter)),
role_(std::move(role))
{
connected_ = false;
}
// Destructor
GenSignalSource::~GenSignalSource()
{
delete signal_generator_;
delete filter_;
}
void GenSignalSource::connect(gr::top_block_sptr top_block)
{
if (connected_)

View File

@@ -37,11 +37,11 @@ class GenSignalSource : public GNSSBlockInterface
{
public:
//! Constructor
GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter,
std::string role, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
GenSignalSource(std::shared_ptr<GNSSBlockInterface> signal_generator, std::shared_ptr<GNSSBlockInterface> filter,
std::string role, Concurrent_Queue<pmt::pmt_t> *queue);
//! Virtual destructor
virtual ~GenSignalSource();
virtual ~GenSignalSource() = default;
void connect(gr::top_block_sptr top_block) override;
void disconnect(gr::top_block_sptr top_block) override;
@@ -52,15 +52,14 @@ public:
//! Returns "Signal Source"
inline std::string implementation() override { return "Signal Source"; }
inline size_t item_size() override { return 0; }
inline GNSSBlockInterface *signal_generator() const { return signal_generator_; }
inline std::shared_ptr<GNSSBlockInterface> signal_generator() const { return signal_generator_; }
private:
GNSSBlockInterface *signal_generator_;
GNSSBlockInterface *filter_;
std::shared_ptr<GNSSBlockInterface> signal_generator_;
std::shared_ptr<GNSSBlockInterface> filter_;
std::string role_;
std::string implementation_;
bool connected_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_GEN_SIGNAL_SOURCE_H

View File

@@ -25,7 +25,10 @@
Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
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 default_item_type = "short";
std::string default_dump_file = "./data/gn3s_source.dat";

View File

@@ -40,7 +40,7 @@ class Gn3sSignalSource : public GNSSBlockInterface
public:
Gn3sSignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~Gn3sSignalSource() = default;
@@ -78,7 +78,6 @@ private:
std::string dump_filename_;
gr::block_sptr gn3s_source_;
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_GN3S_SIGNAL_SOURCE_H

View File

@@ -26,7 +26,7 @@
LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
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)
{
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./labsat_output.dat";
@@ -42,7 +42,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
if (item_type_ == "gr_complex")
{
item_size_ = sizeof(gr_complex);
labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channel_selector, queue_);
labsat23_source_ = labsat23_make_source_sptr(filename_.c_str(), channel_selector, queue);
DLOG(INFO) << "Item size " << item_size_;
DLOG(INFO) << "labsat23_source_(" << labsat23_source_->unique_id() << ")";
}

View File

@@ -39,7 +39,7 @@ class LabsatSignalSource : public GNSSBlockInterface
public:
LabsatSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~LabsatSignalSource() = default;
@@ -77,7 +77,6 @@ private:
std::string dump_filename_;
gr::block_sptr labsat23_source_;
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_LABSAT_SIGNAL_SOURCE_H

View File

@@ -32,7 +32,7 @@
MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_filename = "./example_capture.dat";
std::string default_item_type = "short";
@@ -205,7 +205,7 @@ MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterfac
DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (enable_throttle_control_)

View File

@@ -51,7 +51,7 @@ class MultichannelFileSignalSource : public GNSSBlockInterface
public:
MultichannelFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~MultichannelFileSignalSource() = default;
@@ -121,7 +121,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@@ -33,7 +33,7 @@
NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_filename = "../data/my_capture.dat";
std::string default_item_type = "byte";
@@ -137,7 +137,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue_);
valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_)

View File

@@ -50,7 +50,7 @@ class NsrFileSignalSource : public GNSSBlockInterface
public:
NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~NsrFileSignalSource() = default;
inline std::string role() override
@@ -121,7 +121,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@@ -31,7 +31,7 @@
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
// DUMP PARAMETERS
std::string empty = "";
@@ -123,7 +123,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
if (samples_ != 0)
{
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}

View File

@@ -48,7 +48,7 @@ class OsmosdrSignalSource : public GNSSBlockInterface
public:
OsmosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~OsmosdrSignalSource() = default;
@@ -108,7 +108,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H

View File

@@ -28,7 +28,7 @@
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
std::string default_item_type = "gr_complex";
std::string default_dump_file = "./data/signal_source.dat";
@@ -135,7 +135,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
if (samples_ != 0)
{
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}

View File

@@ -48,7 +48,7 @@ class PlutosdrSignalSource : public GNSSBlockInterface
public:
PlutosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~PlutosdrSignalSource() = default;
@@ -112,7 +112,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H

View File

@@ -27,7 +27,7 @@
RawArraySignalSource::RawArraySignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue)
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 default_item_type = "gr_complex";
std::string default_dump_file = "./data/raw_array_source.dat";

View File

@@ -39,7 +39,7 @@ class RawArraySignalSource : public GNSSBlockInterface
public:
RawArraySignalSource(ConfigurationInterface* configuration,
std::string role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~RawArraySignalSource() = default;
@@ -78,7 +78,6 @@ private:
std::string eth_device_;
gr::block_sptr raw_array_source_;
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H

View File

@@ -34,10 +34,9 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role),
in_stream_(in_stream),
out_stream_(out_stream),
queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
in_stream_(in_stream),
out_stream_(out_stream)
{
// DUMP PARAMETERS
std::string empty = "";
@@ -111,7 +110,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration,
if (samples_ != 0ULL)
{
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
}

View File

@@ -51,7 +51,7 @@ public:
const std::string& role,
unsigned int in_stream,
unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~RtlTcpSignalSource() = default;
@@ -111,7 +111,6 @@ private:
boost::shared_ptr<gr::block> valve_;
#endif
gr::blocks::file_sink::sptr file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H

View File

@@ -32,7 +32,7 @@
SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue)
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams)
{
std::string default_filename = "../data/my_capture.dat";
std::string default_item_type = "int";
@@ -136,7 +136,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue_);
valve_ = gnss_sdr_make_valve(sizeof(float), samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_)

View File

@@ -48,7 +48,7 @@ class SpirFileSignalSource : public GNSSBlockInterface
public:
SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~SpirFileSignalSource() = default;
inline std::string role() override
@@ -119,7 +119,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@@ -29,7 +29,7 @@
SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration,
const std::string& role, uint32_t in_streams, uint32_t out_streams, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue))
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)
{
std::string default_filename = "../data/my_capture.dat";
std::string default_dump_filename = "../data/my_capture_dump.dat";
@@ -137,7 +137,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface*
for (uint32_t i = 0; i < (n_channels_); i++)
{
valve_vec_.emplace_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_));
valve_vec_.emplace_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue));
if (dump_)
{
std::string tmp_str = dump_filename_ + "_ch" + std::to_string(i);

View File

@@ -53,7 +53,7 @@ class SpirGSS6450FileSignalSource : public GNSSBlockInterface
{
public:
SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, const std::string& role,
uint32_t in_streams, uint32_t out_streams, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
uint32_t in_streams, uint32_t out_streams, Concurrent_Queue<pmt::pmt_t>* queue);
~SpirGSS6450FileSignalSource() = default;
inline std::string role() override
@@ -130,7 +130,6 @@ private:
#endif
std::vector<gr::blocks::file_sink::sptr> sink_vec_;
std::vector<gr::blocks::throttle::sptr> throttle_vec_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
};

View File

@@ -34,10 +34,9 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
const std::string& role,
unsigned int in_streams,
unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
std::string default_filename = "../data/my_capture.dat";
std::string default_item_type = "byte";
@@ -142,7 +141,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_);
valve_ = gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_)

View File

@@ -54,7 +54,7 @@ public:
const std::string& role,
unsigned int in_streams,
unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~TwoBitCpxFileSignalSource() = default;
inline std::string role() override
@@ -126,7 +126,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
// Throttle control
bool enable_throttle_control_;

View File

@@ -36,10 +36,9 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
const std::string& role,
unsigned int in_streams,
unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams),
queue_(queue)
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
in_streams_(in_streams),
out_streams_(out_streams)
{
std::string default_filename = "../data/my_capture.dat";
std::string default_item_type = "byte";
@@ -206,7 +205,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
LOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]";
std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]" << std::endl;
valve_ = gnss_sdr_make_valve(output_item_size, samples_, queue_);
valve_ = gnss_sdr_make_valve(output_item_size, samples_, queue);
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_)

View File

@@ -53,7 +53,7 @@ class TwoBitPackedFileSignalSource : public GNSSBlockInterface
public:
TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, const std::string& role,
unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue);
Concurrent_Queue<pmt::pmt_t>* queue);
~TwoBitPackedFileSignalSource() = default;
inline std::string role() override
@@ -145,7 +145,6 @@ private:
#endif
gr::blocks::file_sink::sptr sink_;
gr::blocks::throttle::sptr throttle_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
size_t item_size_;
bool big_endian_items_;
bool big_endian_bytes_;

View File

@@ -31,7 +31,7 @@
UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue))
Concurrent_Queue<pmt::pmt_t>* queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream)
{
// DUMP PARAMETERS
std::string empty = "";
@@ -204,7 +204,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
if (samples_.at(i) != 0ULL)
{
LOG(INFO) << "RF_channel " << i << " Send STOP signal after " << samples_.at(i) << " samples";
valve_.emplace_back(gnss_sdr_make_valve(item_size_, samples_.at(i), queue_));
valve_.emplace_back(gnss_sdr_make_valve(item_size_, samples_.at(i), queue));
DLOG(INFO) << "valve(" << valve_.at(i)->unique_id() << ")";
}

View File

@@ -46,7 +46,7 @@ class UhdSignalSource : public GNSSBlockInterface
public:
UhdSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream,
unsigned int out_stream, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
unsigned int out_stream, Concurrent_Queue<pmt::pmt_t>* queue);
~UhdSignalSource() = default;
@@ -103,8 +103,6 @@ private:
std::vector<boost::shared_ptr<gr::block>> valve_;
#endif
std::vector<gr::blocks::file_sink::sptr> file_sink_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue_;
};
#endif // GNSS_SDR_UHD_SIGNAL_SOURCE_H

View File

@@ -30,18 +30,18 @@
#include <vector>
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, Concurrent_Queue<pmt::pmt_t> *queue)
{
return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, std::move(queue)));
return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, queue));
}
labsat23_source::labsat23_source(const char *signal_file_basename,
int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) : gr::block("labsat23_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_queue(std::move(queue))
Concurrent_Queue<pmt::pmt_t> *queue) : gr::block("labsat23_source",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1, 1, sizeof(gr_complex))),
d_queue(queue)
{
if (channel_selector < 1 or channel_selector > 2)
{
@@ -60,16 +60,15 @@ labsat23_source::labsat23_source(const char *signal_file_basename,
std::string signal_file;
this->set_output_multiple(8);
signal_file = generate_filename();
binary_input_file = new std::ifstream(signal_file.c_str(), std::ios::in | std::ios::binary);
binary_input_file.open(signal_file.c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
if (binary_input_file.is_open())
{
std::cout << "Labsat file source is reading samples from " << signal_file << std::endl;
}
else
{
std::cout << "Labsat file " << signal_file << " could not be opened!" << std::endl;
delete binary_input_file;
exit(1);
}
}
@@ -79,9 +78,9 @@ labsat23_source::~labsat23_source()
{
try
{
if (binary_input_file->is_open())
if (binary_input_file.is_open())
{
binary_input_file->close();
binary_input_file.close();
}
}
catch (const std::ifstream::failure &e)
@@ -92,7 +91,6 @@ labsat23_source::~labsat23_source()
{
std::cerr << e.what() << '\n';
}
delete binary_input_file;
}
@@ -202,10 +200,10 @@ int labsat23_source::general_work(int noutput_items,
if (d_header_parsed == false)
{
if (binary_input_file->eof() == false)
if (binary_input_file.eof() == false)
{
std::array<char, 1024> memblock{};
binary_input_file->read(memblock.data(), 1024);
binary_input_file.read(memblock.data(), 1024);
// parse Labsat header
// check preamble
int byte_counter = 0;
@@ -392,8 +390,8 @@ int labsat23_source::general_work(int noutput_items,
// end of header
d_header_parsed = true;
// seek file to the first signal sample
binary_input_file->clear();
binary_input_file->seekg(header_bytes, binary_input_file->beg);
binary_input_file.clear();
binary_input_file.seekg(header_bytes, binary_input_file.beg);
return 0;
}
std::cout << "Labsat file header error: section 2 is not available." << std::endl;
@@ -419,8 +417,8 @@ int labsat23_source::general_work(int noutput_items,
if (n_int16_to_read > 0)
{
std::vector<int16_t> memblock(n_int16_to_read);
binary_input_file->read(reinterpret_cast<char *>(memblock.data()), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
binary_input_file.read(reinterpret_cast<char *>(memblock.data()), n_int16_to_read * 2);
n_int16_to_read = binary_input_file.gcount() / 2; // from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
@@ -438,9 +436,9 @@ int labsat23_source::general_work(int noutput_items,
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
binary_input_file.close();
binary_input_file.open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file.is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
return 0;
@@ -477,8 +475,8 @@ int labsat23_source::general_work(int noutput_items,
if (n_int16_to_read > 0)
{
std::vector<int16_t> memblock(n_int16_to_read);
binary_input_file->read(reinterpret_cast<char *>(memblock.data()), n_int16_to_read * 2);
n_int16_to_read = binary_input_file->gcount() / 2; // from bytes to int16
binary_input_file.read(reinterpret_cast<char *>(memblock.data()), n_int16_to_read * 2);
n_int16_to_read = binary_input_file.gcount() / 2; // from bytes to int16
if (n_int16_to_read > 0)
{
int output_pointer = 0;
@@ -496,9 +494,9 @@ int labsat23_source::general_work(int noutput_items,
{
std::cout << "End of current file, reading the next Labsat file in sequence: " << generate_filename() << std::endl;
}
binary_input_file->close();
binary_input_file->open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file->is_open())
binary_input_file.close();
binary_input_file.open(generate_filename().c_str(), std::ios::in | std::ios::binary);
if (binary_input_file.is_open())
{
std::cout << "Labsat file source is reading samples from " << generate_filename() << std::endl;
return 0;

View File

@@ -43,7 +43,7 @@ using labsat23_source_sptr = boost::shared_ptr<labsat23_source>;
labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t> *queue);
/*!
* \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex
@@ -62,11 +62,11 @@ private:
friend labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename,
int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t> *queue);
labsat23_source(const char *signal_file_basename,
int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t> *queue);
std::string generate_filename();
void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
@@ -77,10 +77,10 @@ private:
int d_current_file_number;
uint8_t d_labsat_version;
std::string d_signal_file_basename;
std::ifstream *binary_input_file;
std::ifstream binary_input_file;
uint8_t d_ref_clock;
uint8_t d_bits_per_sample;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> d_queue;
Concurrent_Queue<pmt::pmt_t> *d_queue;
};
#endif // GNSS_SDR_LABSAT23_SOURCE_H

View File

@@ -180,8 +180,8 @@ bool config_ad9361_rx_local(uint64_t bandwidth_,
bool quadrature_,
bool rfdc_,
bool bbdc_,
std::string filter_source_,
std::string filter_filename_,
std::string filter_source_, // NOLINT(performance-unnecessary-value-param)
std::string filter_filename_, // NOLINT(performance-unnecessary-value-param)
float Fpass_,
float Fstop_)

View File

@@ -31,42 +31,43 @@
Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph) : gr::sync_block("valve",
gr::io_signature::make(1, 20, sizeof_stream_item),
gr::io_signature::make(1, 20, sizeof_stream_item)),
d_nitems(nitems),
d_ncopied_items(0),
d_queue(std::move(queue)),
d_queue(queue),
d_stop_flowgraph(stop_flowgraph)
{
d_open_valve = false;
}
#if GNURADIO_USES_STD_POINTERS
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph)
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph)
{
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, stop_flowgraph));
return valve_;
}
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue)
{
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
std::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, true));
return valve_;
}
#else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph)
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph));
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, stop_flowgraph));
return valve_;
}
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue)
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue<pmt::pmt_t>* queue)
{
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true));
boost::shared_ptr<Gnss_Sdr_Valve> valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, queue, true));
return valve_;
}
#endif
@@ -79,8 +80,8 @@ void Gnss_Sdr_Valve::open_valve()
int Gnss_Sdr_Valve::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items)
{
if (d_open_valve == false)
{

View File

@@ -41,23 +41,23 @@ class Gnss_Sdr_Valve;
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#endif
@@ -71,40 +71,40 @@ public:
void open_valve();
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items);
private:
#if GNURADIO_USES_STD_POINTERS
friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#else
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue);
Concurrent_Queue<pmt::pmt_t>* queue);
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue,
Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph);
#endif
Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, bool stop_flowgraph);
Concurrent_Queue<pmt::pmt_t>* queue, bool stop_flowgraph);
uint64_t d_nitems;
uint64_t d_ncopied_items;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> d_queue;
Concurrent_Queue<pmt::pmt_t>* d_queue;
bool d_stop_flowgraph;
bool d_open_valve;
};