1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Merge branch 'make-unique' into next

This commit is contained in:
Carles Fernandez 2020-06-18 11:51:05 +02:00
commit c237f72a51
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
135 changed files with 1295 additions and 1302 deletions

View File

@ -26,6 +26,9 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades <carles.fernandez@cttc
smart pointers instead of Boost smart pointers. smart pointers instead of Boost smart pointers.
- The software can now be built against Boost <= 1.73 (minimum version: 1.53). - The software can now be built against Boost <= 1.73 (minimum version: 1.53).
- Removed python six module as a dependency if using Python 3.x. - Removed python six module as a dependency if using Python 3.x.
- Improved usage of smart pointers to better express ownership.
- Add definition of std::make_unique for buidings with C++11, and make use of it
along the source code.
- Fixed building with GCC 10 (gcc-10 and above flipped a default from `-fcommon` - Fixed building with GCC 10 (gcc-10 and above flipped a default from `-fcommon`
to `-fno-common`, causing an error due to multiple defined lambda functions). to `-fno-common`, causing an error due to multiple defined lambda functions).
- Fixed warnings risen by GCC 10 and Clang 10. - Fixed warnings risen by GCC 10 and Clang 10.

View File

@ -35,6 +35,7 @@
#include "glonass_gnav_utc_model.h" #include "glonass_gnav_utc_model.h"
#include "gnss_frequencies.h" #include "gnss_frequencies.h"
#include "gnss_sdr_create_directory.h" #include "gnss_sdr_create_directory.h"
#include "gnss_sdr_make_unique.h"
#include "gps_almanac.h" #include "gps_almanac.h"
#include "gps_cnav_ephemeris.h" #include "gps_cnav_ephemeris.h"
#include "gps_cnav_iono.h" #include "gps_cnav_iono.h"
@ -137,13 +138,11 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
mapStringValues_["B2"] = evBDS_B2; mapStringValues_["B2"] = evBDS_B2;
mapStringValues_["B3"] = evBDS_B3; mapStringValues_["B3"] = evBDS_B3;
initial_carrier_phase_offset_estimation_rads = std::vector<double>(nchannels, 0.0); initial_carrier_phase_offset_estimation_rads = std::vector<double>(nchannels, 0.0);
channel_initialized = std::vector<bool>(nchannels, false); channel_initialized = std::vector<bool>(nchannels, false);
max_obs_block_rx_clock_offset_ms = conf_.max_obs_block_rx_clock_offset_ms; max_obs_block_rx_clock_offset_ms = conf_.max_obs_block_rx_clock_offset_ms;
d_output_rate_ms = conf_.output_rate_ms; d_output_rate_ms = conf_.output_rate_ms;
d_display_rate_ms = conf_.display_rate_ms; d_display_rate_ms = conf_.display_rate_ms;
d_report_rate_ms = 1000; // report every second PVT to gnss_synchro 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) 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); d_kml_dump->set_headers(kml_dump_filename);
} }
else else
@ -230,7 +229,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
} }
if (d_gpx_output_enabled) 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); d_gpx_dump->set_headers(gpx_dump_filename);
} }
else else
@ -249,7 +248,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
} }
if (d_geojson_output_enabled) 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); d_geojson_printer->set_headers(geojson_dump_filename);
} }
else else
@ -267,7 +266,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
if (d_nmea_output_file_enabled) 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 else
{ {
@ -279,7 +278,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
rtcm_dump_filename = d_dump_filename; rtcm_dump_filename = d_dump_filename;
if (conf_.flag_rtcm_server or conf_.flag_rtcm_tty_port or conf_.rtcm_output_file_enabled) 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; 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()) 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; d_rinex_version = conf_.rinex_version;
if (b_rinex_output_enabled) 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); rp->set_pre_2009_file(conf_.pre_2009_file);
} }
else else
@ -413,7 +412,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); 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_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 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) 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 (d_gpx_output_enabled)
{ {
if (current_RX_time_ms % d_gpx_rate_ms == 0) 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 (d_geojson_output_enabled)
{ {
if (current_RX_time_ms % d_geojson_rate_ms == 0) 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 (d_nmea_output_file_enabled)
{ {
if (current_RX_time_ms % d_nmea_rate_ms == 0) 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_display_rate_ms;
int32_t d_report_rate_ms; int32_t d_report_rate_ms;
std::shared_ptr<Rinex_Printer> rp; std::unique_ptr<Rinex_Printer> rp;
std::shared_ptr<Kml_Printer> d_kml_dump; std::unique_ptr<Kml_Printer> d_kml_dump;
std::shared_ptr<Gpx_Printer> d_gpx_dump; std::unique_ptr<Gpx_Printer> d_gpx_dump;
std::shared_ptr<Nmea_Printer> d_nmea_printer; std::unique_ptr<Nmea_Printer> d_nmea_printer;
std::shared_ptr<GeoJSON_Printer> d_geojson_printer; std::unique_ptr<GeoJSON_Printer> d_geojson_printer;
std::shared_ptr<Rtcm_Printer> d_rtcm_printer; std::unique_ptr<Rtcm_Printer> d_rtcm_printer;
double d_rx_time; double d_rx_time;
bool d_geojson_output_enabled; 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 latitude;
double longitude; double longitude;
double height; double height;
const std::shared_ptr<Pvt_Solution>& position_ = position;
if (print_average_values == false) if (print_average_values == false)
{ {
latitude = position_->get_latitude(); latitude = position->get_latitude();
longitude = position_->get_longitude(); longitude = position->get_longitude();
height = position_->get_height(); height = position->get_height();
} }
else else
{ {
latitude = position_->get_avg_latitude(); latitude = position->get_avg_latitude();
longitude = position_->get_avg_longitude(); longitude = position->get_avg_longitude();
height = position_->get_avg_height(); height = position->get_avg_height();
} }
if (geojson_file.is_open()) if (geojson_file.is_open())

View File

@ -40,7 +40,7 @@ public:
explicit GeoJSON_Printer(const std::string& base_path = "."); explicit GeoJSON_Printer(const std::string& base_path = ".");
~GeoJSON_Printer(); ~GeoJSON_Printer();
bool set_headers(const std::string& filename, bool time_tag_name = true); 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(); bool close_file();
private: private:

View File

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

View File

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

View File

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

View File

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

View File

@ -22,6 +22,7 @@
#include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_oarchive.hpp>
#include <iostream> #include <iostream>
#include <sstream> #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} 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; std::string outbound_data;
if (use_protobuf == false) if (use_protobuf == false)
{ {
std::ostringstream archive_stream; std::ostringstream archive_stream;
boost::archive::binary_oarchive oa{archive_stream}; boost::archive::binary_oarchive oa{archive_stream};
oa << *monitor_pvt.get(); oa << *monitor_pvt_.get();
outbound_data = archive_stream.str(); outbound_data = archive_stream.str();
} }
else else
{ {
outbound_data = serdes.createProtobuffer(monitor_pvt); outbound_data = serdes.createProtobuffer(monitor_pvt_);
} }
for (const auto& endpoint : endpoints) for (const auto& endpoint : endpoints)

View File

@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink
{ {
public: public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled); 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: private:
b_io_context io_context; b_io_context io_context;
@ -46,6 +46,7 @@ private:
boost::system::error_code error; boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints; std::vector<boost::asio::ip::udp::endpoint> endpoints;
Serdes_Monitor_Pvt serdes; Serdes_Monitor_Pvt serdes;
std::shared_ptr<Monitor_Pvt> monitor_pvt_;
bool use_protobuf; 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; nmea_dev_descriptor = -1;
} }
print_avg_pos = false; 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 GPRMC;
std::string GPGGA; std::string GPGGA;

View File

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

View File

@ -38,6 +38,7 @@ class Pvt_Solution
{ {
public: public:
Pvt_Solution(); 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 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] double get_time_offset_s() const; //!< Get RX time offset [s]
void set_time_offset_s(double offset); //!< Set 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); 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: protected:
bool d_pre_2009_file; // Flag to correct week rollover in post processing mode for signals older than 2009 bool d_pre_2009_file; // Flag to correct week rollover in post processing mode for signals older than 2009
private: private:

View File

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

View File

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

View File

@ -23,6 +23,7 @@
#include "configuration_interface.h" #include "configuration_interface.h"
#include "galileo_e1_signal_processing.h" #include "galileo_e1_signal_processing.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex #include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_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 // 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) // 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); // buffer for the local code volk_gnsssdr::vector<std::complex<float>> code(nsamples_total); // buffer for the local code
volk_gnsssdr::vector<gr_complex> fft_codes_padded(nsamples_total); 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 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 "configuration_interface.h"
#include "galileo_e5_signal_processing.h" #include "galileo_e5_signal_processing.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex #include <gnuradio/fft/fft.h> // for fft_complex
#include <gnuradio/gr_complex.h> // for gr_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 // 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) // 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>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(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 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 "GPS_L1_CA.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/fft/fft.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 // 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) // 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 // 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>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total); volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@ -24,6 +24,7 @@
#include "GPS_L2C.h" #include "GPS_L2C.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro.h" #include "gnss_synchro.h"
#include "gps_l2c_signal.h" #include "gps_l2c_signal.h"
#include <glog/logging.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 // 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) // 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 // 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>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total); volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(nsamples_total);

View File

@ -25,6 +25,7 @@
#include "GPS_L5.h" #include "GPS_L5.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_flags.h" #include "gnss_sdr_flags.h"
#include "gnss_sdr_make_unique.h"
#include "gps_l5_signal.h" #include "gps_l5_signal.h"
#include <glog/logging.h> #include <glog/logging.h>
#include <gnuradio/fft/fft.h> // for fft_complex #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 // 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) // 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>> code(nsamples_total);
volk_gnsssdr::vector<std::complex<float>> fft_codes_padded(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 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 #include <utility> // for std::move
Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, const std::shared_ptr<AcquisitionInterface>& acq, Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr<AcquisitionInterface> acq,
const std::shared_ptr<TrackingInterface>& trk, const std::shared_ptr<TelemetryDecoderInterface>& nav, std::shared_ptr<TrackingInterface> trk, std::shared_ptr<TelemetryDecoderInterface> nav,
const std::string& role, const std::string& implementation, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t> >& queue) const std::string& role, const std::string& implementation, Concurrent_Queue<pmt::pmt_t>* queue)
{ {
acq_ = acq; acq_ = std::move(acq);
trk_ = trk; trk_ = std::move(trk);
nav_ = nav; nav_ = std::move(nav);
queue_ = queue;
role_ = role; role_ = role;
implementation_ = implementation; implementation_ = implementation;
channel_ = channel; channel_ = channel;
queue_ = queue;
channel_fsm_ = std::make_shared<ChannelFsm>(); channel_fsm_ = std::make_shared<ChannelFsm>();
flag_enable_fpga = configuration->property("GNSS-SDR.enable_FPGA", false); flag_enable_fpga = configuration->property("GNSS-SDR.enable_FPGA", false);

View File

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

View File

@ -30,6 +30,7 @@ ChannelFsm::ChannelFsm()
trk_ = nullptr; trk_ = nullptr;
channel_ = 0U; channel_ = 0U;
d_state = 0U; d_state = 0U;
queue_ = nullptr;
} }
@ -38,6 +39,7 @@ ChannelFsm::ChannelFsm(std::shared_ptr<AcquisitionInterface> acquisition) : acq_
trk_ = nullptr; trk_ = nullptr;
channel_ = 0U; channel_ = 0U;
d_state = 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); 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_acquisition(std::shared_ptr<AcquisitionInterface> acquisition);
void set_tracking(std::shared_ptr<TrackingInterface> tracking); void set_tracking(std::shared_ptr<TrackingInterface> tracking);
void set_telemetry(std::shared_ptr<TelemetryDecoderInterface> telemetry); 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 set_channel(uint32_t channel);
void start_acquisition(); void start_acquisition();
// FSM EVENTS // FSM EVENTS
@ -67,7 +67,7 @@ private:
std::shared_ptr<AcquisitionInterface> acq_; std::shared_ptr<AcquisitionInterface> acq_;
std::shared_ptr<TrackingInterface> trk_; std::shared_ptr<TrackingInterface> trk_;
std::shared_ptr<TelemetryDecoderInterface> nav_; 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 channel_;
uint32_t d_state; uint32_t d_state;
std::mutex mx; std::mutex mx;

View File

@ -55,6 +55,7 @@ set(GNSS_SPLIBS_HEADERS
conjugate_sc.h conjugate_sc.h
conjugate_ic.h conjugate_ic.h
gnss_sdr_create_directory.h gnss_sdr_create_directory.h
gnss_sdr_make_unique.h
gnss_circular_deque.h gnss_circular_deque.h
geofunctions.h geofunctions.h
item_type_helpers.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, SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, 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_item_type = "gr_complex";
std::string default_dump_file = "./data/gen_source.dat"; std::string default_dump_file = "./data/gen_source.dat";

View File

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

View File

@ -40,238 +40,10 @@
#include <utility> #include <utility>
#include <vector> #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, Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream, unsigned int out_stream, 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"); std::string default_gain_mode("slow_attack");
double default_tx_attenuation_db = -10.0; 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) void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block)
{ {
if (top_block) if (top_block)

View File

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

View File

@ -29,7 +29,7 @@
CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream, 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 // DUMP PARAMETERS
std::string empty = ""; std::string empty = "";

View File

@ -48,7 +48,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface
public: public:
CustomUDPSignalSource(ConfigurationInterface* configuration, CustomUDPSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, 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; ~CustomUDPSignalSource() = default;
@ -98,8 +98,6 @@ private:
#endif #endif
Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_; 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 #endif // GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H

View File

@ -33,7 +33,7 @@
FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams, 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_filename = "./example_capture.dat";
std::string default_item_type = "short"; 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]"; 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; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_) if (dump_)

View File

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

View File

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

View File

@ -47,7 +47,7 @@ class FlexibandSignalSource : public GNSSBlockInterface
public: public:
FlexibandSignalSource(ConfigurationInterface* configuration, FlexibandSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, 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; ~FlexibandSignalSource() = default;
@ -94,13 +94,11 @@ private:
int n_channels_; int n_channels_;
int sel_ch_; 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<boost::shared_ptr<gr::block>> char_to_float;
std::vector<std::shared_ptr<gr::block>> float_to_complex_; std::vector<boost::shared_ptr<gr::block>> float_to_complex_;
std::vector<gr::blocks::null_sink::sptr> null_sinks_; 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 #endif // GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H

View File

@ -34,7 +34,7 @@
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration, Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration,
const std::string &role, unsigned int in_stream, unsigned int out_stream, 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_item_type = "gr_complex";
std::string default_dump_file = "./data/signal_source.dat"; std::string default_dump_file = "./data/signal_source.dat";
@ -320,7 +320,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface *configuration
if (samples_ != 0) if (samples_ != 0)
{ {
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
} }

View File

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

View File

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

View File

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

View File

@ -25,7 +25,10 @@
Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, 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_item_type = "short";
std::string default_dump_file = "./data/gn3s_source.dat"; std::string default_dump_file = "./data/gn3s_source.dat";

View File

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

View File

@ -26,7 +26,7 @@
LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, 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_item_type = "gr_complex";
std::string default_dump_file = "./labsat_output.dat"; std::string default_dump_file = "./labsat_output.dat";
@ -42,7 +42,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration,
if (item_type_ == "gr_complex") if (item_type_ == "gr_complex")
{ {
item_size_ = sizeof(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) << "Item size " << item_size_;
DLOG(INFO) << "labsat23_source_(" << labsat23_source_->unique_id() << ")"; DLOG(INFO) << "labsat23_source_(" << labsat23_source_->unique_id() << ")";
} }

View File

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

View File

@ -32,7 +32,7 @@
MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterface* configuration, MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams, 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_filename = "./example_capture.dat";
std::string default_item_type = "short"; 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]"; 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; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (enable_throttle_control_) if (enable_throttle_control_)

View File

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

View File

@ -33,7 +33,7 @@
NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams, 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_filename = "../data/my_capture.dat";
std::string default_item_type = "byte"; 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]"; 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; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_) if (dump_)

View File

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

View File

@ -31,7 +31,7 @@
OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream, 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 // DUMP PARAMETERS
std::string empty = ""; std::string empty = "";
@ -123,7 +123,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration,
if (samples_ != 0) if (samples_ != 0)
{ {
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
} }

View File

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

View File

@ -28,7 +28,7 @@
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream, 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_item_type = "gr_complex";
std::string default_dump_file = "./data/signal_source.dat"; std::string default_dump_file = "./data/signal_source.dat";
@ -135,7 +135,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration
if (samples_ != 0) if (samples_ != 0)
{ {
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples"; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
} }

View File

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

View File

@ -27,7 +27,7 @@
RawArraySignalSource::RawArraySignalSource(ConfigurationInterface* configuration, 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_item_type = "gr_complex";
std::string default_dump_file = "./data/raw_array_source.dat"; std::string default_dump_file = "./data/raw_array_source.dat";

View File

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

View File

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

View File

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

View File

@ -32,7 +32,7 @@
SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration, SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_streams, unsigned int out_streams, 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_filename = "../data/my_capture.dat";
std::string default_item_type = "int"; 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]"; 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; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_) if (dump_)

View File

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

View File

@ -29,7 +29,7 @@
SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, 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_filename = "../data/my_capture.dat";
std::string default_dump_filename = "../data/my_capture_dump.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++) 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_) if (dump_)
{ {
std::string tmp_str = dump_filename_ + "_ch" + std::to_string(i); std::string tmp_str = dump_filename_ + "_ch" + std::to_string(i);

View File

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

View File

@ -34,10 +34,9 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con
const std::string& role, const std::string& role,
unsigned int in_streams, unsigned int in_streams,
unsigned int out_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
in_streams_(in_streams), in_streams_(in_streams),
out_streams_(out_streams), out_streams_(out_streams)
queue_(queue)
{ {
std::string default_filename = "../data/my_capture.dat"; std::string default_filename = "../data/my_capture.dat";
std::string default_item_type = "byte"; 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]"; 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; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_) if (dump_)

View File

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

View File

@ -36,10 +36,9 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac
const std::string& role, const std::string& role,
unsigned int in_streams, unsigned int in_streams,
unsigned int out_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue) : role_(role), Concurrent_Queue<pmt::pmt_t>* queue) : role_(role),
in_streams_(in_streams), in_streams_(in_streams),
out_streams_(out_streams), out_streams_(out_streams)
queue_(queue)
{ {
std::string default_filename = "../data/my_capture.dat"; std::string default_filename = "../data/my_capture.dat";
std::string default_item_type = "byte"; 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]"; 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; 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() << ")"; DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
if (dump_) if (dump_)

View File

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

View File

@ -31,7 +31,7 @@
UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
const std::string& role, unsigned int in_stream, unsigned int out_stream, 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 // DUMP PARAMETERS
std::string empty = ""; std::string empty = "";
@ -204,7 +204,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration,
if (samples_.at(i) != 0ULL) if (samples_.at(i) != 0ULL)
{ {
LOG(INFO) << "RF_channel " << i << " Send STOP signal after " << samples_.at(i) << " samples"; 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() << ")"; DLOG(INFO) << "valve(" << valve_.at(i)->unique_id() << ")";
} }

View File

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

View File

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

View File

@ -43,7 +43,7 @@ using labsat23_source_sptr = boost::shared_ptr<labsat23_source>;
labsat23_source_sptr labsat23_make_source_sptr( labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename, const char *signal_file_basename,
int channel_selector, 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 * \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( friend labsat23_source_sptr labsat23_make_source_sptr(
const char *signal_file_basename, const char *signal_file_basename,
int channel_selector, 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, labsat23_source(const char *signal_file_basename,
int channel_selector, int channel_selector,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); Concurrent_Queue<pmt::pmt_t> *queue);
std::string generate_filename(); std::string generate_filename();
void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type); void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type);
@ -77,10 +77,10 @@ private:
int d_current_file_number; int d_current_file_number;
uint8_t d_labsat_version; uint8_t d_labsat_version;
std::string d_signal_file_basename; std::string d_signal_file_basename;
std::ifstream *binary_input_file; std::ifstream binary_input_file;
uint8_t d_ref_clock; uint8_t d_ref_clock;
uint8_t d_bits_per_sample; 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 #endif // GNSS_SDR_LABSAT23_SOURCE_H

View File

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

View File

@ -31,42 +31,43 @@
Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item, Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems, 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", 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),
gr::io_signature::make(1, 20, sizeof_stream_item)), gr::io_signature::make(1, 20, sizeof_stream_item)),
d_nitems(nitems), d_nitems(nitems),
d_ncopied_items(0), d_ncopied_items(0),
d_queue(std::move(queue)), d_queue(queue),
d_stop_flowgraph(stop_flowgraph) d_stop_flowgraph(stop_flowgraph)
{ {
d_open_valve = false; d_open_valve = false;
} }
#if GNURADIO_USES_STD_POINTERS #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_; 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_; return valve_;
} }
#else #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_; 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_; return valve_;
} }
#endif #endif
@ -79,8 +80,8 @@ void Gnss_Sdr_Valve::open_valve()
int Gnss_Sdr_Valve::work(int noutput_items, int Gnss_Sdr_Valve::work(int noutput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star& input_items,
gr_vector_void_star &output_items) gr_vector_void_star& output_items)
{ {
if (d_open_valve == false) 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( std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, 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( std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph); bool stop_flowgraph);
#else #else
boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve( boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, 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( boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph); bool stop_flowgraph);
#endif #endif
@ -71,40 +71,40 @@ public:
void open_valve(); void open_valve();
int work(int noutput_items, int work(int noutput_items,
gr_vector_const_void_star &input_items, gr_vector_const_void_star& input_items,
gr_vector_void_star &output_items); gr_vector_void_star& output_items);
private: private:
#if GNURADIO_USES_STD_POINTERS #if GNURADIO_USES_STD_POINTERS
friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve( friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, 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( friend std::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph); bool stop_flowgraph);
#else #else
friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve( friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, 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( friend boost::shared_ptr<Gnss_Sdr_Valve> gnss_sdr_make_valve(
size_t sizeof_stream_item, size_t sizeof_stream_item,
uint64_t nitems, uint64_t nitems,
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, Concurrent_Queue<pmt::pmt_t>* queue,
bool stop_flowgraph); bool stop_flowgraph);
#endif #endif
Gnss_Sdr_Valve(size_t sizeof_stream_item, Gnss_Sdr_Valve(size_t sizeof_stream_item,
uint64_t nitems, 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_nitems;
uint64_t d_ncopied_items; 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_stop_flowgraph;
bool d_open_valve; bool d_open_valve;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -4,14 +4,15 @@
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* Javier Arribas, 2011. jarribas(at)cttc.es * Javier Arribas, 2011. jarribas(at)cttc.es
* Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es
* *
* This class encapsulates the complexity behind the instantiation * This class encapsulates the complexity behind the instantiation
* of GNSS blocks. * of GNSS blocks.
* *
* -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) * -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -20,7 +21,7 @@
* *
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* ------------------------------------------------------------------------- * -----------------------------------------------------------------------------
*/ */
#ifndef GNSS_SDR_BLOCK_FACTORY_H #ifndef GNSS_SDR_BLOCK_FACTORY_H
@ -28,7 +29,7 @@
#include "concurrent_queue.h" #include "concurrent_queue.h"
#include <pmt/pmt.h> #include <pmt/pmt.h>
#include <memory> // for unique_ptr, shared_ptr #include <memory> // for unique_ptr
#include <string> // for string #include <string> // for string
#include <vector> // for vector #include <vector> // for vector
@ -48,77 +49,77 @@ public:
GNSSBlockFactory() = default; GNSSBlockFactory() = default;
~GNSSBlockFactory() = default; ~GNSSBlockFactory() = default;
std::unique_ptr<GNSSBlockInterface> GetSignalSource(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetSignalSource(ConfigurationInterface* configuration,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue, int ID = -1); // NOLINT(performance-unnecessary-value-param) Concurrent_Queue<pmt::pmt_t>* queue, int ID = -1); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(const std::shared_ptr<ConfigurationInterface>& configuration, int ID = -1); std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(ConfigurationInterface* configuration, int ID = -1);
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> GetChannels(ConfigurationInterface* configuration,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); // NOLINT(performance-unnecessary-value-param) Concurrent_Queue<pmt::pmt_t>* queue); // NOLINT(performance-unnecessary-value-param)
std::unique_ptr<GNSSBlockInterface> GetObservables(const std::shared_ptr<ConfigurationInterface>& configuration); std::unique_ptr<GNSSBlockInterface> GetObservables(ConfigurationInterface* configuration);
std::unique_ptr<GNSSBlockInterface> GetPVT(const std::shared_ptr<ConfigurationInterface>& configuration); std::unique_ptr<GNSSBlockInterface> GetPVT(ConfigurationInterface* configuration);
/*! /*!
* \brief Returns the block with the required configuration and implementation * \brief Returns the block with the required configuration and implementation
*/ */
std::unique_ptr<GNSSBlockInterface> GetBlock(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetBlock(ConfigurationInterface* configuration,
const std::string& role, const std::string& implementation, const std::string& role, const std::string& implementation,
unsigned int in_streams, unsigned int out_streams, unsigned int in_streams, unsigned int out_streams,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = nullptr); // NOLINT(performance-unnecessary-value-param) Concurrent_Queue<pmt::pmt_t>* queue = nullptr); // NOLINT(performance-unnecessary-value-param)
private: private:
std::unique_ptr<GNSSBlockInterface> GetChannel_1C(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_1C(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_2S(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_2S(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_1B(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_1B(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_5X(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_5X(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_L5(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_L5(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_1G(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_1G(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_2G(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_2G(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_B1(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_B1(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<GNSSBlockInterface> GetChannel_B3(const std::shared_ptr<ConfigurationInterface>& configuration, std::unique_ptr<GNSSBlockInterface> GetChannel_B3(ConfigurationInterface* configuration,
const std::string& acq, const std::string& trk, const std::string& tlm, int channel, const std::string& acq, const std::string& trk, const std::string& tlm, int channel,
const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>>& queue); Concurrent_Queue<pmt::pmt_t>* queue);
std::unique_ptr<AcquisitionInterface> GetAcqBlock( std::unique_ptr<AcquisitionInterface> GetAcqBlock(
const std::shared_ptr<ConfigurationInterface>& configuration, ConfigurationInterface* configuration,
const std::string& role, const std::string& role,
const std::string& implementation, unsigned int in_streams, const std::string& implementation, unsigned int in_streams,
unsigned int out_streams); unsigned int out_streams);
std::unique_ptr<TrackingInterface> GetTrkBlock( std::unique_ptr<TrackingInterface> GetTrkBlock(
const std::shared_ptr<ConfigurationInterface>& configuration, ConfigurationInterface* configuration,
const std::string& role, const std::string& role,
const std::string& implementation, unsigned int in_streams, const std::string& implementation, unsigned int in_streams,
unsigned int out_streams); unsigned int out_streams);
std::unique_ptr<TelemetryDecoderInterface> GetTlmBlock( std::unique_ptr<TelemetryDecoderInterface> GetTlmBlock(
const std::shared_ptr<ConfigurationInterface>& configuration, ConfigurationInterface* configuration,
const std::string& role, const std::string& role,
const std::string& implementation, unsigned int in_streams, const std::string& implementation, unsigned int in_streams,
unsigned int out_streams); unsigned int out_streams);

View File

@ -3,13 +3,14 @@
* \brief Implementation of a GNSS receiver flow graph * \brief Implementation of a GNSS receiver flow graph
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2012. luis(at)epsilon-formacion.com * Luis Esteve, 2012. luis(at)epsilon-formacion.com
* Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es
* Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
* Javier Arribas, 2018. javiarribas(at)gmail.com * Javier Arribas, 2018. javiarribas(at)gmail.com
* *
*
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -34,6 +35,7 @@
#include "gnss_block_factory.h" #include "gnss_block_factory.h"
#include "gnss_block_interface.h" #include "gnss_block_interface.h"
#include "gnss_satellite.h" #include "gnss_satellite.h"
#include "gnss_sdr_make_unique.h"
#include "gnss_synchro_monitor.h" #include "gnss_synchro_monitor.h"
#include <boost/lexical_cast.hpp> // for boost::lexical_cast #include <boost/lexical_cast.hpp> // for boost::lexical_cast
#include <boost/tokenizer.hpp> // for boost::tokenizer #include <boost/tokenizer.hpp> // for boost::tokenizer
@ -52,7 +54,10 @@
#include <memory> // for std::shared_ptr #include <memory> // for std::shared_ptr
#include <set> // for set #include <set> // for set
#include <stdexcept> // for invalid_argument #include <stdexcept> // for invalid_argument
#include <thread> // for thread #include <thread> // for std::thread
#include <utility> // for std::move
#ifdef GR_GREATER_38 #ifdef GR_GREATER_38
#include <gnuradio/filter/fir_filter_blk.h> #include <gnuradio/filter/fir_filter_blk.h>
#else #else
@ -63,12 +68,12 @@
#define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8 #define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8
GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) // NOLINT(performance-unnecessary-value-param) GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue) // NOLINT(performance-unnecessary-value-param)
{ {
connected_ = false; connected_ = false;
running_ = false; running_ = false;
configuration_ = std::move(configuration); configuration_ = std::move(configuration);
queue_ = queue; queue_ = std::move(queue);
multiband_ = GNSSFlowgraph::is_multiband(); multiband_ = GNSSFlowgraph::is_multiband();
init(); init();
} }
@ -1482,7 +1487,7 @@ void GNSSFlowgraph::init()
/* /*
* Instantiates the receiver blocks * Instantiates the receiver blocks
*/ */
std::unique_ptr<GNSSBlockFactory> block_factory_(new GNSSBlockFactory()); auto block_factory_ = std::make_unique<GNSSBlockFactory>();
channels_status_ = channel_status_msg_receiver_make(); channels_status_ = channel_status_msg_receiver_make();
@ -1497,7 +1502,7 @@ void GNSSFlowgraph::init()
for (int i = 0; i < sources_count_; i++) for (int i = 0; i < sources_count_; i++)
{ {
std::cout << "Creating source " << i << std::endl; std::cout << "Creating source " << i << std::endl;
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, i)); sig_source_.push_back(block_factory_->GetSignalSource(configuration_.get(), queue_.get(), i));
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface. // TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
// Include GetRFChannels in the interface to avoid read config parameters here // Include GetRFChannels in the interface to avoid read config parameters here
// read the number of RF channels for each front-end // read the number of RF channels for each front-end
@ -1505,7 +1510,7 @@ void GNSSFlowgraph::init()
std::cout << "RF Channels " << RF_Channels << std::endl; std::cout << "RF Channels " << RF_Channels << std::endl;
for (int j = 0; j < RF_Channels; j++) for (int j = 0; j < RF_Channels; j++)
{ {
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, signal_conditioner_ID)); sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
signal_conditioner_ID++; signal_conditioner_ID++;
} }
} }
@ -1513,7 +1518,7 @@ void GNSSFlowgraph::init()
else else
{ {
// backwards compatibility for old config files // backwards compatibility for old config files
sig_source_.push_back(block_factory_->GetSignalSource(configuration_, queue_, -1)); sig_source_.push_back(block_factory_->GetSignalSource(configuration_.get(), queue_.get(), -1));
// TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface. // TODO: Create a class interface for SignalSources, derived from GNSSBlockInterface.
// Include GetRFChannels in the interface to avoid read config parameters here // Include GetRFChannels in the interface to avoid read config parameters here
// read the number of RF channels for each front-end // read the number of RF channels for each front-end
@ -1522,18 +1527,18 @@ void GNSSFlowgraph::init()
{ {
for (int j = 0; j < RF_Channels; j++) for (int j = 0; j < RF_Channels; j++)
{ {
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, signal_conditioner_ID)); sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_.get(), signal_conditioner_ID));
signal_conditioner_ID++; signal_conditioner_ID++;
} }
} }
else else
{ {
// old config file, single signal source and single channel, not specified // old config file, single signal source and single channel, not specified
sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_, -1)); sig_conditioner_.push_back(block_factory_->GetSignalConditioner(configuration_.get(), -1));
} }
} }
observables_ = block_factory_->GetObservables(configuration_); observables_ = block_factory_->GetObservables(configuration_.get());
// Mark old implementations as deprecated // Mark old implementations as deprecated
std::string default_str("Default"); std::string default_str("Default");
std::string obs_implementation = configuration_->property("Observables.implementation", default_str); std::string obs_implementation = configuration_->property("Observables.implementation", default_str);
@ -1544,7 +1549,7 @@ void GNSSFlowgraph::init()
std::cout << "Please update your configuration file." << std::endl; std::cout << "Please update your configuration file." << std::endl;
} }
pvt_ = block_factory_->GetPVT(configuration_); pvt_ = block_factory_->GetPVT(configuration_.get());
// Mark old implementations as deprecated // Mark old implementations as deprecated
std::string pvt_implementation = configuration_->property("PVT.implementation", default_str); std::string pvt_implementation = configuration_->property("PVT.implementation", default_str);
if ((pvt_implementation == "GPS_L1_CA_PVT") || (pvt_implementation == "Galileo_E1_PVT") || (pvt_implementation == "Hybrid_PVT")) if ((pvt_implementation == "GPS_L1_CA_PVT") || (pvt_implementation == "Galileo_E1_PVT") || (pvt_implementation == "Hybrid_PVT"))
@ -1553,7 +1558,7 @@ void GNSSFlowgraph::init()
std::cout << "Please update your configuration file." << std::endl; std::cout << "Please update your configuration file." << std::endl;
} }
std::shared_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = block_factory_->GetChannels(configuration_, queue_); auto channels = block_factory_->GetChannels(configuration_.get(), queue_.get());
channels_count_ = channels->size(); channels_count_ = channels->size();
for (unsigned int i = 0; i < channels_count_; i++) for (unsigned int i = 0; i < channels_count_; i++)

View File

@ -3,15 +3,16 @@
* \brief Interface of a GNSS receiver flow graph. * \brief Interface of a GNSS receiver flow graph.
* \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com
* Luis Esteve, 2011. luis(at)epsilon-formacion.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com
* Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es * Carles Fernandez-Prades, 2014-2020. cfernandez(at)cttc.es
* Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com
* *
* It contains a signal source, * It contains a signal source,
* a signal conditioner, a set of channels, an observables block and a pvt. * a signal conditioner, a set of channels, an observables block and a pvt.
* *
* -------------------------------------------------------------------------
* *
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) * -----------------------------------------------------------------------------
*
* Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
* *
* GNSS-SDR is a software defined Global Navigation * GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver * Satellite Systems receiver
@ -20,7 +21,7 @@
* *
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* *
* ------------------------------------------------------------------------- * -----------------------------------------------------------------------------
*/ */
#ifndef GNSS_SDR_GNSS_FLOWGRAPH_H #ifndef GNSS_SDR_GNSS_FLOWGRAPH_H
@ -61,7 +62,7 @@ public:
/*! /*!
* \brief Constructor that initializes the receiver flow graph * \brief Constructor that initializes the receiver flow graph
*/ */
GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, const std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); // NOLINT(performance-unnecessary-value-param) GNSSFlowgraph(std::shared_ptr<ConfigurationInterface> configuration, std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue); // NOLINT(performance-unnecessary-value-param)
/*! /*!
* \brief Destructor * \brief Destructor

View File

@ -27,6 +27,7 @@ endif()
target_link_libraries(gnss-sdr target_link_libraries(gnss-sdr
PRIVATE PRIVATE
algorithms_libs
core_receiver core_receiver
Boost::headers Boost::headers
Boost::thread Boost::thread

View File

@ -31,6 +31,7 @@
#include "concurrent_map.h" #include "concurrent_map.h"
#include "concurrent_queue.h" #include "concurrent_queue.h"
#include "control_thread.h" #include "control_thread.h"
#include "gnss_sdr_make_unique.h"
#include "gps_acq_assist.h" #include "gps_acq_assist.h"
#include <boost/exception/diagnostic_information.hpp> // for diagnostic_information #include <boost/exception/diagnostic_information.hpp> // for diagnostic_information
#include <boost/exception/exception.hpp> // for exception #include <boost/exception/exception.hpp> // for exception
@ -139,7 +140,7 @@ int main(int argc, char** argv)
int return_code = 0; int return_code = 0;
try try
{ {
std::unique_ptr<ControlThread> control_thread(new ControlThread()); auto control_thread = std::make_unique<ControlThread>();
// record startup time // record startup time
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
return_code = control_thread->run(); return_code = control_thread->run();

View File

@ -20,19 +20,14 @@
#include "gnss_signal_processing.h" #include "gnss_signal_processing.h"
#include "gps_sdr_signal_processing.h" #include "gps_sdr_signal_processing.h"
#include <array>
#include <chrono> #include <chrono>
#include <complex> #include <complex>
#include <vector>
#if HAS_STD_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
TEST(CodeGenerationTest, CodeGenGPSL1Test) TEST(CodeGenerationTest, CodeGenGPSL1Test)
{ {
auto* _dest = new std::complex<float>[1023]; std::array<std::complex<float>, 1023> _dest{};
signed int _prn = 1; signed int _prn = 1;
unsigned int _chip_shift = 4; unsigned int _chip_shift = 4;
@ -43,13 +38,12 @@ TEST(CodeGenerationTest, CodeGenGPSL1Test)
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
gps_l1_ca_code_gen_complex(own::span<std::complex<float>>(_dest, 1023), _prn, _chip_shift); gps_l1_ca_code_gen_complex(_dest, _prn, _chip_shift);
} }
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;
delete[] _dest;
ASSERT_LE(0, elapsed_seconds.count()); ASSERT_LE(0, elapsed_seconds.count());
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
} }
@ -63,7 +57,7 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
const signed int _codeFreqBasis = 1023000; // Hz const signed int _codeFreqBasis = 1023000; // Hz
const signed int _codeLength = 1023; const signed int _codeLength = 1023;
int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength)); int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength));
auto* _dest = new std::complex<float>[_samplesPerCode]; std::vector<std::complex<float>> _dest(_samplesPerCode);
int iterations = 1000; int iterations = 1000;
@ -72,13 +66,12 @@ TEST(CodeGenerationTest, CodeGenGPSL1SampledTest)
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
gps_l1_ca_code_gen_complex_sampled(own::span<std::complex<float>>(_dest, _samplesPerCode), _prn, _fs, _chip_shift); gps_l1_ca_code_gen_complex_sampled(_dest, _prn, _fs, _chip_shift);
} }
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;
delete[] _dest;
ASSERT_LE(0, elapsed_seconds.count()); ASSERT_LE(0, elapsed_seconds.count());
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
} }
@ -91,7 +84,7 @@ TEST(CodeGenerationTest, ComplexConjugateTest)
const signed int _codeFreqBasis = 1023000; // Hz const signed int _codeFreqBasis = 1023000; // Hz
const signed int _codeLength = 1023; const signed int _codeLength = 1023;
int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength)); int _samplesPerCode = round(_fs / static_cast<double>(_codeFreqBasis / _codeLength));
auto* _dest = new std::complex<float>[_samplesPerCode]; std::vector<std::complex<float>> _dest(_samplesPerCode);
int iterations = 1000; int iterations = 1000;
@ -100,13 +93,12 @@ TEST(CodeGenerationTest, ComplexConjugateTest)
for (int i = 0; i < iterations; i++) for (int i = 0; i < iterations; i++)
{ {
complex_exp_gen_conj(own::span<std::complex<float>>(_dest, _samplesPerCode), _f, _fs); complex_exp_gen_conj(_dest, _f, _fs);
} }
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;
delete[] _dest;
ASSERT_LE(0, elapsed_seconds.count()); ASSERT_LE(0, elapsed_seconds.count());
std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; std::cout << "Generation completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
} }

View File

@ -24,12 +24,6 @@
#include <chrono> #include <chrono>
#include <complex> #include <complex>
#if HAS_STD_SPAN
#include <span>
namespace gsl = std;
#else
#include <gsl/gsl>
#endif
DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing");
@ -110,13 +104,14 @@ TEST(ComplexCarrierTest, C11ComplexImplementation)
TEST(ComplexCarrierTest, OwnComplexImplementation) TEST(ComplexCarrierTest, OwnComplexImplementation)
{ {
auto* output = new std::complex<float>[FLAGS_size_carrier_test]; std::vector<std::complex<float>> output(FLAGS_size_carrier_test);
double _f = 2000.0; double _f = 2000.0;
double _fs = 2000000.0; double _fs = 2000000.0;
std::chrono::time_point<std::chrono::system_clock> start, end; std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
complex_exp_gen(own::span<std::complex<float>>(output, static_cast<unsigned int>(FLAGS_size_carrier_test)), _f, _fs); complex_exp_gen(output, _f, _fs);
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
std::chrono::duration<double> elapsed_seconds = end - start; std::chrono::duration<double> elapsed_seconds = end - start;
@ -130,7 +125,7 @@ TEST(ComplexCarrierTest, OwnComplexImplementation)
{ {
mag[i] = output[i] * std::conj(output[i]); mag[i] = output[i] * std::conj(output[i]);
} }
delete[] output;
for (int i = 0; i < FLAGS_size_carrier_test; i++) for (int i = 0; i < FLAGS_size_carrier_test; i++)
{ {
ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001); ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001);

View File

@ -18,6 +18,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "gnss_sdr_make_unique.h"
#include "gnuplot_i.h" #include "gnuplot_i.h"
#include "test_flags.h" #include "test_flags.h"
#include <gnuradio/fft/fft.h> #include <gnuradio/fft/fft.h>
@ -72,9 +73,8 @@ TEST(FFTLengthTest, MeasureExecutionTime)
EXPECT_NO_THROW( EXPECT_NO_THROW(
for (it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it) { for (it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it) {
gr::fft::fft_complex* d_fft;
d_fft_size = *it; d_fft_size = *it;
d_fft = new gr::fft::fft_complex(d_fft_size, true); auto d_fft = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
std::generate_n(d_fft->get_inbuf(), d_fft_size, gen); std::generate_n(d_fft->get_inbuf(), d_fft_size, gen);
@ -88,7 +88,6 @@ TEST(FFTLengthTest, MeasureExecutionTime)
double exec_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_iterations_test); double exec_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_iterations_test);
execution_times.push_back(exec_time * 1e3); execution_times.push_back(exec_time * 1e3);
std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]" << std::endl; std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]" << std::endl;
delete d_fft;
if ((d_fft_size & (d_fft_size - 1)) == 0) // if it is a power of two if ((d_fft_size & (d_fft_size - 1)) == 0) // if it is a power of two
{ {

View File

@ -19,6 +19,7 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "gnss_sdr_make_unique.h"
#include <armadillo> #include <armadillo>
#include <gnuradio/fft/fft.h> #include <gnuradio/fft/fft.h>
#include <chrono> #include <chrono>
@ -38,8 +39,7 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime)
for (unsigned int fft_size for (unsigned int fft_size
: fft_sizes) { : fft_sizes) {
d_fft_size = fft_size; d_fft_size = fft_size;
gr::fft::fft_complex* d_gr_fft; auto d_gr_fft = std::make_unique<gr::fft::fft_complex>(d_fft_size, true);
d_gr_fft = new gr::fft::fft_complex(d_fft_size, true);
arma::arma_rng::set_seed_random(); arma::arma_rng::set_seed_random();
arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn(); arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn();
arma::cx_fvec d_arma_fft_result(d_fft_size); arma::cx_fvec d_arma_fft_result(d_fft_size);
@ -54,7 +54,6 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime)
elapsed_seconds = end - start; elapsed_seconds = end - start;
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test); d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl; std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
delete d_gr_fft;
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++)

View File

@ -19,6 +19,7 @@
*/ */
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include <algorithm>
#include <array> #include <array>
#include <chrono> #include <chrono>
#include <cstdint> #include <cstdint>
@ -44,10 +45,8 @@ TEST(PreambleCorrelationTest, TestMethods)
std::random_device rd; std::random_device rd;
std::default_random_engine e2(rd()); std::default_random_engine e2(rd());
std::uniform_real_distribution<> dist(-1.0, 1.0); std::uniform_real_distribution<> dist(-1.0, 1.0);
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
{ std::generate(d_symbol_history.begin(), d_symbol_history.end(), [&dist, &e2]() { return dist(e2); });
d_symbol_history[i] = dist(e2);
}
int32_t n = 0; int32_t n = 0;
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++) for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)

View File

@ -24,6 +24,7 @@
#include "command_event.h" #include "command_event.h"
#include "concurrent_queue.h" #include "concurrent_queue.h"
#include "control_thread.h" #include "control_thread.h"
#include "gnss_sdr_make_unique.h"
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
#include <boost/exception/diagnostic_information.hpp> #include <boost/exception/diagnostic_information.hpp>
#include <boost/exception_ptr.hpp> #include <boost/exception_ptr.hpp>
@ -167,7 +168,7 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages2 /*unused*/)
config->set_property("PVT.item_type", "gr_complex"); config->set_property("PVT.item_type", "gr_complex");
config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
std::unique_ptr<ControlThread> control_thread2(new ControlThread(config)); auto control_thread2 = std::make_unique<ControlThread>(config);
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue2 = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue2 = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
control_queue2->push(pmt::make_any(channel_event_make(0, 0))); control_queue2->push(pmt::make_any(channel_event_make(0, 0)));
@ -176,7 +177,6 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages2 /*unused*/)
control_queue2->push(pmt::make_any(channel_event_make(3, 0))); control_queue2->push(pmt::make_any(channel_event_make(3, 0)));
control_queue2->push(pmt::make_any(command_event_make(200, 0))); control_queue2->push(pmt::make_any(command_event_make(200, 0)));
control_thread2->set_control_queue(control_queue2); control_thread2->set_control_queue(control_queue2);
try try

View File

@ -20,6 +20,7 @@
#include "file_configuration.h" #include "file_configuration.h"
#include "gnss_sdr_make_unique.h"
#include <string> #include <string>
@ -28,7 +29,7 @@ TEST(FileConfigurationTest, OverridedProperties)
std::string path = std::string(TEST_PATH); std::string path = std::string(TEST_PATH);
std::string filename = path + "data/config_file_sample.txt"; std::string filename = path + "data/config_file_sample.txt";
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<FileConfiguration>(filename); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<FileConfiguration>(filename);
std::unique_ptr<ConfigurationInterface> configuration(new FileConfiguration(filename)); std::unique_ptr<ConfigurationInterface> configuration = std::make_unique<FileConfiguration>(filename);
std::string default_value = "default_value"; std::string default_value = "default_value";
std::string value = configuration->property("NotThere", default_value); std::string value = configuration->property("NotThere", default_value);
EXPECT_STREQ("default_value", value.c_str()); EXPECT_STREQ("default_value", value.c_str());
@ -40,7 +41,7 @@ TEST(FileConfigurationTest, OverridedProperties)
TEST(FileConfigurationTest, LoadFromNonExistentFile) TEST(FileConfigurationTest, LoadFromNonExistentFile)
{ {
std::unique_ptr<ConfigurationInterface> configuration(new FileConfiguration("./i_dont_exist.conf")); std::unique_ptr<ConfigurationInterface> configuration = std::make_unique<FileConfiguration>("./i_dont_exist.conf");
std::string default_value = "default_value"; std::string default_value = "default_value";
std::string value = configuration->property("whatever.whatever", default_value); std::string value = configuration->property("whatever.whatever", default_value);
EXPECT_STREQ("default_value", value.c_str()); EXPECT_STREQ("default_value", value.c_str());
@ -51,7 +52,7 @@ TEST(FileConfigurationTest, PropertyDoesNotExist)
{ {
std::string path = std::string(TEST_PATH); std::string path = std::string(TEST_PATH);
std::string filename = path + "data/config_file_sample.txt"; std::string filename = path + "data/config_file_sample.txt";
std::unique_ptr<ConfigurationInterface> configuration(new FileConfiguration(filename)); std::unique_ptr<ConfigurationInterface> configuration = std::make_unique<FileConfiguration>(filename);
std::string default_value = "default_value"; std::string default_value = "default_value";
std::string value = configuration->property("whatever.whatever", default_value); std::string value = configuration->property("whatever.whatever", default_value);
EXPECT_STREQ("default_value", value.c_str()); EXPECT_STREQ("default_value", value.c_str());

View File

@ -47,7 +47,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource)
// Example of a factory as a shared_ptr // Example of a factory as a shared_ptr
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>(); std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
// Example of a block as a shared_ptr // Example of a block as a shared_ptr
std::shared_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration, queue); std::shared_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
EXPECT_STREQ("SignalSource", signal_source->role().c_str()); EXPECT_STREQ("SignalSource", signal_source->role().c_str());
EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str()); EXPECT_STREQ("File_Signal_Source", signal_source->implementation().c_str());
} }
@ -61,7 +61,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongSignalSource)
// Example of a factory as a unique_ptr // Example of a factory as a unique_ptr
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
// Example of a block as a unique_ptr // Example of a block as a unique_ptr
std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration, queue); std::unique_ptr<GNSSBlockInterface> signal_source = factory->GetSignalSource(configuration.get(), queue.get());
EXPECT_EQ(nullptr, signal_source); EXPECT_EQ(nullptr, signal_source);
} }
@ -71,7 +71,7 @@ TEST(GNSSBlockFactoryTest, InstantiateSignalConditioner)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner"); configuration->set_property("SignalConditioner.implementation", "Signal_Conditioner");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> signal_conditioner = factory->GetSignalConditioner(configuration); std::unique_ptr<GNSSBlockInterface> signal_conditioner = factory->GetSignalConditioner(configuration.get());
EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str()); EXPECT_STREQ("SignalConditioner", signal_conditioner->role().c_str());
EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str()); EXPECT_STREQ("Signal_Conditioner", signal_conditioner->implementation().c_str());
} }
@ -104,7 +104,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFIRFilter)
configuration->set_property("InputFilter.grid_density", "16"); configuration->set_property("InputFilter.grid_density", "16");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Fir_Filter", 1, 1); std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Fir_Filter", 1, 1);
EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str()); EXPECT_STREQ("Fir_Filter", input_filter->implementation().c_str());
@ -139,7 +139,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFreqXlatingFIRFilter)
configuration->set_property("InputFilter.sampling_frequency", "4000000"); configuration->set_property("InputFilter.sampling_frequency", "4000000");
configuration->set_property("InputFilter.IF", "34000"); configuration->set_property("InputFilter.IF", "34000");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Freq_Xlating_Fir_Filter", 1, 1); std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Freq_Xlating_Fir_Filter", 1, 1);
EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Freq_Xlating_Fir_Filter", input_filter->implementation().c_str()); EXPECT_STREQ("Freq_Xlating_Fir_Filter", input_filter->implementation().c_str());
@ -152,7 +152,7 @@ TEST(GNSSBlockFactoryTest, InstantiatePulseBlankingFilter)
configuration->set_property("InputFilter.implementation", "Pulse_Blanking_Filter"); configuration->set_property("InputFilter.implementation", "Pulse_Blanking_Filter");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Pulse_Blanking_Filter", 1, 1); std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Pulse_Blanking_Filter", 1, 1);
EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Pulse_Blanking_Filter", input_filter->implementation().c_str()); EXPECT_STREQ("Pulse_Blanking_Filter", input_filter->implementation().c_str());
@ -165,7 +165,7 @@ TEST(GNSSBlockFactoryTest, InstantiateNotchFilter)
configuration->set_property("InputFilter.implementation", "Notch_Filter"); configuration->set_property("InputFilter.implementation", "Notch_Filter");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter", 1, 1); std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Notch_Filter", 1, 1);
EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Notch_Filter", input_filter->implementation().c_str()); EXPECT_STREQ("Notch_Filter", input_filter->implementation().c_str());
@ -178,7 +178,7 @@ TEST(GNSSBlockFactoryTest, InstantiateNotchFilterLite)
configuration->set_property("InputFilter.implementation", "Notch_Filter_Lite"); configuration->set_property("InputFilter.implementation", "Notch_Filter_Lite");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter_Lite", 1, 1); std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration.get(), "InputFilter", "Notch_Filter_Lite", 1, 1);
EXPECT_STREQ("InputFilter", input_filter->role().c_str()); EXPECT_STREQ("InputFilter", input_filter->role().c_str());
EXPECT_STREQ("Notch_Filter_Lite", input_filter->implementation().c_str()); EXPECT_STREQ("Notch_Filter_Lite", input_filter->implementation().c_str());
@ -189,7 +189,7 @@ TEST(GNSSBlockFactoryTest, InstantiateDirectResampler)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Resampler.implementation", "Direct_Resampler"); configuration->set_property("Resampler.implementation", "Direct_Resampler");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> resampler = factory->GetBlock(configuration, "Resampler", "Direct_Resampler", 1, 1); std::unique_ptr<GNSSBlockInterface> resampler = factory->GetBlock(configuration.get(), "Resampler", "Direct_Resampler", 1, 1);
EXPECT_STREQ("Resampler", resampler->role().c_str()); EXPECT_STREQ("Resampler", resampler->role().c_str());
EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str()); EXPECT_STREQ("Direct_Resampler", resampler->implementation().c_str());
} }
@ -199,7 +199,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsAcquisition)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Acquisition", acquisition->role().c_str());
EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str()); EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str());
@ -211,7 +211,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsQuickSyncAcquisition)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>(); std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Acquisition", acquisition->role().c_str());
EXPECT_STREQ("GPS_L1_CA_PCPS_QuickSync_Acquisition", acquisition->implementation().c_str()); EXPECT_STREQ("GPS_L1_CA_PCPS_QuickSync_Acquisition", acquisition->implementation().c_str());
@ -222,7 +222,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsQuickSyncAmbiguousAcquisition
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>(); std::shared_ptr<GNSSBlockFactory> factory = std::make_shared<GNSSBlockFactory>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Acquisition", acquisition->role().c_str());
EXPECT_STREQ("Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", acquisition->implementation().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", acquisition->implementation().c_str());
@ -234,7 +234,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsAmbiguousAcquisition)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(configuration.get(), "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Acquisition", acquisition->role().c_str());
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
@ -246,7 +246,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaDllPllTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); configuration->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1); std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration.get(), "Tracking", "GPS_L1_CA_DLL_PLL_Tracking", 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str()); EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str()); EXPECT_STREQ("GPS_L1_CA_DLL_PLL_Tracking", tracking->implementation().c_str());
@ -258,7 +258,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaTcpConnectorTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking"); configuration->set_property("Tracking.implementation", "GPS_L1_CA_TCP_CONNECTOR_Tracking");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1); std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration.get(), "Tracking", "GPS_L1_CA_TCP_CONNECTOR_Tracking", 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str()); EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str()); EXPECT_STREQ("GPS_L1_CA_TCP_CONNECTOR_Tracking", tracking->implementation().c_str());
@ -270,7 +270,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1DllPllVemlTracking)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); configuration->set_property("Tracking.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1); std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(configuration.get(), "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_); std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
EXPECT_STREQ("Tracking", tracking->role().c_str()); EXPECT_STREQ("Tracking", tracking->role().c_str());
EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str()); EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
@ -282,7 +282,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaTelemetryDecoder)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); configuration->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> telemetry_decoder = factory->GetBlock(configuration, "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1); std::shared_ptr<GNSSBlockInterface> telemetry_decoder = factory->GetBlock(configuration.get(), "TelemetryDecoder", "GPS_L1_CA_Telemetry_Decoder", 1, 1);
EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str()); EXPECT_STREQ("TelemetryDecoder", telemetry_decoder->role().c_str());
EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str()); EXPECT_STREQ("GPS_L1_CA_Telemetry_Decoder", telemetry_decoder->implementation().c_str());
} }
@ -301,7 +301,7 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels)
configuration->set_property("Channel1.item_type", "gr_complex"); configuration->set_property("Channel1.item_type", "gr_complex");
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = factory->GetChannels(configuration, queue); std::unique_ptr<std::vector<std::unique_ptr<GNSSBlockInterface>>> channels = factory->GetChannels(configuration.get(), queue.get());
EXPECT_EQ(static_cast<unsigned int>(2), channels->size()); EXPECT_EQ(static_cast<unsigned int>(2), channels->size());
channels->erase(channels->begin(), channels->end()); channels->erase(channels->begin(), channels->end());
} }
@ -312,7 +312,7 @@ TEST(GNSSBlockFactoryTest, InstantiateObservables)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "Pass_Through"); configuration->set_property("Observables.implementation", "Pass_Through");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
auto observables = factory->GetObservables(configuration); auto observables = factory->GetObservables(configuration.get());
EXPECT_STREQ("Observables", observables->role().c_str()); EXPECT_STREQ("Observables", observables->role().c_str());
EXPECT_STREQ("Pass_Through", observables->implementation().c_str()); EXPECT_STREQ("Pass_Through", observables->implementation().c_str());
} }
@ -323,7 +323,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaObservables)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("Observables.implementation", "Hybrid_Observables"); configuration->set_property("Observables.implementation", "Hybrid_Observables");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::unique_ptr<GNSSBlockInterface> observables = factory->GetObservables(configuration); std::unique_ptr<GNSSBlockInterface> observables = factory->GetObservables(configuration.get());
EXPECT_STREQ("Observables", observables->role().c_str()); EXPECT_STREQ("Observables", observables->role().c_str());
EXPECT_STREQ("Hybrid_Observables", observables->implementation().c_str()); EXPECT_STREQ("Hybrid_Observables", observables->implementation().c_str());
} }
@ -334,7 +334,7 @@ TEST(GNSSBlockFactoryTest, InstantiateRTKLIBPvt)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "RTKLIB_PVT"); configuration->set_property("PVT.implementation", "RTKLIB_PVT");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration); std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration.get());
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_); std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
EXPECT_STREQ("PVT", pvt->role().c_str()); EXPECT_STREQ("PVT", pvt->role().c_str());
EXPECT_STREQ("RTKLIB_PVT", pvt->implementation().c_str()); EXPECT_STREQ("RTKLIB_PVT", pvt->implementation().c_str());
@ -346,7 +346,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongPvt)
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
configuration->set_property("PVT.implementation", "Pepito"); configuration->set_property("PVT.implementation", "Pepito");
std::unique_ptr<GNSSBlockFactory> factory; std::unique_ptr<GNSSBlockFactory> factory;
std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration); std::shared_ptr<GNSSBlockInterface> pvt_ = factory->GetPVT(configuration.get());
std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_); std::shared_ptr<PvtInterface> pvt = std::dynamic_pointer_cast<PvtInterface>(pvt_);
EXPECT_EQ(nullptr, pvt); EXPECT_EQ(nullptr, pvt);
} }

View File

@ -19,89 +19,98 @@
*/ */
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_make_unique.h"
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
TEST(InMemoryConfiguration, IsPresent) TEST(InMemoryConfiguration, IsPresent)
{ {
// std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<InMemoryConfiguration> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
EXPECT_FALSE(configuration->is_present("NotThere")); EXPECT_FALSE(configuration->is_present("NotThere"));
configuration->set_property("NotThere", "Yes!"); configuration->set_property("NotThere", "Yes!");
EXPECT_TRUE(configuration->is_present("NotThere")); EXPECT_TRUE(configuration->is_present("NotThere"));
} }
TEST(InMemoryConfiguration, StoreAndRetrieve) TEST(InMemoryConfiguration, StoreAndRetrieve)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
configuration->set_property("Foo.property1", "value"); configuration->set_property("Foo.property1", "value");
std::string default_value = "default_value"; std::string default_value = "default_value";
std::string value = configuration->property("Foo.property1", default_value); std::string value = configuration->property("Foo.property1", default_value);
EXPECT_STREQ("value", value.c_str()); EXPECT_STREQ("value", value.c_str());
} }
TEST(InMemoryConfiguration, NoStoringAndRetrieve) TEST(InMemoryConfiguration, NoStoringAndRetrieve)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
std::string default_value = "default_value"; std::string default_value = "default_value";
std::string value = configuration->property("Foo.property1", default_value); std::string value = configuration->property("Foo.property1", default_value);
EXPECT_STREQ("default_value", value.c_str()); EXPECT_STREQ("default_value", value.c_str());
} }
TEST(InMemoryConfiguration, RetrieveBool) TEST(InMemoryConfiguration, RetrieveBool)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
configuration->set_property("Foo.property1", "true"); configuration->set_property("Foo.property1", "true");
bool value = configuration->property("Foo.property1", false); bool value = configuration->property("Foo.property1", false);
bool expectedtrue = true; bool expectedtrue = true;
EXPECT_EQ(expectedtrue, value); EXPECT_EQ(expectedtrue, value);
} }
TEST(InMemoryConfiguration, RetrieveBoolFail) TEST(InMemoryConfiguration, RetrieveBoolFail)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
configuration->set_property("Foo.property1", "tru"); configuration->set_property("Foo.property1", "tru");
bool value = configuration->property("Foo.property1", false); bool value = configuration->property("Foo.property1", false);
bool expectedfalse = false; bool expectedfalse = false;
EXPECT_EQ(expectedfalse, value); EXPECT_EQ(expectedfalse, value);
} }
TEST(InMemoryConfiguration, RetrieveBoolNoDefine) TEST(InMemoryConfiguration, RetrieveBoolNoDefine)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
bool value = configuration->property("Foo.property1", false); bool value = configuration->property("Foo.property1", false);
bool expectedfalse = false; bool expectedfalse = false;
EXPECT_EQ(expectedfalse, value); EXPECT_EQ(expectedfalse, value);
} }
TEST(InMemoryConfiguration, RetrieveSizeT) TEST(InMemoryConfiguration, RetrieveSizeT)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
configuration->set_property("Foo.property1", "8"); configuration->set_property("Foo.property1", "8");
unsigned int value = configuration->property("Foo.property1", 4); unsigned int value = configuration->property("Foo.property1", 4);
unsigned int expected8 = 8; unsigned int expected8 = 8;
EXPECT_EQ(expected8, value); EXPECT_EQ(expected8, value);
} }
TEST(InMemoryConfiguration, RetrieveSizeTFail) TEST(InMemoryConfiguration, RetrieveSizeTFail)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
configuration->set_property("Foo.property1", "true"); configuration->set_property("Foo.property1", "true");
unsigned int value = configuration->property("Foo.property1", 4); unsigned int value = configuration->property("Foo.property1", 4);
unsigned int expected4 = 4; unsigned int expected4 = 4;
EXPECT_EQ(expected4, value); EXPECT_EQ(expected4, value);
} }
TEST(InMemoryConfiguration, RetrieveSizeTNoDefine) TEST(InMemoryConfiguration, RetrieveSizeTNoDefine)
{ {
// std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>(); // std::shared_ptr<ConfigurationInterface> configuration = std::make_shared<InMemoryConfiguration>();
std::unique_ptr<ConfigurationInterface> configuration(new InMemoryConfiguration); auto configuration = std::make_unique<InMemoryConfiguration>();
unsigned int value = configuration->property("Foo.property1", 4); unsigned int value = configuration->property("Foo.property1", 4);
unsigned int expected4 = 4; unsigned int expected4 = 4;
EXPECT_EQ(expected4, value); EXPECT_EQ(expected4, value);

View File

@ -19,12 +19,13 @@
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#include "gnss_sdr_make_unique.h"
#include "string_converter.h" #include "string_converter.h"
TEST(StringConverterTest, StringToBool) TEST(StringConverterTest, StringToBool)
{ {
std::unique_ptr<StringConverter> converter(new StringConverter()); auto converter = std::make_unique<StringConverter>();
bool conversion_result = converter->convert("false", true); bool conversion_result = converter->convert("false", true);
bool expected_false = false; bool expected_false = false;
EXPECT_EQ(expected_false, conversion_result); EXPECT_EQ(expected_false, conversion_result);
@ -45,7 +46,7 @@ TEST(StringConverterTest, StringToSizeT)
TEST(StringConverterTest, StringToBoolFail) TEST(StringConverterTest, StringToBoolFail)
{ {
std::unique_ptr<StringConverter> converter(new StringConverter()); auto converter = std::make_unique<StringConverter>();
bool conversion_result = converter->convert("lse", true); bool conversion_result = converter->convert("lse", true);
bool expected_true = true; bool expected_true = true;
EXPECT_EQ(expected_true, conversion_result); EXPECT_EQ(expected_true, conversion_result);
@ -54,7 +55,7 @@ TEST(StringConverterTest, StringToBoolFail)
TEST(StringConverterTest, StringToSizeTFail) TEST(StringConverterTest, StringToSizeTFail)
{ {
std::unique_ptr<StringConverter> converter(new StringConverter()); auto converter = std::make_unique<StringConverter>();
size_t conversion_result = converter->convert("false", 1); size_t conversion_result = converter->convert("false", 1);
unsigned int expected1 = 1; unsigned int expected1 = 1;
EXPECT_EQ(expected1, conversion_result); EXPECT_EQ(expected1, conversion_result);

View File

@ -608,7 +608,7 @@ int AcquisitionPerformanceTest::run_receiver()
init(); init();
int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s); int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s);
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
if (implementation == "GPS_L1_CA_PCPS_Acquisition") if (implementation == "GPS_L1_CA_PCPS_Acquisition")
{ {
acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0); acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0);

View File

@ -275,7 +275,7 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ConnectAndRun)
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -274,7 +274,7 @@ TEST_F(BeidouB3iPcpsAcquisitionTest, ConnectAndRun)
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -433,7 +433,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue()
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate) TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate)
{ {
config_1(); config_1();
auto acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); auto acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
} }
@ -447,7 +447,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -474,7 +474,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -497,7 +497,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue.get());
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -528,10 +528,9 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -585,7 +584,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
config_2(); config_2();
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -616,10 +615,9 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -434,7 +434,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue()
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate) TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
{ {
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
} }
@ -448,14 +448,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -477,7 +477,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
config_1(); config_1();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -504,10 +504,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -558,7 +557,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
config_2(); config_2();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -585,10 +584,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -216,7 +216,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue()
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
{ {
init(); init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
} }
@ -232,14 +232,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
init(); init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -263,7 +263,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
init(); init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_); std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);

View File

@ -268,7 +268,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate) TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
{ {
init(); init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
} }
@ -282,14 +282,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
init(); init();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_); std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -324,7 +324,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
double expected_doppler_hz = -632; double expected_doppler_hz = -632;
init(); init();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0);
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_); std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); auto msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();

View File

@ -436,7 +436,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue()
TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate) TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate)
{ {
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
} }
@ -451,14 +451,14 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -480,7 +480,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
config_1(); config_1();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
@ -512,10 +512,9 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
acquisition->reset(); acquisition->reset();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -573,7 +572,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
config_2(); config_2();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
@ -605,10 +604,9 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
acquisition->reset(); acquisition->reset();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -555,7 +555,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue()
TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate) TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate)
{ {
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
} }
@ -571,7 +571,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
@ -580,7 +580,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
auto source = auto source =
gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = auto valve =
gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -606,7 +606,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
@ -638,10 +638,9 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
acquisition->reset(); acquisition->reset();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -697,7 +696,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
@ -729,10 +728,9 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
acquisition->reset(); acquisition->reset();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -785,7 +783,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
@ -816,10 +814,9 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -434,7 +434,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue()
TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate) TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate)
{ {
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
} }
@ -447,13 +447,13 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
config_1(); config_1();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
}) << "Failure connecting the blocks of acquisition test."; }) << "Failure connecting the blocks of acquisition test.";
@ -474,7 +474,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
config_1(); config_1();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -506,10 +506,9 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -563,7 +562,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
config_2(); config_2();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config.get(), "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0);
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_); acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
auto msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); auto msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
@ -594,10 +593,9 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -553,7 +553,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -605,11 +605,10 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
// USING THE SIGNAL GENERATOR // USING THE SIGNAL GENERATOR
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<GenSignalSource> signal_source; std::shared_ptr<GNSSBlockInterface> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<GNSSBlockInterface> filter = std::make_shared<FirFilter>(config.get(), "InputFilter", 1, 1);
FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); std::shared_ptr<GNSSBlockInterface> signal_source = std::make_shared<GenSignalSource>(signal_generator, filter, "SignalSource", queue.get());
filter->connect(top_block); filter->connect(top_block);
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
signal_source->connect(top_block); signal_source->connect(top_block);
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));

View File

@ -149,7 +149,7 @@ protected:
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue; std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> queue;
gr::top_block_sptr top_block; gr::top_block_sptr top_block;
GlonassL1CaPcpsAcquisition* acquisition; std::shared_ptr<GlonassL1CaPcpsAcquisition> acquisition;
std::shared_ptr<InMemoryConfiguration> config; std::shared_ptr<InMemoryConfiguration> config;
Gnss_Synchro gnss_synchro; Gnss_Synchro gnss_synchro;
size_t item_size; size_t item_size;
@ -440,8 +440,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::stop_queue()
TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, Instantiate) TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, Instantiate)
{ {
config_1(); config_1();
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0);
delete acquisition;
} }
@ -454,13 +453,13 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun)
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
config_1(); config_1();
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0);
auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
acquisition->connect(top_block); acquisition->connect(top_block);
auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); auto source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); auto valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue.get());
top_block->connect(source, 0, valve, 0); top_block->connect(source, 0, valve, 0);
top_block->connect(valve, 0, acquisition->get_left_block(), 0); top_block->connect(valve, 0, acquisition->get_left_block(), 0);
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
@ -474,8 +473,6 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun)
}) << "Failure running the top_block."; }) << "Failure running the top_block.";
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
delete acquisition;
} }
@ -485,7 +482,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); acquisition = acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0);
auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
@ -512,7 +509,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1); std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1);
signal_generator->connect(top_block); signal_generator->connect(top_block);
top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0);
@ -559,8 +556,6 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults)
ch_thread.join(); ch_thread.join();
}) << "Failure while waiting the queue to stop"; }) << "Failure while waiting the queue to stop";
} }
delete acquisition;
} }
@ -569,7 +564,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities)
config_2(); config_2();
queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); queue = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
top_block = gr::make_top_block("Acquisition test"); top_block = gr::make_top_block("Acquisition test");
acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); acquisition = std::make_shared<GlonassL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 0);
auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); auto msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue);
ASSERT_NO_THROW({ ASSERT_NO_THROW({
@ -596,7 +591,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities)
acquisition->init(); acquisition->init();
ASSERT_NO_THROW({ ASSERT_NO_THROW({
std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue); std::shared_ptr<SignalGenerator> signal_generator = std::make_shared<SignalGenerator>(config.get(), "SignalSource", 0, 1, queue.get());
std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1); std::shared_ptr<FreqXlatingFirFilter> filter = std::make_shared<FreqXlatingFirFilter>(config.get(), "InputFilter", 1, 1);
signal_generator->connect(top_block); signal_generator->connect(top_block);
top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0);
@ -646,6 +641,4 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities)
}) << "Failure while waiting the queue to stop" }) << "Failure while waiting the queue to stop"
<< std::endl; << std::endl;
} }
delete acquisition;
} }

Some files were not shown because too many files have changed in this diff Show More