diff --git a/CMakeLists.txt b/CMakeLists.txt index 1872be76f..9e4865db9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -401,7 +401,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "9.600.x") set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.1") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.16") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.17") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.9") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "3.9.0") diff --git a/README.md b/README.md index fcbcd7223..a112bd09a 100644 --- a/README.md +++ b/README.md @@ -341,7 +341,7 @@ Cloning the GNSS-SDR repository as in the line above will create a folder named |-----utils <- some utilities (e.g. Matlab scripts). ~~~~~~ -By default, you will be in the 'master' branch of the Git repository, which corresponds to the lastest stable release. If you want to try the latest developments, you can use the 'next' branch by going to the newly created gnss-sdr folder doing: +By default, you will be in the 'master' branch of the Git repository, which corresponds to the latest stable release. If you want to try the latest developments, you can use the 'next' branch by going to the newly created gnss-sdr folder doing: ~~~~~~ $ git checkout next diff --git a/cmake/Modules/GnsssdrBuildTypes.cmake b/cmake/Modules/GnsssdrBuildTypes.cmake index a80cd0c6b..94f5332a9 100644 --- a/cmake/Modules/GnsssdrBuildTypes.cmake +++ b/cmake/Modules/GnsssdrBuildTypes.cmake @@ -48,7 +48,7 @@ list(APPEND AVAIL_BUILDTYPES # known build types in AVAIL_BUILDTYPES. If the build type is found, # the function exits immediately. If nothing is found by the end of # checking all available build types, we exit with an error and list -# the avialable build types. +# the available build types. ######################################################################## function(GNSSSDR_CHECK_BUILD_TYPE settype) string(TOUPPER ${settype} _settype) diff --git a/docs/changelog b/docs/changelog index 97af773b1..a1f6ba4e0 100644 --- a/docs/changelog +++ b/docs/changelog @@ -21,6 +21,7 @@ ### Improvements in Flexibility: +- Rewritten Control Thread and GNSS Flowgraph for increased control of channels' status and smarter assignation of satellites in multi-band configurations. - New Tracking parameters allow the configuration of PLL and DLL filters order. - Added parameter to enable FLL during pull-in time. - Configurable pull-in time in the Tracking loops. @@ -28,7 +29,7 @@ ### Improvements in Interoperability: -- Added the BeiDou B1I receiver chain. +- Added the BeiDou B1I and B3I receiver chains. - Fix bug in GLONASS dual frequency receiver. - Added a custom UDP/IP output for PVT data streaming. - Improved Monitor block with UDP/IP output for internal receiver's data streaming. @@ -43,6 +44,7 @@ - Applied clang-tidy checks and fixes related to readability: readability-container-size-empty, readability-identifier-naming, readability-inconsistent-declaration-parameter-name, readability-named-parameter, readability-non-const-parameter, readability-string-compare. - Improved includes selection following suggestions by include-what-you-use (see https://include-what-you-use.org/), allowing faster compiles, fewer recompiles and making refactoring easier. - Deprecated boost::asio::io_service replaced by boost::asio::io_context if Boost > 1.65 +- The internal communication mechanism based on gr::msg_queue has been replaced by asynchronous message passing. ### Improvements in Portability: diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 13962f559..a9df67b7d 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -126,9 +126,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, { // Send feedback message to observables block with the receiver clock offset this->message_port_register_out(pmt::mp("pvt_to_observables")); + // Send PVT status to gnss_flowgraph + this->message_port_register_out(pmt::mp("status")); d_output_rate_ms = conf_.output_rate_ms; d_display_rate_ms = conf_.display_rate_ms; + d_report_rate_ms = 1000; //report every second PVT to gnss_synchro d_dump = conf_.dump; d_dump_mat = conf_.dump_mat and d_dump; d_dump_filename = conf_.dump_filename; @@ -3729,10 +3732,19 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } // PVT MONITOR - if (d_pvt_solver->is_valid_position() and flag_monitor_pvt_enabled) + if (d_pvt_solver->is_valid_position()) { - Monitor_Pvt monitor_pvt = d_pvt_solver->get_monitor_pvt(); - udp_sink_ptr->write_monitor_pvt(monitor_pvt); + std::shared_ptr monitor_pvt = std::make_shared(d_pvt_solver->get_monitor_pvt()); + + //publish new position to the gnss_flowgraph channel status monitor + if (current_RX_time_ms % d_report_rate_ms == 0) + { + this->message_port_pub(pmt::mp("status"), pmt::make_any(monitor_pvt)); + } + if (flag_monitor_pvt_enabled) + { + udp_sink_ptr->write_monitor_pvt(monitor_pvt); + } } } } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 595cd2624..b046735d8 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -169,6 +169,7 @@ private: int32_t d_output_rate_ms; int32_t d_display_rate_ms; + int32_t d_report_rate_ms; std::shared_ptr rp; std::shared_ptr d_kml_dump; diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 2796f13da..2824dbb7d 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -51,14 +51,14 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addre } -bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt& monitor_pvt) +bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const std::shared_ptr& monitor_pvt) { std::string outbound_data; if (use_protobuf == false) { std::ostringstream archive_stream; boost::archive::binary_oarchive oa{archive_stream}; - oa << monitor_pvt; + oa << *monitor_pvt.get(); outbound_data = archive_stream.str(); } else diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index f1f9146f4..dc55528cc 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -45,8 +45,8 @@ using b_io_context = boost::asio::io_service; class Monitor_Pvt_Udp_Sink { public: - Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t &port, bool protobuf_enabled); - bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt); + Monitor_Pvt_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool protobuf_enabled); + bool write_monitor_pvt(const std::shared_ptr& monitor_pvt); private: b_io_context io_context; diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 1e15631ed..4f86d620a 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -6217,7 +6217,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph if (version == 2) { - // --------- WAVELENGHT FACTOR + // --------- WAVELENGTH FACTOR // put here real data! line.clear(); line += Rinex_Printer::rightJustify("1", 6); diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 792eafb9a..75dcd4c50 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include // for size_t #include diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index 9c94a78d4..4ce99e0ac 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -384,7 +384,7 @@ int Rtcm_Printer::init_serial(const std::string& serial_device) * Opens the serial device and sets the default baud rate for a RTCM transmission (9600,8,N,1) */ int32_t fd = 0; - struct termios options; + struct termios options{}; int64_t BAUD; int64_t DATABITS; int64_t STOPBITS; diff --git a/src/algorithms/PVT/libs/serdes_monitor_pvt.h b/src/algorithms/PVT/libs/serdes_monitor_pvt.h index 1b5ca11ca..1477442df 100644 --- a/src/algorithms/PVT/libs/serdes_monitor_pvt.h +++ b/src/algorithms/PVT/libs/serdes_monitor_pvt.h @@ -34,7 +34,7 @@ #include "monitor_pvt.h" #include "monitor_pvt.pb.h" // file created by Protocol Buffers at compile time - +#include /*! * \brief This class implements serialization and deserialization of @@ -80,40 +80,40 @@ public: return *this; } - inline std::string createProtobuffer(const Monitor_Pvt& monitor) //!< Serialization into a string + inline std::string createProtobuffer(std::shared_ptr monitor) //!< Serialization into a string { monitor_.Clear(); std::string data; - monitor_.set_tow_at_current_symbol_ms(monitor.TOW_at_current_symbol_ms); - monitor_.set_week(monitor.week); - monitor_.set_rx_time(monitor.RX_time); - monitor_.set_user_clk_offset(monitor.user_clk_offset); - monitor_.set_pos_x(monitor.pos_x); - monitor_.set_pos_y(monitor.pos_y); - monitor_.set_pos_z(monitor.pos_z); - monitor_.set_vel_x(monitor.vel_x); - monitor_.set_vel_y(monitor.vel_y); - monitor_.set_vel_z(monitor.vel_z); - monitor_.set_cov_xx(monitor.cov_xx); - monitor_.set_cov_yy(monitor.cov_yy); - monitor_.set_cov_zz(monitor.cov_zz); - monitor_.set_cov_xy(monitor.cov_xy); - monitor_.set_cov_yz(monitor.cov_yz); - monitor_.set_cov_zx(monitor.cov_zx); - monitor_.set_latitude(monitor.latitude); - monitor_.set_longitude(monitor.longitude); - monitor_.set_height(monitor.height); - monitor_.set_valid_sats(monitor.valid_sats); - monitor_.set_solution_status(monitor.solution_status); - monitor_.set_solution_type(monitor.solution_type); - monitor_.set_ar_ratio_factor(monitor.AR_ratio_factor); - monitor_.set_ar_ratio_threshold(monitor.AR_ratio_threshold); - monitor_.set_gdop(monitor.gdop); - monitor_.set_pdop(monitor.pdop); - monitor_.set_hdop(monitor.hdop); - monitor_.set_vdop(monitor.vdop); + monitor_.set_tow_at_current_symbol_ms(monitor->TOW_at_current_symbol_ms); + monitor_.set_week(monitor->week); + monitor_.set_rx_time(monitor->RX_time); + monitor_.set_user_clk_offset(monitor->user_clk_offset); + monitor_.set_pos_x(monitor->pos_x); + monitor_.set_pos_y(monitor->pos_y); + monitor_.set_pos_z(monitor->pos_z); + monitor_.set_vel_x(monitor->vel_x); + monitor_.set_vel_y(monitor->vel_y); + monitor_.set_vel_z(monitor->vel_z); + monitor_.set_cov_xx(monitor->cov_xx); + monitor_.set_cov_yy(monitor->cov_yy); + monitor_.set_cov_zz(monitor->cov_zz); + monitor_.set_cov_xy(monitor->cov_xy); + monitor_.set_cov_yz(monitor->cov_yz); + monitor_.set_cov_zx(monitor->cov_zx); + monitor_.set_latitude(monitor->latitude); + monitor_.set_longitude(monitor->longitude); + monitor_.set_height(monitor->height); + monitor_.set_valid_sats(monitor->valid_sats); + monitor_.set_solution_status(monitor->solution_status); + monitor_.set_solution_type(monitor->solution_type); + monitor_.set_ar_ratio_factor(monitor->AR_ratio_factor); + monitor_.set_ar_ratio_threshold(monitor->AR_ratio_threshold); + monitor_.set_gdop(monitor->gdop); + monitor_.set_pdop(monitor->pdop); + monitor_.set_hdop(monitor->hdop); + monitor_.set_vdop(monitor->vdop); monitor_.SerializeToString(&data); return data; diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 41a5ab093..e94642af5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -40,9 +40,9 @@ #include #include #include +#include #include #include -#include galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( @@ -310,9 +310,8 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init() d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; float phase_step_rad = GALILEO_TWO_PI * doppler / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase.data(), d_fft_size); } /* CAF Filtering to resolve doppler ambiguity. Phase and quadrature must be processed diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index 2fcdc7afe..bc77ac955 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -34,9 +34,9 @@ #include #include #include +#include #include #include -#include galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc( @@ -192,9 +192,8 @@ void galileo_pcps_8ms_acquisition_cc::init() d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int32_t doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; float phase_step_rad = static_cast(GALILEO_TWO_PI) * doppler / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase.data(), d_fft_size); } } @@ -358,7 +357,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); filename << "../data/test_statistics_" << d_gnss_synchro->System - << "_" << d_gnss_synchro->Signal << "_sat_" + << "_" << d_gnss_synchro->Signal[0] << d_gnss_synchro->Signal[1] << "_sat_" << d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat"; d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); d_dump_file.write(reinterpret_cast(d_ifft->get_outbuf()), n); //write directly |abs(x)|^2 in this Doppler bin? diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 6b5939989..c4b42360f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -284,9 +284,8 @@ void pcps_acquisition::update_local_carrier(gsl::span carrier_vector { phase_step_rad = GPS_TWO_PI * freq / static_cast(acq_parameters.fs_in); } - float _phase[1]; - _phase[0] = 0.0; - volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase, carrier_vector.length()); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(carrier_vector.data(), -phase_step_rad, _phase.data(), carrier_vector.length()); } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 736b1f41b..8040fb39e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -158,11 +158,11 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con unsigned int pcps_acquisition_fine_doppler_cc::nextPowerOf2(unsigned int n) { n--; - n |= n >> 1; - n |= n >> 2; - n |= n >> 4; - n |= n >> 8; - n |= n >> 16; + n |= n >> 1U; + n |= n >> 2U; + n |= n >> 4U; + n |= n >> 8U; + n |= n >> 16U; n++; return n; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 25997df63..2577fea7f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -233,9 +234,8 @@ void pcps_assisted_acquisition_cc::redefine_grid() // doppler search steps // compute the carrier doppler wipe-off signal and store it phase_step_rad = static_cast(GPS_TWO_PI) * doppler_hz / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase, d_fft_size); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index].data(), -phase_step_rad, _phase.data(), d_fft_size); } } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index 646885ee7..40ae575aa 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -206,9 +206,8 @@ void pcps_cccwsr_acquisition_cc::init() int32_t doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase.data(), d_fft_size); } } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index 1516791c4..d17e323f6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -57,11 +57,11 @@ #include #include #include +#include #include #include #include #include -#include pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc( @@ -324,9 +324,8 @@ void pcps_opencl_acquisition_cc::init() int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; float phase_step_rad = static_cast(GPS_TWO_PI) * doppler / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase.data(), d_fft_size); if (d_opencl == 0) { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 2d08083da..8d0c7e97f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -38,7 +38,6 @@ #include #include #include -#include pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( @@ -235,9 +234,8 @@ void pcps_quicksync_acquisition_cc::init() d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int32_t doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_samples_per_code * d_folding_factor); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase.data(), d_samples_per_code * d_folding_factor); } // DLOG(INFO) << "end init"; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index 3238161bd..ca592a8e2 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -54,9 +54,9 @@ #include #include #include +#include #include #include -#include pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc( @@ -211,9 +211,8 @@ void pcps_tong_acquisition_cc::init() int32_t doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); - float _phase[1]; - _phase[0] = 0; - volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); + std::array _phase{}; + volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase.data(), d_fft_size); d_grid_data[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment())); diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index 7f439ce56..48f293df5 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -31,6 +31,7 @@ target_link_libraries(channel_adapters Gnuradio::runtime channel_libs core_system_parameters + core_receiver PRIVATE Gflags::gflags Glog::glog diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 98574b3eb..2cea8e915 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -42,7 +42,7 @@ Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr acq, std::shared_ptr trk, std::shared_ptr nav, - std::string role, std::string implementation, gr::msg_queue::sptr queue) + std::string role, std::string implementation, std::shared_ptr > queue) { acq_ = std::move(acq); trk_ = std::move(trk); diff --git a/src/algorithms/channel/adapters/channel.h b/src/algorithms/channel/adapters/channel.h index a238f490c..9e4048a2d 100644 --- a/src/algorithms/channel/adapters/channel.h +++ b/src/algorithms/channel/adapters/channel.h @@ -38,10 +38,11 @@ #include "channel_fsm.h" #include "channel_interface.h" #include "channel_msg_receiver_cc.h" +#include "concurrent_queue.h" #include "gnss_signal.h" #include "gnss_synchro.h" #include -#include +#include #include #include #include @@ -66,7 +67,7 @@ public: //! Constructor Channel(ConfigurationInterface* configuration, uint32_t channel, std::shared_ptr acq, std::shared_ptr trk, std::shared_ptr nav, - std::string role, std::string implementation, gr::msg_queue::sptr queue); + std::string role, std::string implementation, std::shared_ptr> queue); virtual ~Channel(); //!< Virtual destructor @@ -100,12 +101,12 @@ private: std::string implementation_; bool flag_enable_fpga; uint32_t channel_; - Gnss_Synchro gnss_synchro_; + Gnss_Synchro gnss_synchro_{}; Gnss_Signal gnss_signal_; bool connected_; bool repeat_; std::shared_ptr channel_fsm_; - gr::msg_queue::sptr queue_; + std::shared_ptr> queue_; std::mutex mx; }; diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index ba6e2a274..1ab513f43 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -24,7 +24,7 @@ set(CHANNEL_FSM_SOURCES set(CHANNEL_FSM_HEADERS channel_fsm.h channel_msg_receiver_cc.h -) +) list(SORT CHANNEL_FSM_HEADERS) list(SORT CHANNEL_FSM_SOURCES) @@ -35,14 +35,14 @@ add_library(channel_libs ${CHANNEL_FSM_SOURCES} ${CHANNEL_FSM_HEADERS}) target_link_libraries(channel_libs PUBLIC + core_libs + core_system_parameters Gnuradio::runtime Gnuradio::pmt - core_system_parameters PRIVATE Boost::boost Gflags::gflags Glog::glog - core_receiver ) if(ENABLE_CLANG_TIDY) diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index ac533d310..ffc491634 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -31,7 +31,7 @@ */ #include "channel_fsm.h" -#include "control_message_factory.h" +#include "channel_event.h" #include #include @@ -179,7 +179,7 @@ void ChannelFsm::set_telemetry(std::shared_ptr teleme } -void ChannelFsm::set_queue(gr::msg_queue::sptr queue) +void ChannelFsm::set_queue(std::shared_ptr> queue) { std::lock_guard lk(mx); queue_ = std::move(queue); @@ -215,29 +215,17 @@ void ChannelFsm::start_acquisition() void ChannelFsm::start_tracking() { trk_->start_tracking(); - std::unique_ptr cmf(new ControlMessageFactory()); - if (queue_ != gr::msg_queue::make()) - { - queue_->handle(cmf->GetQueueMessage(channel_, 1)); - } + queue_->push(pmt::make_any(channel_event_make(channel_, 1))); } void ChannelFsm::request_satellite() { - std::unique_ptr cmf(new ControlMessageFactory()); - if (queue_ != gr::msg_queue::make()) - { - queue_->handle(cmf->GetQueueMessage(channel_, 0)); - } + queue_->push(pmt::make_any(channel_event_make(channel_, 0))); } void ChannelFsm::notify_stop_tracking() { - std::unique_ptr cmf(new ControlMessageFactory()); - if (queue_ != gr::msg_queue::make()) - { - queue_->handle(cmf->GetQueueMessage(channel_, 2)); - } + queue_->push(pmt::make_any(channel_event_make(channel_, 2))); } diff --git a/src/algorithms/channel/libs/channel_fsm.h b/src/algorithms/channel/libs/channel_fsm.h index 8a3342511..a083a1507 100644 --- a/src/algorithms/channel/libs/channel_fsm.h +++ b/src/algorithms/channel/libs/channel_fsm.h @@ -34,9 +34,10 @@ #define GNSS_SDR_CHANNEL_FSM_H #include "acquisition_interface.h" +#include "concurrent_queue.h" #include "telemetry_decoder_interface.h" #include "tracking_interface.h" -#include +#include #include #include #include @@ -54,7 +55,7 @@ public: void set_acquisition(std::shared_ptr acquisition); void set_tracking(std::shared_ptr tracking); void set_telemetry(std::shared_ptr telemetry); - void set_queue(gr::msg_queue::sptr queue); + void set_queue(std::shared_ptr> queue); void set_channel(uint32_t channel); void start_acquisition(); // FSM EVENTS @@ -76,7 +77,7 @@ private: std::shared_ptr acq_; std::shared_ptr trk_; std::shared_ptr nav_; - gr::msg_queue::sptr queue_; + std::shared_ptr> queue_; uint32_t channel_; uint32_t d_state; std::mutex mx; diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index 1a517a96b..7b4144dd1 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -109,6 +109,12 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, const std::str } kludge_copy_ = gr::blocks::copy::make(item_size_); + unsigned long int max_source_buffer_samples = configuration->property("GNSS-SDR.max_source_buffer_samples", 0); + if (max_source_buffer_samples > 0) + { + kludge_copy_->set_max_output_buffer(max_source_buffer_samples); + LOG(INFO) << "Set signal conditioner max output buffer to " << max_source_buffer_samples; + } DLOG(INFO) << "kludge_copy(" << kludge_copy_->unique_id() << ")"; if (in_streams_ > 1) { diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index 0f8cf61b7..bfb3853d3 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -577,7 +577,7 @@ typedef struct typedef struct { /* SBAS message type */ - int week, tow; /* receiption time */ + int week, tow; /* reception time */ int prn; /* SBAS satellite PRN number */ unsigned char msg[29]; /* SBAS message (226bit) padded by 0 */ } sbsmsg_t; @@ -912,7 +912,7 @@ typedef struct unsigned char buff[1200]; /* message buffer */ unsigned int word; /* word buffer for rtcm 2 */ unsigned int nmsg2[100]; /* message count of RTCM 2 (1-99:1-99,0:other) */ - unsigned int nmsg3[400]; /* message count of RTCM 3 (1-299:1001-1299,300-399:2000-2099,0:ohter) */ + unsigned int nmsg3[400]; /* message count of RTCM 3 (1-299:1001-1299,300-399:2000-2099,0:other) */ char opt[256]; /* RTCM dependent options */ } rtcm_t; diff --git a/src/algorithms/libs/rtklib/rtklib_ephemeris.cc b/src/algorithms/libs/rtklib/rtklib_ephemeris.cc index 5c7383a5b..433bc8421 100644 --- a/src/algorithms/libs/rtklib/rtklib_ephemeris.cc +++ b/src/algorithms/libs/rtklib/rtklib_ephemeris.cc @@ -75,7 +75,7 @@ const double ERREPH_GLO = 5.0; /* error of glonass ephemeris (m) */ const double TSTEP = 60.0; /* integration step glonass ephemeris (s) */ const double RTOL_KEPLER = 1e-13; /* relative tolerance for Kepler equation */ -const double DEFURASSR = 0.15; /* default accurary of ssr corr (m) */ +const double DEFURASSR = 0.15; /* default accuracy of ssr corr (m) */ const double MAXECORSSR = 10.0; /* max orbit correction of ssr (m) */ const double MAXCCORSSR = 1e-6 * SPEED_OF_LIGHT; /* max clock correction of ssr (m) */ const double MAXAGESSR = 90.0; /* max age of ssr orbit and clock (s) */ @@ -473,7 +473,7 @@ void seph2pos(gtime_t time, const seph_t *seph, double *rs, double *dts, } -/* select ephememeris --------------------------------------------------------*/ +/* select ephemeris --------------------------------------------------------*/ eph_t *seleph(gtime_t time, int sat, int iode, const nav_t *nav) { double t, tmax, tmin; @@ -532,7 +532,7 @@ eph_t *seleph(gtime_t time, int sat, int iode, const nav_t *nav) } -/* select glonass ephememeris ------------------------------------------------*/ +/* select glonass ephemeris ------------------------------------------------*/ geph_t *selgeph(gtime_t time, int sat, int iode, const nav_t *nav) { double t, tmax = MAXDTOE_GLO, tmin = tmax + 1.0; @@ -574,7 +574,7 @@ geph_t *selgeph(gtime_t time, int sat, int iode, const nav_t *nav) } -/* select sbas ephememeris ---------------------------------------------------*/ +/* select sbas ephemeris ---------------------------------------------------*/ seph_t *selseph(gtime_t time, int sat, const nav_t *nav) { double t, tmax = MAXDTOE_SBS, tmin = tmax + 1.0; diff --git a/src/algorithms/libs/rtklib/rtklib_ionex.cc b/src/algorithms/libs/rtklib/rtklib_ionex.cc index d07740dc7..e8ddd028b 100644 --- a/src/algorithms/libs/rtklib/rtklib_ionex.cc +++ b/src/algorithms/libs/rtklib/rtklib_ionex.cc @@ -52,7 +52,7 @@ * [1] S.Schear, W.Gurtner and J.Feltens, IONEX: The IONosphere Map EXchange * Format Version 1, February 25, 1998 * [2] S.Schaer, R.Markus, B.Gerhard and A.S.Timon, Daily Global Ionosphere - * Maps based on GPS Carrier Phase Data Routinely producted by CODE + * Maps based on GPS Carrier Phase Data Routinely produced by CODE * Analysis Center, Proceeding of the IGS Analysis Center Workshop, 1996 * *----------------------------------------------------------------------------*/ diff --git a/src/algorithms/libs/rtklib/rtklib_ionex.h b/src/algorithms/libs/rtklib/rtklib_ionex.h index 6ffeb2c7a..9c5774fcb 100644 --- a/src/algorithms/libs/rtklib/rtklib_ionex.h +++ b/src/algorithms/libs/rtklib/rtklib_ionex.h @@ -52,7 +52,7 @@ * [1] S.Schear, W.Gurtner and J.Feltens, IONEX: The IONosphere Map EXchange * Format Version 1, February 25, 1998 * [2] S.Schaer, R.Markus, B.Gerhard and A.S.Timon, Daily Global Ionosphere - * Maps based on GPS Carrier Phase Data Routinely producted by CODE + * Maps based on GPS Carrier Phase Data Routinely produced by CODE * Analysis Center, Proceeding of the IGS Analysis Center Workshop, 1996 * *----------------------------------------------------------------------------*/ diff --git a/src/algorithms/libs/rtklib/rtklib_lambda.cc b/src/algorithms/libs/rtklib/rtklib_lambda.cc index 8aaba735f..cc795abd8 100644 --- a/src/algorithms/libs/rtklib/rtklib_lambda.cc +++ b/src/algorithms/libs/rtklib/rtklib_lambda.cc @@ -296,7 +296,7 @@ int search(int n, int m, const double *L, const double *D, * double *F O fixed solutions (n x m) * double *s O sum of squared residulas of fixed solutions (1 x m) * return : status (0:ok,other:error) - * notes : matrix stored by column-major order (fortran convension) + * notes : matrix stored by column-major order (fortran convention) *-----------------------------------------------------------------------------*/ int lambda(int n, int m, const double *a, const double *Q, double *F, double *s) diff --git a/src/algorithms/libs/rtklib/rtklib_ppp.cc b/src/algorithms/libs/rtklib/rtklib_ppp.cc index 83329ca48..657bfecda 100644 --- a/src/algorithms/libs/rtklib/rtklib_ppp.cc +++ b/src/algorithms/libs/rtklib/rtklib_ppp.cc @@ -331,7 +331,7 @@ int is_depend(int sat1, int sat2, int *flgs, int *max_flg) } else { - return 0; /* linear depenent */ + return 0; /* linear dependent */ } return 1; } diff --git a/src/algorithms/libs/rtklib/rtklib_preceph.cc b/src/algorithms/libs/rtklib/rtklib_preceph.cc index c1b5c23e6..34d16f541 100644 --- a/src/algorithms/libs/rtklib/rtklib_preceph.cc +++ b/src/algorithms/libs/rtklib/rtklib_preceph.cc @@ -546,7 +546,7 @@ int readdcbf(const char *file, nav_t *nav, const sta_t *sta) * read differential code bias (dcb) parameters * args : char *file I dcb parameters file (wild-card * expanded) * nav_t *nav IO navigation data - * sta_t *sta I station info data to inport receiver dcb + * sta_t *sta I station info data to import receiver dcb * (NULL: no use) * return : status (1:ok,0:error) * notes : currently only p1-c1 bias of code *.dcb file diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index fc60a4221..46e78c509 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -223,11 +223,12 @@ const unsigned int TBL_CR_C24_Q[] = { 0x42FA2F, 0xC4B6D4, 0xC82F22, 0x4E63D9, 0xD11CCE, 0x575035, 0x5BC9C3, 0xDD8538}; -extern "C" { -void dgemm_(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); -extern void dgetrf_(int *, int *, double *, int *, int *, int *); -extern void dgetri_(int *, double *, int *, int *, double *, int *, int *); -extern void dgetrs_(char *, int *, int *, double *, int *, int *, double *, int *, int *); +extern "C" +{ + void dgemm_(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); + extern void dgetrf_(int *, int *, double *, int *, int *, int *); + extern void dgetri_(int *, double *, int *, int *, double *, int *, int *); + extern void dgetrs_(char *, int *, int *, double *, int *, int *, double *, int *, int *); } @@ -3619,7 +3620,7 @@ void freeobs(obs_t *obs) /* free navigation data --------------------------------------------------------- * free memory for navigation data * args : nav_t *nav IO navigation data - * int opt I option (or of followings) + * int opt I option (one of the following) * (0x01: gps/qzs ephmeris, 0x02: glonass ephemeris, * 0x04: sbas ephemeris, 0x08: precise ephemeris, * 0x10: precise clock 0x20: almanac, diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.cc b/src/algorithms/libs/rtklib/rtklib_sbas.cc index b115e9821..8ecba3dbb 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.cc +++ b/src/algorithms/libs/rtklib/rtklib_sbas.cc @@ -922,7 +922,7 @@ void searchigp(gtime_t time __attribute__((unused)), const double *pos, const sb * double *var O variance of ionospheric delay (m^2) * return : status (1:ok, 0:no correction) * notes : before calling the function, sbas ionosphere correction parameters - * in navigation data (nav->sbsion) must be set by callig + * in navigation data (nav->sbsion) must be set by calling * sbsupdatecorr() *-----------------------------------------------------------------------------*/ int sbsioncorr(gtime_t time, const nav_t *nav, const double *pos, @@ -1206,7 +1206,7 @@ int sbsfastcorr(gtime_t time, int sat, const sbssat_t *sbssat, * double *var O sat position and clock variance (m^2) * return : status (1:ok,0:no correction) * notes : before calling the function, sbas satellite correction parameters - * in navigation data (nav->sbssat) must be set by callig + * in navigation data (nav->sbssat) must be set by calling * sbsupdatecorr(). * satellite clock correction include long-term correction and fast * correction. diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index ab7c6a72e..e046a005c 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -2132,7 +2132,7 @@ int outsols(unsigned char *buff, const sol_t *sol, const double *rb, /* output solution extended ---------------------------------------------------- - * output solution exteneded information + * output solution extended information * args : unsigned char *buff IO output buffer * sol_t *sol I solution * ssat_t *ssat I satellite status @@ -2232,7 +2232,7 @@ void outsol(FILE *fp, const sol_t *sol, const double *rb, /* output solution extended ---------------------------------------------------- - * output solution exteneded information to file + * output solution extended information to file * args : FILE *fp I output file pointer * sol_t *sol I solution * ssat_t *ssat I satellite status diff --git a/src/algorithms/libs/rtklib/rtklib_tides.cc b/src/algorithms/libs/rtklib/rtklib_tides.cc index eb5355a61..d2fb29542 100644 --- a/src/algorithms/libs/rtklib/rtklib_tides.cc +++ b/src/algorithms/libs/rtklib/rtklib_tides.cc @@ -257,7 +257,7 @@ void tide_pole(gtime_t tut, const double *pos, const double *erpv, * displacements by earth tides * args : gtime_t tutc I time in utc * double *rr I site position (ecef) (m) - * int opt I options (or of the followings) + * int opt I options (one of the following) * 1: solid earth tide * 2: ocean tide loading * 4: pole tide diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index 3131d198b..b6abea28f 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -84,6 +84,9 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in, this->message_port_register_in(pmt::mp("pvt_to_observables")); this->set_msg_handler(pmt::mp("pvt_to_observables"), boost::bind(&hybrid_observables_gs::msg_handler_pvt_to_observables, this, _1)); + // Send Channel status to gnss_flowgraph + this->message_port_register_out(pmt::mp("status")); + d_dump = dump; d_dump_mat = dump_mat and d_dump; d_dump_filename = std::move(dump_filename); @@ -140,7 +143,7 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in, T_rx_remnant_to_20ms = 0; T_rx_step_ms = 20; //read from config at the adapter GNSS-SDR.observable_interval_ms!! T_rx_TOW_set = false; - + T_status_report_timer_ms = 0; // rework d_Rx_clock_buffer.set_capacity(10); // 10*20 ms = 200 ms of data in buffer d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer @@ -618,6 +621,20 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused) { out[n][0] = epoch_data.at(n); } + + //report channel status every second + T_status_report_timer_ms += T_rx_step_ms; + if (T_status_report_timer_ms >= 1000) + { + for (uint32_t n = 0; n < d_nchannels_out; n++) + { + std::shared_ptr gnss_synchro_sptr = std::make_shared(epoch_data.at(n)); + //publish valid gnss_synchro to the gnss_flowgraph channel status monitor + this->message_port_pub(pmt::mp("status"), pmt::make_any(gnss_synchro_sptr)); + } + T_status_report_timer_ms = 0; + } + if (d_dump) { // MULTIPLEXED FILE RECORDING - Record results to file diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h index 39112b160..e2bbfa299 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.h @@ -90,6 +90,7 @@ private: uint32_t T_rx_TOW_ms; uint32_t T_rx_remnant_to_20ms; uint32_t T_rx_step_ms; + uint32_t T_status_report_timer_ms; uint32_t d_nchannels_in; uint32_t d_nchannels_out; double T_rx_offset_ms; diff --git a/src/algorithms/signal_generator/adapters/CMakeLists.txt b/src/algorithms/signal_generator/adapters/CMakeLists.txt index fb651871e..a519eaa3f 100644 --- a/src/algorithms/signal_generator/adapters/CMakeLists.txt +++ b/src/algorithms/signal_generator/adapters/CMakeLists.txt @@ -34,6 +34,7 @@ target_link_libraries(signal_generator_adapters Gflags::gflags Glog::glog algorithms_libs + core_receiver ) target_include_directories(signal_generator_adapters diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index c4dc9dc3d..31636f246 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -44,7 +44,7 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + unsigned int out_stream, std::shared_ptr > queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/gen_source.dat"; diff --git a/src/algorithms/signal_generator/adapters/signal_generator.h b/src/algorithms/signal_generator/adapters/signal_generator.h index e32c431b8..d2adfc27e 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.h +++ b/src/algorithms/signal_generator/adapters/signal_generator.h @@ -33,12 +33,13 @@ #ifndef GNSS_SDR_SIGNAL_GENERATOR_H_ #define GNSS_SDR_SIGNAL_GENERATOR_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "signal_generator_c.h" #include #include #include -#include +#include #include #include @@ -53,7 +54,7 @@ class SignalGenerator : public GNSSBlockInterface public: SignalGenerator(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr > queue); virtual ~SignalGenerator(); @@ -91,6 +92,6 @@ private: boost::shared_ptr gen_source_; gr::blocks::vector_to_stream::sptr vector_to_stream_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr > queue_; }; #endif /*GNSS_SDR_SIGNAL_GENERATOR_H_*/ diff --git a/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt index 99e7debab..8e18bd790 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt @@ -28,7 +28,6 @@ add_library(signal_generator_gr_blocks target_link_libraries(signal_generator_gr_blocks PUBLIC - Boost::boost Gnuradio::runtime core_system_parameters PRIVATE diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index 6c8d9d580..118c00e57 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -97,7 +97,7 @@ void signal_generator_c::init() { work_counter_ = 0; - complex_phase_ = static_cast(volk_gnsssdr_malloc(vector_length_ * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + complex_phase_.reserve(vector_length_); // True if Galileo satellites are present bool galileo_signal = std::find(system_.begin(), system_.end(), "E") != system_.end(); @@ -152,13 +152,13 @@ void signal_generator_c::init() void signal_generator_c::generate_codes() { - sampled_code_data_.reset(new gr_complex *[num_sats_]); - sampled_code_pilot_.reset(new gr_complex *[num_sats_]); + //sampled_code_data_.reset(new gr_complex *[num_sats_]); + //sampled_code_pilot_.reset(new gr_complex *[num_sats_]); + sampled_code_data_ = std::vector>(num_sats_, std::vector(vector_length_)); + sampled_code_pilot_ = std::vector>(num_sats_, std::vector(vector_length_)); for (unsigned int sat = 0; sat < num_sats_; sat++) { - sampled_code_data_[sat] = static_cast(std::malloc(vector_length_ * sizeof(gr_complex))); - std::array code{}; //[samples_per_code_[sat]]; if (system_[sat] == "G") @@ -211,7 +211,7 @@ void signal_generator_c::generate_codes() { std::array signal = {{'5', 'X', '\0'}}; - galileo_e5_a_code_gen_complex_sampled(gsl::span(sampled_code_data_[sat], vector_length_), signal, PRN_[sat], fs_in_, + galileo_e5_a_code_gen_complex_sampled(sampled_code_data_[sat], signal, PRN_[sat], fs_in_, static_cast(GALILEO_E5A_CODE_LENGTH_CHIPS) - delay_chips_[sat]); //noise if (noise_flag_) @@ -248,11 +248,10 @@ void signal_generator_c::generate_codes() } // Generate E1C signal (25 code-periods, with secondary code) - sampled_code_pilot_[sat] = static_cast(std::malloc(vector_length_ * sizeof(gr_complex))); std::array signal_1C = {{'1', 'C', '\0'}}; - galileo_e1_code_gen_complex_sampled(gsl::span(sampled_code_pilot_[sat], vector_length_), signal_1C, cboc, PRN_[sat], fs_in_, + galileo_e1_code_gen_complex_sampled(gsl::span(sampled_code_pilot_[sat].data(), vector_length_), signal_1C, cboc, PRN_[sat], fs_in_, static_cast(GALILEO_E1_B_CODE_LENGTH_CHIPS) - delay_chips_[sat], true); // Obtain the desired CN0 assuming that Pn = 1. @@ -269,20 +268,6 @@ void signal_generator_c::generate_codes() } -signal_generator_c::~signal_generator_c() -{ - /* for (unsigned int sat = 0; sat < num_sats_; sat++) - { - std::free(sampled_code_data_[sat]); - if (system_[sat] == "E" && signal_[sat].at(0) != '5') - { - std::free(sampled_code_pilot_[sat]); - } - } */ - volk_gnsssdr_free(complex_phase_); -} - - int signal_generator_c::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items __attribute__((unused)), @@ -306,9 +291,9 @@ int signal_generator_c::general_work(int noutput_items __attribute__((unused)), for (unsigned int sat = 0; sat < num_sats_; sat++) { float phase_step_rad = -static_cast(GPS_TWO_PI) * doppler_Hz_[sat] / static_cast(fs_in_); - float _phase[1]; + std::array _phase{}; _phase[0] = -start_phase_rad_[sat]; - volk_gnsssdr_s32f_sincos_32fc(complex_phase_, -phase_step_rad, _phase, vector_length_); + volk_gnsssdr_s32f_sincos_32fc(complex_phase_.data(), -phase_step_rad, _phase.data(), vector_length_); start_phase_rad_[sat] += vector_length_ * phase_step_rad; out_idx = 0; @@ -346,7 +331,7 @@ int signal_generator_c::general_work(int noutput_items __attribute__((unused)), phase_step_rad = -static_cast(GPS_TWO_PI) * (freq + (DFRQ1_GLO * GLONASS_PRN.at(PRN_[sat])) + doppler_Hz_[sat]) / static_cast(fs_in_); // std::cout << "sat " << PRN_[sat] << " SG - Freq = " << (freq + (DFRQ1_GLO * GLONASS_PRN.at(PRN_[sat]))) << " Doppler = " << doppler_Hz_[sat] << std::endl; _phase[0] = -start_phase_rad_[sat]; - volk_gnsssdr_s32f_sincos_32fc(complex_phase_, -phase_step_rad, _phase, vector_length_); + volk_gnsssdr_s32f_sincos_32fc(complex_phase_.data(), -phase_step_rad, _phase.data(), vector_length_); unsigned int delay_samples = (delay_chips_[sat] % static_cast(GLONASS_L1_CA_CODE_LENGTH_CHIPS)) * samples_per_code_[sat] / GLONASS_L1_CA_CODE_LENGTH_CHIPS; diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h index a6fb316bf..b0a8fb574 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h @@ -32,7 +32,6 @@ #define GNSS_SDR_SIGNAL_GENERATOR_C_H #include "gnss_signal.h" -#include #include #include #include @@ -83,7 +82,7 @@ signal_generator_c_sptr signal_make_generator_c( class signal_generator_c : public gr::block { public: - ~signal_generator_c(); // public destructor + ~signal_generator_c() = default; // public destructor // Where all the action really happens int general_work(int noutput_items, @@ -146,9 +145,9 @@ private: std::vector current_data_bit_int_; std::vector data_modulation_; std::vector pilot_modulation_; - boost::scoped_array sampled_code_data_; - boost::scoped_array sampled_code_pilot_; - gr_complex *complex_phase_; + std::vector> sampled_code_data_; + std::vector> sampled_code_pilot_; + std::vector complex_phase_; unsigned int work_counter_; std::random_device r; std::default_random_engine e1; diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index f83c64f25..dac665cc4 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -48,7 +48,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h index 9277c4c2b..e5a917199 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -32,10 +32,11 @@ #ifndef GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_ #define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "fpga_switch.h" #include "gnss_block_interface.h" #include -#include +#include #include #include @@ -46,7 +47,7 @@ class Ad9361FpgaSignalSource : public GNSSBlockInterface public: Ad9361FpgaSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr> queue); ~Ad9361FpgaSignalSource(); @@ -112,7 +113,7 @@ private: bool dump_; std::string dump_filename_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; std::shared_ptr switch_fpga; }; diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc index 024966d0e..a130b32f8 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -40,7 +40,7 @@ CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS std::string empty = ""; diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h index 37e80caf7..3d8d400de 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -32,12 +32,13 @@ #ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H #define GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "gr_complex_ip_packet_source.h" #include #include #include -#include +#include #include #include #include @@ -54,7 +55,7 @@ class CustomUDPSignalSource : public GNSSBlockInterface public: CustomUDPSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~CustomUDPSignalSource(); @@ -98,7 +99,7 @@ private: std::vector> null_sinks_; Gr_Complex_Ip_Packet_Source::sptr udp_gnss_rx_source_; std::vector> file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H */ diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index 59ad90f50..b478b6363 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -44,7 +44,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "./example_capture.dat"; std::string default_item_type = "short"; diff --git a/src/algorithms/signal_source/adapters/file_signal_source.h b/src/algorithms/signal_source/adapters/file_signal_source.h index bfded2ce8..86d87798a 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.h +++ b/src/algorithms/signal_source/adapters/file_signal_source.h @@ -35,13 +35,15 @@ #ifndef GNSS_SDR_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include #include #include -#include +#include #include +#include #include class ConfigurationInterface; @@ -55,7 +57,7 @@ class FileSignalSource : public GNSSBlockInterface public: FileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~FileSignalSource(); @@ -122,7 +124,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index ff3f3f9a0..478a6973d 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -34,7 +34,6 @@ #include "configuration_interface.h" #include #include -#include #include #include @@ -43,10 +42,10 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati const std::string& role, unsigned int in_stream, unsigned int out_stream, - gr::msg_queue::sptr queue) : role_(role), - in_stream_(in_stream), - out_stream_(out_stream), - queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), + in_stream_(in_stream), + out_stream_(out_stream), + queue_(std::move(queue)) { std::string default_item_type = "byte"; item_type_ = configuration->property(role + ".item_type", default_item_type); diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.h b/src/algorithms/signal_source/adapters/flexiband_signal_source.h index 7da5839a8..56c2aff09 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.h +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.h @@ -34,13 +34,14 @@ #ifndef GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H_ #define GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include #include #include #include -#include +#include #include #include @@ -56,7 +57,7 @@ class FlexibandSignalSource : public GNSSBlockInterface public: FlexibandSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, gr::msg_queue::sptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~FlexibandSignalSource(); @@ -109,7 +110,7 @@ private: std::vector> float_to_complex_; std::vector null_sinks_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif // GNSS_SDR_FLEXIBAND_SIGNAL_SOURCE_H_ diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index 704c5b01e..bfc470dbc 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -43,7 +43,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index 1388a514d..44870c182 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -41,7 +41,8 @@ #else #include #endif -#include +#include "concurrent_queue.h" +#include #include class ConfigurationInterface; @@ -51,7 +52,7 @@ class Fmcomms2SignalSource : public GNSSBlockInterface public: Fmcomms2SignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~Fmcomms2SignalSource(); @@ -122,7 +123,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.cc b/src/algorithms/signal_source/adapters/gen_signal_source.cc index ef8441853..057650ac0 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gen_signal_source.cc @@ -42,7 +42,7 @@ // Constructor GenSignalSource::GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter, - std::string role, boost::shared_ptr queue) : signal_generator_(signal_generator), + std::string role, std::shared_ptr> queue) : signal_generator_(signal_generator), filter_(filter), role_(std::move(role)), queue_(std::move(queue)) diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.h b/src/algorithms/signal_source/adapters/gen_signal_source.h index 49fb25293..d30f8935b 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.h +++ b/src/algorithms/signal_source/adapters/gen_signal_source.h @@ -34,8 +34,9 @@ #define GNSS_SDR_GEN_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" -#include +#include #include /*! @@ -47,7 +48,7 @@ class GenSignalSource : public GNSSBlockInterface public: //! Constructor GenSignalSource(GNSSBlockInterface *signal_generator, GNSSBlockInterface *filter, - std::string role, boost::shared_ptr queue); + std::string role, std::shared_ptr> queue); //! Virtual destructor virtual ~GenSignalSource(); @@ -58,20 +59,17 @@ public: gr::basic_block_sptr get_right_block() override; inline std::string role() override { return role_; } - //! Returns "Signal Source" inline std::string implementation() override { return "Signal Source"; } inline size_t item_size() override { return 0; } - inline GNSSBlockInterface *signal_generator() const { return signal_generator_; } - private: GNSSBlockInterface *signal_generator_; GNSSBlockInterface *filter_; std::string role_; std::string implementation_; bool connected_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_GEN_SIGNAL_SOURCE_H*/ diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc index 3f66591e9..4a699d09d 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.cc @@ -32,12 +32,11 @@ #include "configuration_interface.h" #include #include -#include #include Gn3sSignalSource::Gn3sSignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) { std::string default_item_type = "short"; std::string default_dump_file = "./data/gn3s_source.dat"; diff --git a/src/algorithms/signal_source/adapters/gn3s_signal_source.h b/src/algorithms/signal_source/adapters/gn3s_signal_source.h index df799f019..e34b91afe 100644 --- a/src/algorithms/signal_source/adapters/gn3s_signal_source.h +++ b/src/algorithms/signal_source/adapters/gn3s_signal_source.h @@ -32,10 +32,11 @@ #ifndef GNSS_SDR_GN3S_SIGNAL_SOURCE_H_ #define GNSS_SDR_GN3S_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include -#include +#include #include @@ -49,7 +50,7 @@ class Gn3sSignalSource : public GNSSBlockInterface public: Gn3sSignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, gr::msg_queue::sptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~Gn3sSignalSource(); @@ -87,7 +88,7 @@ private: std::string dump_filename_; gr::block_sptr gn3s_source_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_GN3S_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 2fb8ba3b7..e6366261a 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -37,7 +37,7 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, - const std::string& role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr 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, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./labsat_output.dat"; diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.h b/src/algorithms/signal_source/adapters/labsat_signal_source.h index 1d9e333bf..9bf5d2057 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.h +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.h @@ -32,10 +32,11 @@ #ifndef GNSS_SDR_LABSAT_SIGNAL_SOURCE_H_ #define GNSS_SDR_LABSAT_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include -#include +#include #include class ConfigurationInterface; @@ -48,7 +49,7 @@ class LabsatSignalSource : public GNSSBlockInterface public: LabsatSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, gr::msg_queue::sptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~LabsatSignalSource(); @@ -86,7 +87,7 @@ private: std::string dump_filename_; gr::block_sptr labsat23_source_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_LABSAT_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc index 11efe4fd9..330b3e43c 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc @@ -43,7 +43,7 @@ MultichannelFileSignalSource::MultichannelFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "./example_capture.dat"; std::string default_item_type = "short"; diff --git a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h index b248073dd..db3a9c57c 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.h @@ -35,12 +35,13 @@ #ifndef GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_MULTICHANNEL_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include #include #include -#include +#include #include #include #include @@ -56,7 +57,7 @@ class MultichannelFileSignalSource : public GNSSBlockInterface public: MultichannelFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~MultichannelFileSignalSource(); @@ -122,7 +123,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr sink_; std::vector throttle_vec_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index aa31e75a6..dc00bcecb 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -44,7 +44,7 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "byte"; diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.h b/src/algorithms/signal_source/adapters/nsr_file_signal_source.h index a2b3ee547..2efaa09b3 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.h @@ -35,13 +35,14 @@ #ifndef GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_NSR_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "unpack_byte_2bit_samples.h" #include #include #include #include -#include +#include #include class ConfigurationInterface; @@ -55,7 +56,7 @@ class NsrFileSignalSource : public GNSSBlockInterface public: NsrFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~NsrFileSignalSource(); inline std::string role() override @@ -122,7 +123,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 32ea28cf0..38f823248 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -42,7 +42,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS std::string empty = ""; diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index 15f38b2a3..8a96f32d6 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -33,10 +33,11 @@ #ifndef GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_ #define GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include -#include +#include #include #include #include @@ -54,7 +55,7 @@ class OsmosdrSignalSource : public GNSSBlockInterface public: OsmosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~OsmosdrSignalSource(); @@ -110,7 +111,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_OSMOSDR_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index fc41bd3a9..ba6af1fd6 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -39,7 +39,7 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/signal_source.dat"; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index e765ff7c4..bc105d171 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -40,7 +40,8 @@ #else #include #endif -#include +#include "concurrent_queue.h" +#include #include @@ -53,7 +54,7 @@ class PlutosdrSignalSource : public GNSSBlockInterface public: PlutosdrSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~PlutosdrSignalSource(); @@ -109,7 +110,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc index f9aab0987..d54a7cb19 100644 --- a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc +++ b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc @@ -29,15 +29,16 @@ */ #include "raw_array_signal_source.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include #include -#include +#include #include RawArraySignalSource::RawArraySignalSource(ConfigurationInterface* configuration, - std::string role, unsigned int in_stream, unsigned int out_stream, gr::msg_queue::sptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) + std::string role, unsigned int in_stream, unsigned int out_stream, std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) { std::string default_item_type = "gr_complex"; std::string default_dump_file = "./data/raw_array_source.dat"; diff --git a/src/algorithms/signal_source/adapters/raw_array_signal_source.h b/src/algorithms/signal_source/adapters/raw_array_signal_source.h index 321895cef..750efb3fe 100644 --- a/src/algorithms/signal_source/adapters/raw_array_signal_source.h +++ b/src/algorithms/signal_source/adapters/raw_array_signal_source.h @@ -32,10 +32,11 @@ #ifndef GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H_ #define GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include -#include +#include #include class ConfigurationInterface; @@ -48,7 +49,7 @@ class RawArraySignalSource : public GNSSBlockInterface public: RawArraySignalSource(ConfigurationInterface* configuration, std::string role, unsigned int in_stream, - unsigned int out_stream, gr::msg_queue::sptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~RawArraySignalSource(); @@ -87,7 +88,7 @@ private: std::string eth_device_; gr::block_sptr raw_array_source_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_RAW_ARRAY_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index 2b9574708..478e6b1c7 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -45,7 +45,7 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h index 74f2b02d5..2fcb9d871 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.h @@ -32,13 +32,14 @@ #ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H #define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "rtl_tcp_signal_source_c.h" #include #include #include #include -#include +#include #include #include @@ -57,7 +58,7 @@ public: const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~RtlTcpSignalSource(); @@ -113,7 +114,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_H */ diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc index 52964abba..91287020c 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -43,7 +43,7 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_item_type = "int"; diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.h b/src/algorithms/signal_source/adapters/spir_file_signal_source.h index ad76ce23b..09aff8c09 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.h @@ -32,13 +32,14 @@ #ifndef GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_SPIR_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "unpack_intspir_1bit_samples.h" #include #include #include #include -#include +#include #include #include @@ -53,7 +54,7 @@ class SpirFileSignalSource : public GNSSBlockInterface public: SpirFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~SpirFileSignalSource(); inline std::string role() override @@ -120,7 +121,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index 7e1c3f1ce..4b6239ba5 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -40,7 +40,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, - const std::string& role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr 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, std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) { std::string default_filename = "../data/my_capture.dat"; std::string default_dump_filename = "../data/my_capture_dump.dat"; @@ -148,7 +148,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* for (uint32_t i = 0; i < (n_channels_); i++) { - valve_vec_.push_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_)); + valve_vec_.emplace_back(gnss_sdr_make_valve(sizeof(gr_complex), samples_, queue_)); if (dump_) { std::string tmp_str = dump_filename_ + "_ch" + std::to_string(i); diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h index 0757c24af..61edd479c 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.h @@ -32,6 +32,7 @@ #ifndef GNSS_SDR_SPIR_GSS6450_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_SPIR_GSS6450_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "unpack_spir_gss6450_samples.h" @@ -42,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -58,7 +59,7 @@ class SpirGSS6450FileSignalSource : public GNSSBlockInterface { public: SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, const std::string& role, - uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue); + uint32_t in_streams, uint32_t out_streams, std::shared_ptr> queue); virtual ~SpirGSS6450FileSignalSource(); inline std::string role() override @@ -131,7 +132,7 @@ private: std::vector> valve_vec_; std::vector sink_vec_; std::vector throttle_vec_; - gr::msg_queue::sptr queue_; + std::shared_ptr> queue_; size_t item_size_; }; diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc index 604f9c536..9e0b802d4 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc @@ -45,7 +45,7 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), + std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h index a66a87965..dea315cec 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.h @@ -34,6 +34,7 @@ #ifndef GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_TWO_BIT_CPX_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "unpack_byte_2bit_cpx_samples.h" #include @@ -41,7 +42,7 @@ #include #include #include -#include +#include #include #include @@ -59,7 +60,7 @@ public: const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~TwoBitCpxFileSignalSource(); inline std::string role() override @@ -127,7 +128,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; size_t item_size_; // Throttle control bool enable_throttle_control_; diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc index 684cb5b86..4b0c00345 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc @@ -47,7 +47,7 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue) : role_(role), + std::shared_ptr> queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(std::move(queue)) diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h index 1e98d737b..ea2bb2d5a 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.h @@ -35,6 +35,7 @@ #ifndef GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H_ #define GNSS_SDR_TWO_BIT_PACKED_FILE_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "unpack_2bit_samples.h" #include @@ -42,7 +43,7 @@ #include #include #include -#include +#include #include #include @@ -58,7 +59,7 @@ class TwoBitPackedFileSignalSource : public GNSSBlockInterface public: TwoBitPackedFileSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, - boost::shared_ptr queue); + std::shared_ptr> queue); virtual ~TwoBitPackedFileSignalSource(); inline std::string role() override @@ -146,7 +147,7 @@ private: boost::shared_ptr valve_; gr::blocks::file_sink::sptr sink_; gr::blocks::throttle::sptr throttle_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; size_t item_size_; bool big_endian_items_; bool big_endian_bytes_; diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index ee58eb551..16ab70b8e 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -42,7 +42,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, unsigned int out_stream, - boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) + std::shared_ptr> queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(std::move(queue)) { // DUMP PARAMETERS std::string empty = ""; @@ -216,7 +216,7 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, if (samples_.at(i) != 0ULL) { LOG(INFO) << "RF_channel " << i << " Send STOP signal after " << samples_.at(i) << " samples"; - valve_.push_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() << ")"; } diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.h b/src/algorithms/signal_source/adapters/uhd_signal_source.h index 50d233c2e..232f6934f 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.h +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.h @@ -31,12 +31,13 @@ #ifndef GNSS_SDR_UHD_SIGNAL_SOURCE_H_ #define GNSS_SDR_UHD_SIGNAL_SOURCE_H_ +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include #include #include -#include #include +#include #include #include #include @@ -52,7 +53,7 @@ class UhdSignalSource : public GNSSBlockInterface public: UhdSignalSource(ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, - unsigned int out_stream, boost::shared_ptr queue); + unsigned int out_stream, std::shared_ptr> queue); virtual ~UhdSignalSource(); @@ -107,7 +108,7 @@ private: std::vector> valve_; std::vector file_sink_; - boost::shared_ptr queue_; + std::shared_ptr> queue_; }; #endif /*GNSS_SDR_UHD_SIGNAL_SOURCE_H_*/ diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h index 2200050b3..be93ab2c3 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -85,7 +85,7 @@ private: int fifo_items; int d_sock_raw; int d_udp_port; - struct sockaddr_in si_me; + struct sockaddr_in si_me{}; std::string d_src_device; std::string d_origin_address; int d_udp_payload_size; diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc index 06972a25a..366eb558f 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.cc @@ -30,7 +30,8 @@ #include "labsat23_source.h" -#include "control_message_factory.h" +#include "command_event.h" +#include #include #include #include @@ -39,7 +40,7 @@ #include -labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, gr::msg_queue::sptr queue) +labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, int channel_selector, std::shared_ptr> queue) { return labsat23_source_sptr(new labsat23_source(signal_file_basename, channel_selector, std::move(queue))); } @@ -47,10 +48,10 @@ labsat23_source_sptr labsat23_make_source_sptr(const char *signal_file_basename, labsat23_source::labsat23_source(const char *signal_file_basename, int channel_selector, - gr::msg_queue::sptr queue) : gr::block("labsat23_source", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(1, 1, sizeof(gr_complex))), - d_queue(std::move(queue)) + std::shared_ptr> queue) : gr::block("labsat23_source", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 1, sizeof(gr_complex))), + d_queue(std::move(queue)) { if (channel_selector < 1 or channel_selector > 2) { @@ -467,9 +468,8 @@ int labsat23_source::general_work(int noutput_items, { std::cout << "End of file reached, LabSat source stop" << std::endl; } - auto *cmf = new ControlMessageFactory(); - d_queue->handle(cmf->GetQueueMessage(200, 0)); - delete cmf; + + d_queue->push(pmt::make_any(command_event_make(200, 0))); return -1; } } @@ -528,9 +528,7 @@ int labsat23_source::general_work(int noutput_items, { std::cout << "End of file reached, LabSat source stop" << std::endl; } - auto *cmf = new ControlMessageFactory(); - d_queue->handle(cmf->GetQueueMessage(200, 0)); - delete cmf; + d_queue->push(pmt::make_any(command_event_make(200, 0))); return -1; } } diff --git a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h index a09c0f3a8..49c74bc61 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/labsat23_source.h @@ -31,8 +31,9 @@ #ifndef GNSS_SDR_LABSAT23_SOURCE_H #define GNSS_SDR_LABSAT23_SOURCE_H +#include "concurrent_queue.h" #include -#include // for msg_queue, msg_queue::sptr +#include #include #include #include @@ -45,7 +46,7 @@ using labsat23_source_sptr = boost::shared_ptr; labsat23_source_sptr labsat23_make_source_sptr( const char *signal_file_basename, int channel_selector, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); /*! * \brief This class implements conversion between Labsat2 and 3 format byte packet samples to gr_complex @@ -64,11 +65,11 @@ private: friend labsat23_source_sptr labsat23_make_source_sptr( const char *signal_file_basename, int channel_selector, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); labsat23_source(const char *signal_file_basename, int channel_selector, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::string generate_filename(); void decode_samples_one_channel(int16_t input_short, gr_complex *out, int type); @@ -82,7 +83,7 @@ private: std::ifstream *binary_input_file; uint8_t d_ref_clock; uint8_t d_bits_per_sample; - gr::msg_queue::sptr d_queue; + std::shared_ptr> d_queue; }; #endif diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h index 045573ce7..8c4cd1886 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.h @@ -110,7 +110,7 @@ private: size_t unread_; // lookup for scaling data - boost::array lookup_; + boost::array lookup_{}; // async read callback void handle_read(const boost::system::error_code &ec, diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index f6015ec59..1045967b4 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -71,10 +71,10 @@ target_link_libraries(signal_source_libs PUBLIC Boost::boost Gnuradio::runtime + core_receiver PRIVATE Gflags::gflags Glog::glog - core_receiver ) if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2) diff --git a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc index 615cb65b7..7a5fc18a9 100644 --- a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc +++ b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc @@ -32,17 +32,17 @@ */ #include "gnss_sdr_valve.h" -#include "control_message_factory.h" // for ControlMessageFactory -#include // for LOG -#include // for io_signature -#include // for min -#include // for memcpy -#include // for usleep +#include "command_event.h" +#include // for LOG +#include // for io_signature +#include // for min +#include // for memcpy +#include // for usleep #include Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item, uint64_t nitems, - gr::msg_queue::sptr queue, + std::shared_ptr> queue, bool stop_flowgraph) : gr::sync_block("valve", gr::io_signature::make(1, 20, sizeof_stream_item), gr::io_signature::make(1, 20, sizeof_stream_item)), @@ -55,14 +55,14 @@ Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item, } -boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue, bool stop_flowgraph) +boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr> queue, bool stop_flowgraph) { boost::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), stop_flowgraph)); return valve_; } -boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, gr::msg_queue::sptr queue) +boost::shared_ptr gnss_sdr_make_valve(size_t sizeof_stream_item, uint64_t nitems, std::shared_ptr> queue) { boost::shared_ptr valve_(new Gnss_Sdr_Valve(sizeof_stream_item, nitems, std::move(queue), true)); return valve_; @@ -83,10 +83,8 @@ int Gnss_Sdr_Valve::work(int noutput_items, { if (d_ncopied_items >= d_nitems) { - auto *cmf = new ControlMessageFactory(); - d_queue->handle(cmf->GetQueueMessage(200, 0)); LOG(INFO) << "Stopping receiver, " << d_ncopied_items << " samples processed"; - delete cmf; + d_queue->push(pmt::make_any(command_event_make(200, 0))); if (d_stop_flowgraph) { return -1; // Done! diff --git a/src/algorithms/signal_source/libs/gnss_sdr_valve.h b/src/algorithms/signal_source/libs/gnss_sdr_valve.h index b56807c2b..6c28f28f5 100644 --- a/src/algorithms/signal_source/libs/gnss_sdr_valve.h +++ b/src/algorithms/signal_source/libs/gnss_sdr_valve.h @@ -34,11 +34,12 @@ #ifndef GNSS_SDR_GNSS_SDR_VALVE_H_ #define GNSS_SDR_GNSS_SDR_VALVE_H_ +#include "concurrent_queue.h" #include -#include // for msg_queue, msg_queue::sptr #include // for sync_block #include // for gr_vector_const_void_star -#include // for size_t +#include +#include // for size_t #include class Gnss_Sdr_Valve; @@ -46,12 +47,12 @@ class Gnss_Sdr_Valve; boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - gr::msg_queue::sptr queue, + std::shared_ptr> queue, bool stop_flowgraph); /*! @@ -71,21 +72,21 @@ private: friend boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); friend boost::shared_ptr gnss_sdr_make_valve( size_t sizeof_stream_item, uint64_t nitems, - gr::msg_queue::sptr queue, + std::shared_ptr> queue, bool stop_flowgraph); Gnss_Sdr_Valve(size_t sizeof_stream_item, uint64_t nitems, - gr::msg_queue::sptr queue, bool stop_flowgraph); + std::shared_ptr> queue, bool stop_flowgraph); uint64_t d_nitems; uint64_t d_ncopied_items; - gr::msg_queue::sptr d_queue; + std::shared_ptr> d_queue; bool d_stop_flowgraph; bool d_open_valve; }; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 9a356c790..1ad718a41 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -56,7 +56,6 @@ target_link_libraries(telemetry_decoder_gr_blocks telemetry_decoder_libs core_system_parameters Gnuradio::runtime - Volkgnsssdr::volkgnsssdr Boost::boost PRIVATE Gflags::gflags diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc index c6f1eff5f..fa2fc8646 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.cc @@ -42,12 +42,10 @@ #include #include // for make_any #include // for mp -#include -#include -#include // for abs -#include // for exception -#include // for cout -#include // for shared_ptr, make_shared +#include // for abs +#include // for exception +#include // for cout +#include // for shared_ptr, make_shared #define CRC_ERROR_LIMIT 8 @@ -64,7 +62,7 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -78,7 +76,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; // Setting samples of preamble code @@ -94,7 +91,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( } } - d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble; d_symbol_history.set_capacity(d_required_symbols); @@ -118,9 +114,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs( beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs() { - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_subframe_symbols); - if (d_dump_file.is_open() == true) { try @@ -299,13 +292,8 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell // Update tel dec parameters for D2 NAV Messages if (sat_prn > 0 and sat_prn < 6) { - // Clear values from previous declaration - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_subframe_symbols); - d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; // Setting samples of preamble code @@ -322,20 +310,15 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell } d_symbol_duration_ms = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS; - d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble; d_symbol_history.set_capacity(d_required_symbols); } else { - // Clear values from previous declaration - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_subframe_symbols); //back to normal satellites d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; // Setting samples of preamble code @@ -351,7 +334,6 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell } } - d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble; d_symbol_history.set_capacity(d_required_symbols); } @@ -403,7 +385,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ auto **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer const auto **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer - Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block + Gnss_Synchro current_symbol{}; // structure to save the synchronization information and send the output object to the next block // 1. Copy the current tracking output current_symbol = in[0][0]; d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue @@ -470,7 +452,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ } // call the decoder - decode_subframe(d_subframe_symbols); + decode_subframe(d_subframe_symbols.data()); if (d_nav.flag_crc_test == true) { @@ -527,7 +509,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_ } // call the decoder - decode_subframe(d_subframe_symbols); + decode_subframe(d_subframe_symbols.data()); if (d_nav.flag_crc_test == true) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h index 9485008fd..feab58693 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b1i_telemetry_decoder_gs.h @@ -40,6 +40,7 @@ #include // for boost::shared_ptr #include // for block #include // for gr_vector_const_void_star +#include #include #include #include @@ -49,7 +50,9 @@ class beidou_b1i_telemetry_decoder_gs; using beidou_b1i_telemetry_decoder_gs_sptr = boost::shared_ptr; -beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); +beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); /*! @@ -63,7 +66,7 @@ public: void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_channel(int channel); //!< Set receiver's channel void reset(); - + /*! * \brief This is where all signal processing takes place */ @@ -71,21 +74,22 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend beidou_b1i_telemetry_decoder_gs_sptr - beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); + friend beidou_b1i_telemetry_decoder_gs_sptr beidou_b1i_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); + beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); void decode_subframe(float *symbols); void decode_word(int32_t word_counter, const float *enc_word_symbols, int32_t *dec_word_symbols); void decode_bch15_11_01(const int32_t *bits, int32_t *decbits); - // Preamble decoding - int32_t *d_preamble_samples; + std::array d_preamble_samples{}; int32_t d_symbols_per_preamble; int32_t d_samples_per_preamble; int32_t d_preamble_period_samples; - float *d_subframe_symbols; + std::array d_subframe_symbols{}; uint32_t d_required_symbols; // Storage for incoming data @@ -100,7 +104,7 @@ private: int32_t d_CRC_error_counter; // Number of failed CRC operations bool flag_SOW_set; // Indicates when time of week is set - //!< Navigation Message variable + // Navigation Message variable Beidou_Dnav_Navigation_Message d_nav; // Values to populate gnss synchronization structure diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index bae4a4a0f..53f0087cf 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -41,12 +41,10 @@ #include #include // for make_any #include // for mp -#include -#include -#include // for abs -#include // for exception -#include // for cout -#include // for shared_ptr, make_shared +#include // for abs +#include // for exception +#include // for cout +#include // for shared_ptr, make_shared #define CRC_ERROR_LIMIT 8 @@ -64,7 +62,7 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -78,7 +76,6 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; // Setting samples of preamble code @@ -94,7 +91,6 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( } } - d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble; d_symbol_history.set_capacity(d_required_symbols); @@ -118,9 +114,6 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs() { - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_subframe_symbols); - if (d_dump_file.is_open() == true) { try @@ -317,15 +310,8 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( // Update tel dec parameters for D2 NAV Messages if (sat_prn > 0 and sat_prn < 6) { - // Clear values from previous declaration - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_subframe_symbols); - - d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), - volk_gnsssdr_get_alignment())); d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; // Setting samples of preamble code @@ -341,22 +327,15 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( } } d_symbol_duration_ms = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS; - d_subframe_symbols = static_cast(volk_gnsssdr_malloc( - BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), - volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble; d_symbol_history.set_capacity(d_required_symbols); } else { - // Clear values from previous declaration - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_subframe_symbols); - //back to normal satellites + // back to normal satellites d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS; d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS; - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; // Setting samples of preamble code @@ -372,7 +351,6 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( } } - d_subframe_symbols = static_cast(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment())); d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble; d_symbol_history.set_capacity(d_required_symbols); } @@ -430,7 +408,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work( auto **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer const auto **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer - Gnss_Synchro current_symbol; // structure to save the synchronization + Gnss_Synchro current_symbol{}; // structure to save the synchronization // information and send the output object to the // next block // 1. Copy the current tracking output @@ -498,7 +476,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work( } // call the decoder - decode_subframe(d_subframe_symbols); + decode_subframe(d_subframe_symbols.data()); if (d_nav.flag_crc_test == true) { @@ -558,7 +536,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work( } // call the decoder - decode_subframe(d_subframe_symbols); + decode_subframe(d_subframe_symbols.data()); if (d_nav.flag_crc_test == true) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h index d08f8388e..dda4e483d 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h @@ -40,19 +40,19 @@ #include #include #include +#include class beidou_b3i_telemetry_decoder_gs; using beidou_b3i_telemetry_decoder_gs_sptr = boost::shared_ptr; -beidou_b3i_telemetry_decoder_gs_sptr -beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, +beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, bool dump); /*! * \brief This class implements a block that decodes the BeiDou DNAV data. - * */ class beidou_b3i_telemetry_decoder_gs : public gr::block { @@ -70,9 +70,10 @@ public: gr_vector_void_star &output_items); private: - friend beidou_b3i_telemetry_decoder_gs_sptr - beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, + friend beidou_b3i_telemetry_decoder_gs_sptr beidou_b3i_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, bool dump); + beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); void decode_subframe(float *symbols); @@ -81,11 +82,11 @@ private: void decode_bch15_11_01(const int32_t *bits, int32_t *decbits); // Preamble decoding - int32_t *d_preamble_samples; + std::array d_preamble_samples{}; int32_t d_symbols_per_preamble; int32_t d_samples_per_preamble; int32_t d_preamble_period_samples; - float *d_subframe_symbols; + std::array d_subframe_symbols{}; uint32_t d_required_symbols; // Storage for incoming data diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index bd029d005..8565a1172 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -43,12 +43,11 @@ #include #include // for make_any #include // for mp -#include -#include // for fmod -#include // for abs -#include // for exception -#include // for cout -#include // for shared_ptr, make_shared +#include // for fmod +#include // for abs +#include // for exception +#include // for cout +#include // for shared_ptr, make_shared #define CRC_ERROR_LIMIT 6 @@ -66,7 +65,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( bool dump) : gr::block("galileo_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -75,7 +74,6 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_last_valid_preamble = 0; d_sent_tlm_failed_msg = false; - // initialize internal vars d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); @@ -93,7 +91,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_preamble_period_symbols = GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS; d_required_symbols = static_cast(GALILEO_INAV_PAGE_SYMBOLS) + d_samples_per_preamble; // preamble bits to sampled symbols - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); + d_preamble_samples.reserve(d_samples_per_preamble); d_frame_length_symbols = GALILEO_INAV_PAGE_PART_SYMBOLS - GALILEO_INAV_PREAMBLE_LENGTH_BITS; CodeLength = GALILEO_INAV_PAGE_PART_SYMBOLS - GALILEO_INAV_PREAMBLE_LENGTH_BITS; DataLength = (CodeLength / nn) - mm; @@ -110,7 +108,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_preamble_period_symbols = GALILEO_FNAV_SYMBOLS_PER_PAGE; d_required_symbols = static_cast(GALILEO_FNAV_SYMBOLS_PER_PAGE) + d_samples_per_preamble; // preamble bits to sampled symbols - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); + d_preamble_samples.reserve(d_samples_per_preamble); d_frame_length_symbols = GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS; CodeLength = GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS; DataLength = (CodeLength / nn) - mm; @@ -121,7 +119,6 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_bits_per_preamble = 0; d_samples_per_preamble = 0; d_preamble_period_symbols = 0; - d_preamble_samples = nullptr; d_PRN_code_period_ms = 0U; d_required_symbols = 0U; d_frame_length_symbols = 0U; @@ -131,7 +128,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( std::cout << "Galileo unified telemetry decoder error: Unknown frame type " << std::endl; } - d_page_part_symbols = static_cast(volk_gnsssdr_malloc(d_frame_length_symbols * sizeof(double), volk_gnsssdr_get_alignment())); + d_page_part_symbols.reserve(d_frame_length_symbols); for (int32_t i = 0; i < d_bits_per_preamble; i++) { switch (d_frame_type) @@ -184,24 +181,18 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( int32_t max_states = 1U << static_cast(mm); // 2^mm g_encoder[0] = 121; // Polynomial G1 g_encoder[1] = 91; // Polynomial G2 - out0 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); - out1 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); - state0 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); - state1 = static_cast(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment())); + out0.reserve(max_states); + out1.reserve(max_states); + state0.reserve(max_states); + state1.reserve(max_states); // create appropriate transition matrices - nsc_transit(out0, state0, 0, g_encoder, KK, nn); - nsc_transit(out1, state1, 1, g_encoder, KK, nn); + nsc_transit(out0.data(), state0.data(), 0, g_encoder.data(), KK, nn); + nsc_transit(out1.data(), state1.data(), 1, g_encoder.data(), KK, nn); } galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs() { - volk_gnsssdr_free(d_preamble_samples); - volk_gnsssdr_free(d_page_part_symbols); - volk_gnsssdr_free(out0); - volk_gnsssdr_free(out1); - volk_gnsssdr_free(state0); - volk_gnsssdr_free(state1); if (d_dump_file.is_open() == true) { try @@ -218,7 +209,7 @@ galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs() void galileo_telemetry_decoder_gs::viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits) { - Viterbi(page_part_bits, out0, state0, out1, state1, + Viterbi(page_part_bits, out0.data(), state0.data(), out1.data(), state1.data(), page_part_symbols, KK, nn, DataLength); } @@ -238,8 +229,8 @@ void galileo_telemetry_decoder_gs::deinterleaver(int32_t rows, int32_t cols, con void galileo_telemetry_decoder_gs::decode_INAV_word(double *page_part_symbols, int32_t frame_length) { // 1. De-interleave - auto *page_part_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); - deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint); + std::vector page_part_symbols_deint(frame_length); + deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint.data()); // 2. Viterbi decoder // 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder) @@ -252,9 +243,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(double *page_part_symbols, i } } - auto *page_part_bits = static_cast(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment())); - viterbi_decoder(page_part_symbols_deint, page_part_bits); - volk_gnsssdr_free(page_part_symbols_deint); + std::vector page_part_bits(frame_length / 2); + viterbi_decoder(page_part_symbols_deint.data(), page_part_bits.data()); // 3. Call the Galileo page decoder std::string page_String; @@ -290,7 +280,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(double *page_part_symbols, i d_inav_nav.split_page(page_String, flag_even_word_arrived); flag_even_word_arrived = 1; } - volk_gnsssdr_free(page_part_bits); // 4. Push the new navigation data to the queues if (d_inav_nav.have_new_ephemeris() == true) @@ -332,8 +321,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(double *page_part_symbols, i void galileo_telemetry_decoder_gs::decode_FNAV_word(double *page_symbols, int32_t frame_length) { // 1. De-interleave - auto *page_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); - deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint); + std::vector page_symbols_deint(frame_length); + deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint.data()); // 2. Viterbi decoder // 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder) @@ -345,9 +334,8 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(double *page_symbols, int32_ page_symbols_deint[i] = -page_symbols_deint[i]; } } - auto *page_bits = static_cast(volk_gnsssdr_malloc((frame_length / 2) * sizeof(int32_t), volk_gnsssdr_get_alignment())); - viterbi_decoder(page_symbols_deint, page_bits); - volk_gnsssdr_free(page_symbols_deint); + std::vector page_bits(frame_length / 2); + viterbi_decoder(page_symbols_deint.data(), page_bits.data()); // 3. Call the Galileo page decoder std::string page_String; @@ -362,7 +350,6 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(double *page_symbols, int32_ page_String.push_back('0'); } } - volk_gnsssdr_free(page_bits); // DECODE COMPLETE WORD (even + odd) and TEST CRC d_fnav_nav.split_page(page_String); @@ -462,7 +449,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( d_symbol_history.push_back(current_symbol.Prompt_I); break; } - case 2: //FNAV + case 2: // FNAV { d_symbol_history.push_back(current_symbol.Prompt_Q); break; @@ -494,7 +481,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( { case 0: // no preamble information { - //correlate with preamble + // correlate with preamble int32_t corr_value = 0; if (d_symbol_history.size() > d_required_symbols) { @@ -522,7 +509,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( } case 1: // possible preamble lock { - //correlate with preamble + // correlate with preamble int32_t corr_value = 0; int32_t preamble_diff = 0; if (d_symbol_history.size() > d_required_symbols) @@ -594,7 +581,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( d_page_part_symbols[i] = -d_symbol_history.at(i + d_samples_per_preamble); // because last symbol of the preamble is just received now! } } - decode_INAV_word(d_page_part_symbols, d_frame_length_symbols); + decode_INAV_word(d_page_part_symbols.data(), d_frame_length_symbols); break; case 2: // FNAV // NEW Galileo page part is received @@ -619,7 +606,7 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__(( } } } - decode_FNAV_word(d_page_part_symbols, d_frame_length_symbols); + decode_FNAV_word(d_page_part_symbols.data(), d_frame_length_symbols); break; default: return -1; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h index 9d3ed657d..87202bfda 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h @@ -40,15 +40,20 @@ #include // for boost::shared_ptr #include // for block #include // for gr_vector_const_void_star +#include #include #include #include +#include class galileo_telemetry_decoder_gs; using galileo_telemetry_decoder_gs_sptr = boost::shared_ptr; -galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, int frame_type, bool dump); +galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + int frame_type, + bool dump); /*! * \brief This class implements a block that decodes the INAV and FNAV data defined in Galileo ICD @@ -69,8 +74,11 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend galileo_telemetry_decoder_gs_sptr - galileo_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, int frame_type, bool dump); + friend galileo_telemetry_decoder_gs_sptr galileo_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + int frame_type, + bool dump); + galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, int frame_type, bool dump); void viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits); @@ -84,11 +92,11 @@ private: int32_t d_bits_per_preamble; int32_t d_samples_per_preamble; int32_t d_preamble_period_symbols; - int32_t *d_preamble_samples; + std::vector d_preamble_samples; uint32_t d_PRN_code_period_ms; uint32_t d_required_symbols; uint32_t d_frame_length_symbols; - double *d_page_part_symbols; + std::vector d_page_part_symbols; boost::circular_buffer d_symbol_history; @@ -118,14 +126,17 @@ private: uint32_t d_TOW_at_current_symbol_ms; bool flag_TOW_set; - double delta_t; //GPS-GALILEO time offset + double delta_t; // GPS-GALILEO time offset std::string d_dump_filename; std::ofstream d_dump_file; // vars for Viterbi decoder - int32_t *out0, *out1, *state0, *state1; - int32_t g_encoder[2]{}; + std::vector out0; + std::vector out1; + std::vector state0; + std::vector state1; + std::array g_encoder{}; const int32_t nn = 2; // Coding rate 1/n const int32_t KK = 7; // Constraint Length int32_t mm = KK - 1; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc index 393e91433..874f8e808 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.cc @@ -38,13 +38,11 @@ #include #include // for make_any #include // for mp -#include -#include // for floor, round -#include // for abs, malloc -#include // for memcpy -#include // for exception -#include // for cout -#include // for shared_ptr, make_shared +#include // for floor, round +#include // for abs +#include // for exception +#include // for cout +#include // for shared_ptr, make_shared #define CRC_ERROR_LIMIT 6 @@ -61,7 +59,7 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs( bool dump) : gr::block("glonass_l1_ca_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -71,19 +69,8 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs( d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "Initializing GLONASS L1 CA TELEMETRY DECODING"; - // Define the number of sampes per symbol. Notice that GLONASS has 2 rates, - // one for the navigation data and the other for the preamble information - d_samples_per_symbol = (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS) / GLONASS_L1_CA_SYMBOL_RATE_BPS; - - // Set the preamble information - std::array preambles_bits{GLONASS_GNAV_PREAMBLE}; - // Since preamble rate is different than navigation data rate we use a constant - d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS; - - memcpy(static_cast(this->d_preambles_bits), preambles_bits.data(), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t)); // preamble bits to sampled symbols - d_preambles_symbols = static_cast(malloc(sizeof(int32_t) * d_symbols_per_preamble)); int32_t n = 0; for (uint16_t d_preambles_bit : d_preambles_bits) { @@ -120,7 +107,6 @@ glonass_l1_ca_telemetry_decoder_gs::glonass_l1_ca_telemetry_decoder_gs( glonass_l1_ca_telemetry_decoder_gs::~glonass_l1_ca_telemetry_decoder_gs() { - delete d_preambles_symbols; if (d_dump_file.is_open() == true) { try diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h index bd37b4905..5035c6217 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l1_ca_telemetry_decoder_gs.h @@ -41,6 +41,7 @@ #include // for boost::shared_ptr #include // for block #include // for gr_vector_const_void_star +#include #include #include // for ofstream #include @@ -50,7 +51,9 @@ class glonass_l1_ca_telemetry_decoder_gs; using glonass_l1_ca_telemetry_decoder_gs_sptr = boost::shared_ptr; -glonass_l1_ca_telemetry_decoder_gs_sptr glonass_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); +glonass_l1_ca_telemetry_decoder_gs_sptr glonass_l1_ca_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); /*! * \brief This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1 @@ -75,43 +78,45 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend glonass_l1_ca_telemetry_decoder_gs_sptr - glonass_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); + friend glonass_l1_ca_telemetry_decoder_gs_sptr glonass_l1_ca_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); + glonass_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); void decode_string(const double *symbols, int32_t frame_length); - //!< Help with coherent tracking + // Help with coherent tracking double d_preamble_time_samples; - //!< Preamble decoding - uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]{}; - int32_t *d_preambles_symbols; - uint32_t d_samples_per_symbol; - int32_t d_symbols_per_preamble; + // Preamble decoding + const std::array d_preambles_bits{GLONASS_GNAV_PREAMBLE}; + std::array d_preambles_symbols{}; + uint32_t d_samples_per_symbol = (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS) / GLONASS_L1_CA_SYMBOL_RATE_BPS; + const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS; - //!< Storage for incoming data + // Storage for incoming data boost::circular_buffer d_symbol_history; - //!< Variables for internal functionality - uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed - uint64_t d_preamble_index; //!< Index of sample number where preamble was found - uint32_t d_stat; //!< Status of decoder - bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved - bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check) - bool d_flag_preamble; //!< Flag indicating when preamble was found - int32_t d_CRC_error_counter; //!< Number of failed CRC operations - bool flag_TOW_set; //!< Indicates when time of week is set - double delta_t; //!< GPS-GLONASS time offset + // Variables for internal functionality + uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed + uint64_t d_preamble_index; // Index of sample number where preamble was found + uint32_t d_stat; // Status of decoder + bool d_flag_frame_sync; // Indicate when a frame sync is achieved + bool d_flag_parity; // Flag indicating when parity check was achieved (crc check) + bool d_flag_preamble; // Flag indicating when preamble was found + int32_t d_CRC_error_counter; // Number of failed CRC operations + bool flag_TOW_set; // Indicates when time of week is set + double delta_t; // GPS-GLONASS time offset - //!< Navigation Message variable + // Navigation Message variable Glonass_Gnav_Navigation_Message d_nav; - //!< Values to populate gnss synchronization structure + // Values to populate gnss synchronization structure double d_TOW_at_current_symbol; bool Flag_valid_word; - //!< Satellite Information and logging capacity + // Satellite Information and logging capacity Gnss_Satellite d_satellite; int32_t d_channel; bool d_dump; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc index 8caa6b928..005934cb9 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.cc @@ -38,13 +38,11 @@ #include #include // for make_any #include // for mp -#include -#include // for floor, round -#include // for abs, malloc -#include // for memcpy -#include // for exception -#include // for cout -#include // for shared_ptr, make_shared +#include // for floor, round +#include // for abs +#include // for exception +#include // for cout +#include // for shared_ptr, make_shared #define CRC_ERROR_LIMIT 6 @@ -61,7 +59,7 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs( bool dump) : gr::block("glonass_l2_ca_telemetry_decoder_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -71,19 +69,8 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs( d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "Initializing GLONASS L2 CA TELEMETRY DECODING"; - // Define the number of sampes per symbol. Notice that GLONASS has 2 rates, - // one for the navigation data and the other for the preamble information - d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS; - - // Set the preamble information - std::array preambles_bits{GLONASS_GNAV_PREAMBLE}; - // Since preamble rate is different than navigation data rate we use a constant - d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS; - - memcpy(static_cast(this->d_preambles_bits), preambles_bits.data(), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t)); // preamble bits to sampled symbols - d_preambles_symbols = static_cast(malloc(sizeof(int32_t) * d_symbols_per_preamble)); int32_t n = 0; for (uint16_t d_preambles_bit : d_preambles_bits) { @@ -105,9 +92,7 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs( d_sample_counter = 0ULL; d_stat = 0; d_preamble_index = 0ULL; - d_flag_frame_sync = false; - d_flag_parity = false; d_TOW_at_current_symbol = 0; Flag_valid_word = false; @@ -122,7 +107,6 @@ glonass_l2_ca_telemetry_decoder_gs::glonass_l2_ca_telemetry_decoder_gs( glonass_l2_ca_telemetry_decoder_gs::~glonass_l2_ca_telemetry_decoder_gs() { - delete d_preambles_symbols; if (d_dump_file.is_open() == true) { try diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h index ffe3f1ca4..04c24d0be 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_gs.h @@ -40,6 +40,7 @@ #include // for boost::shared_ptr #include #include // for gr_vector_const_void_star +#include #include #include #include @@ -49,7 +50,9 @@ class glonass_l2_ca_telemetry_decoder_gs; using glonass_l2_ca_telemetry_decoder_gs_sptr = boost::shared_ptr; -glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); +glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); /*! * \brief This class implements a block that decodes the GNAV data defined in GLONASS ICD v5.1 @@ -73,43 +76,45 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend glonass_l2_ca_telemetry_decoder_gs_sptr - glonass_l2_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); + friend glonass_l2_ca_telemetry_decoder_gs_sptr glonass_l2_ca_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); + glonass_l2_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); void decode_string(const double *symbols, int32_t frame_length); - //!< Help with coherent tracking + // Help with coherent tracking double d_preamble_time_samples; - //!< Preamble decoding - uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS]{}; - int32_t *d_preambles_symbols; - uint32_t d_samples_per_symbol; - int32_t d_symbols_per_preamble; + // Preamble decoding + const std::array d_preambles_bits{GLONASS_GNAV_PREAMBLE}; + std::array d_preambles_symbols{}; + uint32_t d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS; + const int32_t d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS; - //!< Storage for incoming data + // Storage for incoming data boost::circular_buffer d_symbol_history; - //!< Variables for internal functionality - uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed - uint64_t d_preamble_index; //!< Index of sample number where preamble was found - uint32_t d_stat; //!< Status of decoder - bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved - bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check) - bool d_flag_preamble; //!< Flag indicating when preamble was found - int32_t d_CRC_error_counter; //!< Number of failed CRC operations - bool flag_TOW_set; //!< Indicates when time of week is set - double delta_t; //!< GPS-GLONASS time offset + // Variables for internal functionality + uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed + uint64_t d_preamble_index; // Index of sample number where preamble was found + uint32_t d_stat; // Status of decoder + bool d_flag_frame_sync; // Indicate when a frame sync is achieved + bool d_flag_parity; // Flag indicating when parity check was achieved (crc check) + bool d_flag_preamble; // Flag indicating when preamble was found + int32_t d_CRC_error_counter; // Number of failed CRC operations + bool flag_TOW_set; // Indicates when time of week is set + double delta_t; // GPS-GLONASS time offset - //!< Navigation Message variable + // Navigation Message variable Glonass_Gnav_Navigation_Message d_nav; - //!< Values to populate gnss synchronization structure + // Values to populate gnss synchronization structure double d_TOW_at_current_symbol; bool Flag_valid_word; - //!< Satellite Information and logging capacity + // Satellite Information and logging capacity Gnss_Satellite d_satellite; int32_t d_channel; bool d_dump; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index 3b1542225..f8afde34e 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -37,13 +37,11 @@ #include #include // for make_any #include // for mp -#include -#include -#include // for round -#include // for memcpy -#include // for exception -#include // for cout -#include // for shared_ptr +#include // for round +#include // for memcpy +#include // for exception +#include // for cout +#include // for shared_ptr #ifndef _rotl @@ -63,7 +61,7 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( bool dump) : gr::block("gps_navigation_gs", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out @@ -73,7 +71,6 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( d_last_valid_preamble = 0; d_sent_tlm_failed_msg = false; - // initialize internal vars d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); @@ -85,7 +82,6 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( // set the preamble d_required_symbols = GPS_SUBFRAME_BITS; // preamble bits to sampled symbols - d_preamble_samples = static_cast(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment())); d_frame_length_symbols = GPS_SUBFRAME_BITS * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; d_max_symbols_without_valid_frame = d_required_symbols * 20; // rise alarm 120 segs without valid tlm int32_t n = 0; @@ -123,7 +119,6 @@ gps_l1_ca_telemetry_decoder_gs::gps_l1_ca_telemetry_decoder_gs( gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs() { - volk_gnsssdr_free(d_preamble_samples); if (d_dump_file.is_open() == true) { try diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h index cc01fb6b6..998480576 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.h @@ -39,6 +39,7 @@ #include // for boost::shared_ptr #include // for block #include // for gr_vector_const_void_star +#include // for array #include // for int32_t #include // for ofstream #include // for string @@ -48,12 +49,12 @@ class gps_l1_ca_telemetry_decoder_gs; using gps_l1_ca_telemetry_decoder_gs_sptr = boost::shared_ptr; -gps_l1_ca_telemetry_decoder_gs_sptr -gps_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); +gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); /*! * \brief This class implements a block that decodes the NAV data defined in IS-GPS-200E - * */ class gps_l1_ca_telemetry_decoder_gs : public gr::block { @@ -70,8 +71,9 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend gps_l1_ca_telemetry_decoder_gs_sptr - gps_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); + friend gps_l1_ca_telemetry_decoder_gs_sptr gps_l1_ca_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); gps_l1_ca_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); bool gps_word_parityCheck(uint32_t gpsword); @@ -80,7 +82,7 @@ private: int32_t d_bits_per_preamble; int32_t d_samples_per_preamble; int32_t d_preamble_period_symbols; - int32_t *d_preamble_samples; + std::array d_preamble_samples{}; uint32_t d_required_symbols; uint32_t d_frame_length_symbols; bool flag_PLL_180_deg_phase_locked; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc index e2702b374..4d6235ac8 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.cc @@ -1,7 +1,6 @@ /*! * \file gps_l2c_telemetry_decoder_gs.cc - * \brief Implementation of a NAV message demodulator block based on - * Kay Borre book MATLAB-based GPS receiver + * \brief Implementation of a NAV message demodulator block * \author Javier Arribas, 2015. jarribas(at)cttc.es * * ------------------------------------------------------------------------- @@ -60,7 +59,7 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs( gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -68,8 +67,7 @@ gps_l2c_telemetry_decoder_gs::gps_l2c_telemetry_decoder_gs( this->message_port_register_out(pmt::mp("telemetry_to_trk")); d_last_valid_preamble = 0; d_sent_tlm_failed_msg = false; - d_max_symbols_without_valid_frame = GPS_L2_CNAV_DATA_PAGE_BITS * GPS_L2_SYMBOLS_PER_BIT * 5; //rise alarm if 5 consecutive subframes have no valid CRC - + d_max_symbols_without_valid_frame = GPS_L2_CNAV_DATA_PAGE_BITS * GPS_L2_SYMBOLS_PER_BIT * 5; // rise alarm if 5 consecutive subframes have no valid CRC // initialize internal vars d_dump = dump; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h index 7f7737429..4380fcbda 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_gs.h @@ -1,7 +1,6 @@ /*! * \file gps_l2c_telemetry_decoder_gs.h - * \brief Interface of a CNAV message demodulator block based on - * Kay Borre book MATLAB-based GPS receiver + * \brief Interface of a CNAV message demodulator block * \author Javier Arribas, 2015. jarribas(at)cttc.es * ------------------------------------------------------------------------- * @@ -41,7 +40,8 @@ #include #include -extern "C" { +extern "C" +{ #include "cnav_msg.h" } @@ -50,12 +50,12 @@ class gps_l2c_telemetry_decoder_gs; using gps_l2c_telemetry_decoder_gs_sptr = boost::shared_ptr; -gps_l2c_telemetry_decoder_gs_sptr -gps_l2c_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); +gps_l2c_telemetry_decoder_gs_sptr gps_l2c_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); /*! - * \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229 - * + * \brief This class implements a block that decodes CNAV data defined in IS-GPS-200K */ class gps_l2c_telemetry_decoder_gs : public gr::block { @@ -64,6 +64,7 @@ public: void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_channel(int32_t channel); //!< Set receiver's channel void reset(); + /*! * \brief This is where all signal processing takes place */ @@ -71,8 +72,10 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend gps_l2c_telemetry_decoder_gs_sptr - gps_l2c_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); + friend gps_l2c_telemetry_decoder_gs_sptr gps_l2c_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); + gps_l2c_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); bool d_dump; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc index 26a52f3e3..81aeb61c8 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.cc @@ -58,7 +58,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { - //prevent telemetry symbols accumulation in output buffers + // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); @@ -66,7 +66,7 @@ gps_l5_telemetry_decoder_gs::gps_l5_telemetry_decoder_gs( this->message_port_register_out(pmt::mp("telemetry_to_trk")); d_last_valid_preamble = 0; d_sent_tlm_failed_msg = false; - d_max_symbols_without_valid_frame = GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10; //rise alarm if 20 consecutive subframes have no valid CRC + d_max_symbols_without_valid_frame = GPS_L5_CNAV_DATA_PAGE_BITS * GPS_L5_SYMBOLS_PER_BIT * 10; // rise alarm if 20 consecutive subframes have no valid CRC // initialize internal vars d_dump = dump; @@ -217,7 +217,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u // \code // symbolTime_ms = msg->tow * 6000 + *pdelay * 10 + (12 * 10); 12 symbols of the encoder's transitory - //check TOW update consistency + // check TOW update consistency uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms; d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5I_SYMBOL_PERIOD_MS; if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > GPS_L5I_SYMBOL_PERIOD_MS) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h index 9c49694d3..d7ef16e87 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_gs.h @@ -42,7 +42,8 @@ #include #include -extern "C" { +extern "C" +{ #include "cnav_msg.h" } @@ -51,8 +52,9 @@ class gps_l5_telemetry_decoder_gs; using gps_l5_telemetry_decoder_gs_sptr = boost::shared_ptr; -gps_l5_telemetry_decoder_gs_sptr -gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); +gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); /*! * \brief This class implements a GPS L5 Telemetry decoder @@ -69,8 +71,10 @@ public: gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); private: - friend gps_l5_telemetry_decoder_gs_sptr - gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); + friend gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs( + const Gnss_Satellite &satellite, + bool dump); + gps_l5_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump); bool d_dump; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.h index ae27ec8c7..ffaecd266 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.h @@ -114,10 +114,10 @@ private: private: int32_t d_n_smpls_in_history; double d_iir_par; - double d_corr_paired; - double d_corr_shifted; - bool d_aligned; - double d_past_sample; + double d_corr_paired{}; + double d_corr_shifted{}; + bool d_aligned{}; + double d_past_sample{}; } d_sample_aligner; // helper class for symbol alignment and Viterbi decoding diff --git a/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c b/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c index c6486412a..a8c2d1173 100644 --- a/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c +++ b/src/algorithms/telemetry_decoder/libs/libswiftcnav/viterbi27.c @@ -33,13 +33,13 @@ #include "fec.h" #include -static inline int parity(int x) +static inline unsigned int parity(unsigned int x) { - x ^= x >> 16; - x ^= x >> 8; - x ^= x >> 4; - x &= 0xf; - return (0x6996 >> x) & 1; + x ^= x >> 16U; + x ^= x >> 8U; + x ^= x >> 4U; + x &= 0xFU; + return (0x6996U >> x) & 1U; } @@ -101,12 +101,12 @@ void v27_init(v27_t *v, v27_decision_t *decisions, unsigned int decisions_count, m1 = v->old_metrics[(i) + 32] + (510 - metric); \ decision = (signed int)(m0 - m1) > 0; \ v->new_metrics[2 * (i)] = decision ? m1 : m0; \ - d->w[(i) / 16] |= decision << ((2 * (i)) & 31); \ + d->w[(i) / 16] |= decision << ((2U * (i)) & 31U); \ m0 -= (metric + metric - 510); \ m1 += (metric + metric - 510); \ decision = (signed int)(m0 - m1) > 0; \ v->new_metrics[2 * (i) + 1] = decision ? m1 : m0; \ - d->w[(i) / 16] |= decision << ((2 * (i) + 1) & 31); \ + d->w[(i) / 16] |= decision << ((2U * (i) + 1U) & 31U); \ } /** Update a v27_t decoder with a block of symbols. @@ -130,44 +130,44 @@ void v27_update(v27_t *v, const unsigned char *syms, int nbits) sym0 = *syms++; sym1 = *syms++; - BFLY(0); - BFLY(1); - BFLY(2); - BFLY(3); - BFLY(4); - BFLY(5); - BFLY(6); - BFLY(7); - BFLY(8); - BFLY(9); - BFLY(10); - BFLY(11); - BFLY(12); - BFLY(13); - BFLY(14); - BFLY(15); - BFLY(16); - BFLY(17); - BFLY(18); - BFLY(19); - BFLY(20); - BFLY(21); - BFLY(22); - BFLY(23); - BFLY(24); - BFLY(25); - BFLY(26); - BFLY(27); - BFLY(28); - BFLY(29); - BFLY(30); - BFLY(31); + BFLY(0U); + BFLY(1U); + BFLY(2U); + BFLY(3U); + BFLY(4U); + BFLY(5U); + BFLY(6U); + BFLY(7U); + BFLY(8U); + BFLY(9U); + BFLY(10U); + BFLY(11U); + BFLY(12U); + BFLY(13U); + BFLY(14U); + BFLY(15U); + BFLY(16U); + BFLY(17U); + BFLY(18U); + BFLY(19U); + BFLY(20U); + BFLY(21U); + BFLY(22U); + BFLY(23U); + BFLY(24U); + BFLY(25U); + BFLY(26U); + BFLY(27U); + BFLY(28U); + BFLY(29U); + BFLY(30U); + BFLY(31U); /* Normalize metrics if they are nearing overflow */ - if (v->new_metrics[0] > (1 << 30)) + if (v->new_metrics[0] > (1U << 30U)) { int i; - unsigned int minmetric = 1 << 31; + unsigned int minmetric = 1U << 31U; for (i = 0; i < 64; i++) { @@ -210,11 +210,11 @@ void v27_update(v27_t *v, const unsigned char *syms, int nbits) void v27_chainback_fixed(v27_t *v, unsigned char *data, unsigned int nbits, unsigned char final_state) { - int k; + unsigned int k; unsigned int decisions_index = v->decisions_index; final_state %= 64; - final_state <<= 2; + final_state <<= 2U; while (nbits-- != 0) { @@ -222,12 +222,12 @@ void v27_chainback_fixed(v27_t *v, unsigned char *data, unsigned int nbits, decisions_index = (decisions_index == 0) ? v->decisions_count - 1 : decisions_index - 1; v27_decision_t *d = &v->decisions[decisions_index]; - k = (d->w[(final_state >> 2) / 32] >> ((final_state >> 2) % 32)) & 1; + k = (d->w[(final_state >> 2U) / 32] >> ((final_state >> 2U) % 32)) & 1U; /* The store into data[] only needs to be done every 8 bits. * But this avoids a conditional branch, and the writes will * combine in the cache anyway */ - data[nbits >> 3] = final_state = (final_state >> 1) | (k << 7); + data[nbits >> 3U] = final_state = (final_state >> 1U) | (k << 7U); } } diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc index 9c1fe1c53..ddba31afb 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.cc @@ -51,17 +51,17 @@ Viterbi_Decoder::Viterbi_Decoder(const int g_encoder[], const int KK, const int // derived code properties d_mm = d_KK - 1; - d_states = 1 << d_mm; /* 2^mm */ - d_number_symbols = 1 << d_nn; /* 2^nn */ + d_states = 1U << d_mm; /* 2^mm */ + d_number_symbols = 1U << d_nn; /* 2^nn */ /* create appropriate transition matrices (trellis) */ - d_out0 = new int[d_states]; - d_out1 = new int[d_states]; - d_state0 = new int[d_states]; - d_state1 = new int[d_states]; + d_out0.reserve(d_states); + d_out1.reserve(d_states); + d_state0.reserve(d_states); + d_state1.reserve(d_states); - nsc_transit(d_out0, d_state0, 0, g_encoder, d_KK, d_nn); - nsc_transit(d_out1, d_state1, 1, g_encoder, d_KK, d_nn); + nsc_transit(d_out0.data(), d_state0.data(), 0, g_encoder, d_KK, d_nn); + nsc_transit(d_out1.data(), d_state1.data(), 1, g_encoder, d_KK, d_nn); // initialise trellis state d_trellis_state_is_initialised = false; @@ -69,21 +69,6 @@ Viterbi_Decoder::Viterbi_Decoder(const int g_encoder[], const int KK, const int } -Viterbi_Decoder::~Viterbi_Decoder() -{ - // trellis definition - delete[] d_out0; - delete[] d_out1; - delete[] d_state0; - delete[] d_state1; - - // init trellis state - delete[] d_pm_t; - delete[] d_rec_array; - delete[] d_metric_c; -} - - void Viterbi_Decoder::reset() { init_trellis_state(); @@ -153,16 +138,16 @@ void Viterbi_Decoder::init_trellis_state() if (d_trellis_state_is_initialised) { // init trellis state - delete[] d_pm_t; - delete[] d_rec_array; - delete[] d_metric_c; + d_pm_t.clear(); + d_rec_array.clear(); + d_metric_c.clear(); } // reserve new trellis state memory - d_pm_t = new float[d_states]; + d_pm_t.reserve(d_states); d_trellis_paths = std::deque(); - d_rec_array = new float[d_nn]; - d_metric_c = new float[d_number_symbols]; + d_rec_array.reserve(d_nn); + d_metric_c.reserve(d_number_symbols); d_trellis_state_is_initialised = true; /* initialize trellis */ @@ -182,7 +167,7 @@ int Viterbi_Decoder::do_acs(const double sym[], int nbits) int t, i, state_at_t; float metric; float max_val; - auto* pm_t_next = new float[d_states]; + std::vector pm_t_next(d_states); /* t: * - state: state at t @@ -208,7 +193,7 @@ int Viterbi_Decoder::do_acs(const double sym[], int nbits) /* precompute all possible branch metrics */ for (i = 0; i < d_number_symbols; i++) { - d_metric_c[i] = gamma(d_rec_array, i, d_nn); + d_metric_c[i] = gamma(d_rec_array.data(), i, d_nn); VLOG(LMORE) << "metric for (tx_sym=" << i << "|ry_sym=(" << d_rec_array[0] << ", " << d_rec_array[1] << ") = " << d_metric_c[i]; } @@ -267,8 +252,6 @@ int Viterbi_Decoder::do_acs(const double sym[], int nbits) } } - delete[] pm_t_next; - return t; } @@ -362,16 +345,15 @@ float Viterbi_Decoder::gamma(const float rec_array[], int symbol, int nn) { float rm = 0; int i; - int mask; + unsigned int mask = 1U; float txsym; - mask = 1; for (i = 0; i < nn; i++) { //if (symbol & mask) rm += rec_array[nn - i - 1]; txsym = symbol & mask ? 1 : -1; rm += txsym * rec_array[nn - i - 1]; - mask = mask << 1; + mask = mask << 1U; } //rm = rm > 50 ? rm : -1000; @@ -384,7 +366,7 @@ void Viterbi_Decoder::nsc_transit(int output_p[], int trans_p[], int input, cons { int nextstate[1]; int state, states; - states = (1 << (KK - 1)); /* The number of states: 2^mm */ + states = (1U << (KK - 1)); /* The number of states: 2^mm */ /* Determine the output and next state for each possible starting state */ for (state = 0; state < states; state++) @@ -452,11 +434,11 @@ int Viterbi_Decoder::nsc_enc_bit(int state_out_p[], int input, int state_in, int Viterbi_Decoder::parity_counter(int symbol, int length) { int counter; - int temp_parity = 0; + unsigned int temp_parity = 0; for (counter = 0; counter < length; counter++) { - temp_parity = temp_parity ^ (symbol & 1); - symbol = symbol >> 1; + temp_parity = temp_parity ^ (symbol & 1U); + symbol = symbol >> 1U; } return (temp_parity); } diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.h b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.h index 510673200..4fb242617 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder.h +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder.h @@ -34,6 +34,7 @@ #include // for size_t #include +#include /*! * \brief Class that implements a Viterbi decoder @@ -42,7 +43,7 @@ class Viterbi_Decoder { public: Viterbi_Decoder(const int g_encoder[], const int KK, const int nn); - ~Viterbi_Decoder(); + ~Viterbi_Decoder() = default; void reset(); /*! @@ -94,16 +95,16 @@ private: int d_number_symbols; // trellis definition - int* d_out0; - int* d_state0; - int* d_out1; - int* d_state1; + std::vector d_out0; + std::vector d_state0; + std::vector d_out1; + std::vector d_state1; // trellis state - float* d_pm_t; + std::vector d_pm_t; std::deque d_trellis_paths; - float* d_metric_c; /* Set of all possible branch metrics */ - float* d_rec_array; /* Received values for one trellis section */ + std::vector d_metric_c; /* Set of all possible branch metrics */ + std::vector d_rec_array; /* Received values for one trellis section */ bool d_trellis_state_is_initialised; // measures diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index 2077d6abc..7841c9a46 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -542,19 +542,11 @@ void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg) int tlm_event; tlm_event = boost::any_cast(pmt::any_ref(msg)); - switch (tlm_event) + if (tlm_event == 1) { - case 1: // tlm fault in current channel - { - DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel; - gr::thread::scoped_lock lock(d_setlock); - d_carrier_lock_fail_counter = 200000; //force loss-of-lock condition - break; - } - default: - { - break; - } + DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel; + gr::thread::scoped_lock lock(d_setlock); + d_carrier_lock_fail_counter = 200000; //force loss-of-lock condition } } } diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index d565e8fa1..cfb8ff79b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -163,7 +163,7 @@ private: double d_carrier_phase_step_rad; double d_carrier_phase_rate_step_rad; boost::circular_buffer> d_carr_ph_history; - + // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; float d_rem_carr_phase_rad; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 14e7fe4cf..cad74581f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -446,6 +446,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga & d_sample_counter_next = 0ULL; } + void dll_pll_veml_tracking_fpga::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg) { try @@ -455,19 +456,11 @@ void dll_pll_veml_tracking_fpga::msg_handler_telemetry_to_trk(const pmt::pmt_t & int tlm_event; tlm_event = boost::any_cast(pmt::any_ref(msg)); - switch (tlm_event) + if (tlm_event == 1) { - case 1: //tlm fault in current channel - { - DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel; - gr::thread::scoped_lock lock(d_setlock); - d_carrier_lock_fail_counter = 10000; //force loss-of-lock condition - break; - } - default: - { - break; - } + DLOG(INFO) << "Telemetry fault received in ch " << this->d_channel; + gr::thread::scoped_lock lock(d_setlock); + d_carrier_lock_fail_counter = 10000; // force loss-of-lock condition } } } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 32225d25f..5615a0fe9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -188,7 +188,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - std::array Signal_; + std::array Signal_{}; std::memcpy(Signal_.data(), d_acquisition_gnss_synchro->Signal, 3); // generate local reference ALWAYS starting at chip 1 (2 samples per chip) diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h index 565d862a5..8c3f15c58 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_kf_tracking_cc.h @@ -166,7 +166,7 @@ private: // Tracking_2nd_PLL_filter d_carrier_loop_filter; // acquisition - double d_acq_carrier_doppler_step_hz; + double d_acq_carrier_doppler_step_hz{}; double d_acq_code_phase_samples; double d_acq_carrier_doppler_hz; // correlator @@ -184,7 +184,7 @@ private: double d_carrier_dopplerrate_hz2; double d_carrier_phase_step_rad; double d_acc_carrier_phase_rad; - double d_carr_phase_error_rad; + double d_carr_phase_error_rad{}; double d_carr_phase_sigma2; double d_code_phase_samples; double code_error_chips; diff --git a/src/algorithms/tracking/libs/tcp_communication.cc b/src/algorithms/tracking/libs/tcp_communication.cc index d7012f95d..d68c80733 100644 --- a/src/algorithms/tracking/libs/tcp_communication.cc +++ b/src/algorithms/tracking/libs/tcp_communication.cc @@ -76,7 +76,7 @@ int Tcp_Communication::listen_tcp_connection(size_t d_port_, size_t d_port_ch0_) void Tcp_Communication::send_receive_tcp_packet_galileo_e1(boost::array buf, Tcp_Packet_Data* tcp_data_) { int controlc = 0; - boost::array readbuf; + boost::array readbuf{}; float d_control_id_ = buf.data()[0]; try @@ -111,7 +111,7 @@ void Tcp_Communication::send_receive_tcp_packet_galileo_e1(boost::array buf, Tcp_Packet_Data* tcp_data_) { int controlc = 0; - boost::array readbuf; + boost::array readbuf{}; float d_control_id_ = buf.data()[0]; try diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index a61dd6e2b..6a074d5a7 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -24,6 +24,8 @@ set(CORE_LIBS_SOURCES string_converter.cc gnss_sdr_supl_client.cc gnss_sdr_sample_counter.cc + channel_status_msg_receiver.cc + channel_event.cc ) set(CORE_LIBS_HEADERS @@ -32,6 +34,8 @@ set(CORE_LIBS_HEADERS string_converter.h gnss_sdr_supl_client.h gnss_sdr_sample_counter.h + channel_status_msg_receiver.h + channel_event.h ) if(ENABLE_FPGA) @@ -60,6 +64,7 @@ target_link_libraries(core_libs Gnuradio::runtime core_libs_supl core_system_parameters + pvt_libs PRIVATE Boost::serialization Gflags::gflags diff --git a/src/core/libs/channel_event.cc b/src/core/libs/channel_event.cc new file mode 100644 index 000000000..7c6862d76 --- /dev/null +++ b/src/core/libs/channel_event.cc @@ -0,0 +1,42 @@ +/*! + * \file channel_event.cc + * \brief Class that defines a channel event + * \author Javier Arribas, 2019. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2019 (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. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#include "channel_event.h" + +channel_event_sptr channel_event_make(int channel_id, int event_type) +{ + return channel_event_sptr(new channel_event(channel_id, event_type)); +} + +channel_event::channel_event(int channel_id_, int event_type_) +{ + channel_id = channel_id_; + event_type = event_type_; +} diff --git a/src/core/libs/channel_event.h b/src/core/libs/channel_event.h new file mode 100644 index 000000000..51c1a3a8f --- /dev/null +++ b/src/core/libs/channel_event.h @@ -0,0 +1,53 @@ +/*! + * \file channel_event.h + * \brief Class that defines a channel event + * \author Javier Arribas, 2019. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2019 (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. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_CHANNEL_EVENT_H +#define GNSS_SDR_CHANNEL_EVENT_H + +#include + +class channel_event; + +using channel_event_sptr = std::shared_ptr; + +channel_event_sptr channel_event_make(int channel_id, int event_type); + +class channel_event +{ +public: + int channel_id; + int event_type; +private: + friend channel_event_sptr channel_event_make(int channel_id, int event_type); + channel_event(int channel_id_, int event_type_); + +}; + +#endif diff --git a/src/core/libs/channel_status_msg_receiver.cc b/src/core/libs/channel_status_msg_receiver.cc new file mode 100644 index 000000000..2dd58bc4f --- /dev/null +++ b/src/core/libs/channel_status_msg_receiver.cc @@ -0,0 +1,116 @@ +/*! + * \file channel_status_msg_receiver.cc + * \brief GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks + * \author Javier Arribas, 2016. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (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. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + + +#include "channel_status_msg_receiver.h" +#include +#include +#include +#include +#include +#include +#include + + +channel_status_msg_receiver_sptr channel_status_msg_receiver_make() +{ + return channel_status_msg_receiver_sptr(new channel_status_msg_receiver()); +} + + +channel_status_msg_receiver::channel_status_msg_receiver() : gr::block("channel_status_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) +{ + this->message_port_register_in(pmt::mp("status")); + this->set_msg_handler(pmt::mp("status"), boost::bind(&channel_status_msg_receiver::msg_handler_events, this, _1)); + d_pvt_status.RX_time = -1; // to indicate that the PVT is not available +} + + +channel_status_msg_receiver::~channel_status_msg_receiver() = default; + + +void channel_status_msg_receiver::msg_handler_events(const pmt::pmt_t& msg) +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_events function called by the scheduler + try + { + // ************* Gnss_Synchro received ***************** + if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) + { + std::shared_ptr gnss_synchro_obj; + gnss_synchro_obj = boost::any_cast>(pmt::any_ref(msg)); + if (gnss_synchro_obj->Flag_valid_pseudorange == true) + { + d_channel_status_map[gnss_synchro_obj->Channel_ID] = gnss_synchro_obj; + } + else + { + d_channel_status_map.erase(gnss_synchro_obj->Channel_ID); + } + + // std::cout << "-------- \n\n"; + // for (std::map>::iterator it = d_channel_status_map.begin(); it != d_channel_status_map.end(); ++it) + // { + // std::cout << " Channel: " << it->first << " => Doppler: " << it->second->Carrier_Doppler_hz << "[Hz] \n"; + // } + // std::cout << "-------- \n\n"; + } + else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) + { + // ************* Monitor_Pvt received ***************** + std::shared_ptr monitor_pvt_obj; + monitor_pvt_obj = boost::any_cast>(pmt::any_ref(msg)); + d_pvt_status = *monitor_pvt_obj.get(); + // + // std::cout << "-------- \n\n"; + // std::cout << "PVT TOW: " << d_pvt_status->TOW_at_current_symbol_ms << std::endl; + // std::cout << "-------- \n\n"; + } + else + { + LOG(WARNING) << "channel_status_msg_receiver unknown object type!"; + } + } + catch (boost::bad_any_cast& e) + { + LOG(WARNING) << "channel_status_msg_receiver Bad any cast!"; + } +} + +std::map> channel_status_msg_receiver::get_current_status_map() +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_events function called by the scheduler + return d_channel_status_map; +} +Monitor_Pvt channel_status_msg_receiver::get_current_status_pvt() +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_events function called by the scheduler + return d_pvt_status; +} diff --git a/src/core/libs/channel_status_msg_receiver.h b/src/core/libs/channel_status_msg_receiver.h new file mode 100644 index 000000000..a4259834e --- /dev/null +++ b/src/core/libs/channel_status_msg_receiver.h @@ -0,0 +1,71 @@ +/*! + * \file channel_msg_receiver_cc.h + * \brief GNU Radio block that receives asynchronous channel messages from acquisition and tracking blocks + * \author Javier Arribas, 2016. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (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. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_CHANNEL_STATUS_MSG_RECEIVER_CC_H +#define GNSS_SDR_CHANNEL_STATUS_MSG_RECEIVER_CC_H + +#include "gnss_synchro.h" +#include "monitor_pvt.h" +#include +#include +#include + +class channel_status_msg_receiver; + +using channel_status_msg_receiver_sptr = boost::shared_ptr; + +channel_status_msg_receiver_sptr channel_status_msg_receiver_make(); + +/*! + * \brief GNU Radio block that receives asynchronous channel messages from tlm blocks + */ +class channel_status_msg_receiver : public gr::block +{ +public: + ~channel_status_msg_receiver(); //!< Default destructor + /*! + * \brief return the current status map of all channels with valid telemetry + */ + std::map> get_current_status_map(); + /*! + * \brief return the current receiver PVT + */ + Monitor_Pvt get_current_status_pvt(); + +private: + friend channel_status_msg_receiver_sptr channel_status_msg_receiver_make(); + channel_status_msg_receiver(); + std::map> d_channel_status_map; + + Monitor_Pvt d_pvt_status{}; + void msg_handler_events(const pmt::pmt_t& msg); +}; + +#endif diff --git a/src/core/libs/supl/asn-rrlp/NativeInteger.c b/src/core/libs/supl/asn-rrlp/NativeInteger.c index bf3939e88..0a10c5d88 100644 --- a/src/core/libs/supl/asn-rrlp/NativeInteger.c +++ b/src/core/libs/supl/asn-rrlp/NativeInteger.c @@ -92,7 +92,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * ASN.1 encoded INTEGER: buf_ptr, length * Fill the native, at the same time checking for overflow. - * If overflow occured, return with RC_FAIL. + * If overflow occurred, return with RC_FAIL. */ { INTEGER_t tmp; @@ -153,7 +153,7 @@ NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, tmp.buf = buf; tmp.size = sizeof(buf); #endif /* WORDS_BIGENDIAN */ - + /* Encode fake INTEGER */ erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); if(erval.encoded == -1) { @@ -182,7 +182,7 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, } memset(&st, 0, sizeof(st)); - rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, opt_mname, buf_ptr, size); if(rval.code == RC_OK) { long l; @@ -329,4 +329,3 @@ NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { FREEMEM(ptr); } } - diff --git a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c index 98aebb3bf..ef080b27b 100644 --- a/src/core/libs/supl/asn-rrlp/OCTET_STRING.c +++ b/src/core/libs/supl/asn-rrlp/OCTET_STRING.c @@ -107,7 +107,7 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { /* * The main reason why ASN.1 is still alive is that too much time and effort * is necessary for learning it more or less adequately, thus creating a gut - * necessity to demonstrate that aquired skill everywhere afterwards. + * necessity to demonstrate that acquired skill everywhere afterwards. * No, I am not going to explain what the following stuff is. */ struct _stack_el { @@ -141,7 +141,7 @@ OS__add_stack_el(struct _stack *st) { nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); if(nel == NULL) return NULL; - + if(st->tail) { /* Increase a subcontainment depth */ nel->cont_level = st->tail->cont_level + 1; @@ -728,7 +728,7 @@ OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size return 0; } } - + return -1; /* No, it's not */ } @@ -1571,7 +1571,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, csiz->lower_bound, csiz->upper_bound, csiz->effective_bits, ct_extensible ? " EXT" : ""); - /* Figure out wheter size lies within PER visible constraint */ + /* Figure out whether size lies within PER visible constraint */ if(csiz->effective_bits >= 0) { if((int)sizeinunits < csiz->lower_bound @@ -1802,4 +1802,3 @@ OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { return st; } - diff --git a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c index 42708760e..fde2549cc 100644 --- a/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c +++ b/src/core/libs/supl/asn-rrlp/ber_tlv_tag.c @@ -42,7 +42,7 @@ ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { */ if(val >> ((8 * sizeof(val)) - 9)) { /* - * We would not be able to accomodate + * We would not be able to accommodate * any more tag bits. */ return -1; @@ -141,4 +141,3 @@ ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { return required_size + 1; } - diff --git a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c index 1bf467254..456dd64c6 100644 --- a/src/core/libs/supl/asn-rrlp/constr_CHOICE.c +++ b/src/core/libs/supl/asn-rrlp/constr_CHOICE.c @@ -134,7 +134,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - + /* * Start to parse where left previously */ @@ -156,7 +156,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } if(ctx->left >= 0) { - /* ?Substracted below! */ + /* ?Subtracted below! */ ctx->left += rval.consumed; } ADVANCE(rval.consumed); @@ -273,7 +273,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, case RC_FAIL: /* Fatal error */ RETURN(rval.code); } /* switch(rval) */ - + ADVANCE(rval.consumed); } while(0); @@ -349,7 +349,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* No meaningful work here */ break; } - + RETURN(RC_OK); } @@ -904,7 +904,7 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, elm->name, td->name, rv.code); return rv; } - + asn_enc_rval_t CHOICE_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -984,7 +984,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td, _ASN_ENCODED_OK(rval); } } - + int CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, diff --git a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c index aba19bd26..72ef20c79 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c +++ b/src/core/libs/supl/asn-rrlp/constr_SEQUENCE.c @@ -130,7 +130,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, int edx; /* SEQUENCE element's index */ ASN_DEBUG("Decoding %s as SEQUENCE", td->name); - + /* * Create the target structure if it is not present already. */ @@ -145,7 +145,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - + /* * Start to parse where left previously */ @@ -166,7 +166,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Substracted below! */ + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); NEXT_PHASE(ctx); @@ -389,7 +389,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ctx->step |= 1; /* Confirm entering next microphase */ microphase2: ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); - + /* * Compute the position of the member inside a structure, * and also a type of containment (it may be contained @@ -431,7 +431,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, case RC_FAIL: /* Fatal error */ RETURN(RC_FAIL); } /* switch(rval) */ - + ADVANCE(rval.consumed); } /* for(all structure members) */ @@ -501,7 +501,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, PHASE_OUT(ctx); } - + RETURN(RC_OK); } @@ -1420,4 +1420,3 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, _ASN_ENCODED_OK(er); } - diff --git a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c index 8b9c0669a..d6a2a90ea 100644 --- a/src/core/libs/supl/asn-rrlp/constr_SET_OF.c +++ b/src/core/libs/supl/asn-rrlp/constr_SET_OF.c @@ -86,7 +86,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as SET OF", td->name); - + /* * Create the target structure if it is not present already. */ @@ -101,7 +101,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - + /* * Start to parse where left previously */ @@ -122,7 +122,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Substracted below! */ + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); ASN_DEBUG("Structure consumes %ld bytes, " @@ -201,7 +201,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, */ ctx->step |= 1; /* Confirm entering next microphase */ microphase2: - + /* * Invoke the member fetch routine according to member's type */ @@ -231,7 +231,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ctx->ptr = 0; RETURN(RC_FAIL); } /* switch(rval) */ - + ADVANCE(rval.consumed); } /* for(all list members) */ @@ -260,7 +260,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, PHASE_OUT(ctx); } - + RETURN(RC_OK); } @@ -884,7 +884,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, if(!st) { st = *sptr = CALLOC(1, specs->struct_size); if(!st) _ASN_DECODE_FAILED; - } + } list = _A_SET_FROM_VOID(st); /* Figure out which constraints to use */ @@ -950,4 +950,3 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, rv.consumed = 0; return rv; } - diff --git a/src/core/libs/supl/asn-rrlp/constr_TYPE.h b/src/core/libs/supl/asn-rrlp/constr_TYPE.h index 0641f003c..d2716b2a0 100644 --- a/src/core/libs/supl/asn-rrlp/constr_TYPE.h +++ b/src/core/libs/supl/asn-rrlp/constr_TYPE.h @@ -162,8 +162,8 @@ extern "C" { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ int el_no; /* Index of the associated member, base 0 */ - int toff_first; /* First occurence of the el_tag, relative */ - int toff_last; /* Last occurence of the el_tag, relatvie */ + int toff_first; /* First occurrence of the el_tag, relative */ + int toff_last; /* Last occurrence of the el_tag, relatvie */ } asn_TYPE_tag2member_t; /* diff --git a/src/core/libs/supl/asn-rrlp/converter-sample.c b/src/core/libs/supl/asn-rrlp/converter-sample.c index af980a1d6..1213a1299 100644 --- a/src/core/libs/supl/asn-rrlp/converter-sample.c +++ b/src/core/libs/supl/asn-rrlp/converter-sample.c @@ -2,9 +2,9 @@ * Generic converter template for a selected ASN.1 type. * Copyright (c) 2005, 2006, 2007 Lev Walkin . * All rights reserved. - * + * * To compile with your own ASN.1 type, please redefine the PDU as shown: - * + * * cc -DPDU=MyCustomType -o myDecoder.o -c converter-sample.c */ #ifdef HAVE_CONFIG_H @@ -32,7 +32,7 @@ extern asn_TYPE_descriptor_t *asn_pdu_collection[]; #endif /* - * Open file and parse its contens. + * Open file and parse its contents. */ static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *name, ssize_t suggested_bufsize, int first_pdu); @@ -96,7 +96,7 @@ main(int ac, char *av[]) { iform = INP_PER; /* - * Pocess the command-line argments. + * Process the command-line arguments. */ while((ch = getopt(ac, av, "i:o:1b:cdn:p:hs:" JUNKOPT)) != -1) switch(ch) { @@ -390,14 +390,14 @@ buffer_dump() { /* * Move the buffer content left N bits, possibly joining it with - * preceeding content. + * preceding content. */ static void buffer_shift_left(size_t offset, int bits) { uint8_t *ptr = DynamicBuffer.data + DynamicBuffer.offset + offset; uint8_t *end = DynamicBuffer.data + DynamicBuffer.offset + DynamicBuffer.length - 1; - + if(!bits) return; DEBUG("Shifting left %d bits off %ld (o=%ld, u=%ld, l=%ld)", @@ -480,7 +480,7 @@ buffer_shift_left(size_t offset, int bits) { (long)DynamicBuffer.offset, (long)DynamicBuffer.unbits, (long)DynamicBuffer.length); - + } @@ -555,7 +555,7 @@ data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *na asn_codec_ctx_t *opt_codec_ctx = 0; void *structure = 0; asn_dec_rval_t rval; - size_t old_offset; + size_t old_offset; size_t new_offset; int tolerate_eof; size_t rd; @@ -831,4 +831,3 @@ junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) { } } #endif /* JUNKTEST */ - diff --git a/src/core/libs/supl/asn-rrlp/per_support.h b/src/core/libs/supl/asn-rrlp/per_support.h index c99f12291..321122b68 100644 --- a/src/core/libs/supl/asn-rrlp/per_support.h +++ b/src/core/libs/supl/asn-rrlp/per_support.h @@ -58,7 +58,7 @@ extern "C" */ int32_t per_get_few_bits(asn_per_data_t *per_data, int get_nbits); - /* Undo the immediately preceeding "get_few_bits" operation */ + /* Undo the immediately preceding "get_few_bits" operation */ void per_get_undo(asn_per_data_t *per_data, int get_nbits); /* diff --git a/src/core/libs/supl/asn-rrlp/xer_support.h b/src/core/libs/supl/asn-rrlp/xer_support.h index 13d8bbd06..5cc56c5f6 100644 --- a/src/core/libs/supl/asn-rrlp/xer_support.h +++ b/src/core/libs/supl/asn-rrlp/xer_support.h @@ -21,7 +21,7 @@ extern "C" PXML_TEXT, /* Plain text between XML tags. */ PXML_TAG, /* A tag, starting with '<'. */ PXML_COMMENT, /* An XML comment, including "". */ - /* + /* * The following chunk types are reported if the chunk * terminates the specified XML element. */ @@ -31,10 +31,10 @@ extern "C" /* * Callback function that is called by the parser when parsed data is - * available. The _opaque is the pointer to a field containing opaque user - * data specified in pxml_create() call. The chunk type is _type and the text + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the text * data is the piece of buffer identified by _bufid (as supplied to - * pxml_feed() call) starting at offset _offset and of _size bytes size. + * pxml_feed() call) starting at offset _offset and of _size bytes size. * The chunk is NOT '\0'-terminated. */ typedef int(pxml_callback_f)(pxml_chunk_type_e _type, @@ -42,8 +42,8 @@ extern "C" /* * Parse the given buffer as it were a chunk of XML data. - * Invoke the specified callback each time the meaninful data is found. - * This function returns number of bytes consumed from the bufer. + * Invoke the specified callback each time the meaningful data is found. + * This function returns number of bytes consumed from the buffer. * It will always be lesser than or equal to the specified _size. * The next invocation of this function must account the difference. */ diff --git a/src/core/libs/supl/asn-supl/NativeInteger.c b/src/core/libs/supl/asn-supl/NativeInteger.c index 76140a22e..88b9a712c 100644 --- a/src/core/libs/supl/asn-supl/NativeInteger.c +++ b/src/core/libs/supl/asn-supl/NativeInteger.c @@ -92,7 +92,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, /* * ASN.1 encoded INTEGER: buf_ptr, length * Fill the native, at the same time checking for overflow. - * If overflow occured, return with RC_FAIL. + * If overflow occurred, return with RC_FAIL. */ { INTEGER_t tmp; @@ -153,7 +153,7 @@ NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr, tmp.buf = buf; tmp.size = sizeof(buf); #endif /* WORDS_BIGENDIAN */ - + /* Encode fake INTEGER */ erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key); if(erval.encoded == -1) { @@ -182,7 +182,7 @@ NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, } memset(&st, 0, sizeof(st)); - rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, + rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr, opt_mname, buf_ptr, size); if(rval.code == RC_OK) { long l; @@ -329,4 +329,3 @@ NativeInteger_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { FREEMEM(ptr); } } - diff --git a/src/core/libs/supl/asn-supl/OCTET_STRING.c b/src/core/libs/supl/asn-supl/OCTET_STRING.c index 98aebb3bf..ef080b27b 100644 --- a/src/core/libs/supl/asn-supl/OCTET_STRING.c +++ b/src/core/libs/supl/asn-supl/OCTET_STRING.c @@ -107,7 +107,7 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = { /* * The main reason why ASN.1 is still alive is that too much time and effort * is necessary for learning it more or less adequately, thus creating a gut - * necessity to demonstrate that aquired skill everywhere afterwards. + * necessity to demonstrate that acquired skill everywhere afterwards. * No, I am not going to explain what the following stuff is. */ struct _stack_el { @@ -141,7 +141,7 @@ OS__add_stack_el(struct _stack *st) { nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el)); if(nel == NULL) return NULL; - + if(st->tail) { /* Increase a subcontainment depth */ nel->cont_level = st->tail->cont_level + 1; @@ -728,7 +728,7 @@ OCTET_STRING__handle_control_chars(void *struct_ptr, const void *chunk_buf, size return 0; } } - + return -1; /* No, it's not */ } @@ -1571,7 +1571,7 @@ OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, csiz->lower_bound, csiz->upper_bound, csiz->effective_bits, ct_extensible ? " EXT" : ""); - /* Figure out wheter size lies within PER visible constraint */ + /* Figure out whether size lies within PER visible constraint */ if(csiz->effective_bits >= 0) { if((int)sizeinunits < csiz->lower_bound @@ -1802,4 +1802,3 @@ OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td, const char *str, int len) { return st; } - diff --git a/src/core/libs/supl/asn-supl/ber_tlv_tag.c b/src/core/libs/supl/asn-supl/ber_tlv_tag.c index 42708760e..fde2549cc 100644 --- a/src/core/libs/supl/asn-supl/ber_tlv_tag.c +++ b/src/core/libs/supl/asn-supl/ber_tlv_tag.c @@ -42,7 +42,7 @@ ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) { */ if(val >> ((8 * sizeof(val)) - 9)) { /* - * We would not be able to accomodate + * We would not be able to accommodate * any more tag bits. */ return -1; @@ -141,4 +141,3 @@ ber_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) { return required_size + 1; } - diff --git a/src/core/libs/supl/asn-supl/constr_CHOICE.c b/src/core/libs/supl/asn-supl/constr_CHOICE.c index 1bf467254..456dd64c6 100644 --- a/src/core/libs/supl/asn-supl/constr_CHOICE.c +++ b/src/core/libs/supl/asn-supl/constr_CHOICE.c @@ -134,7 +134,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - + /* * Start to parse where left previously */ @@ -156,7 +156,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } if(ctx->left >= 0) { - /* ?Substracted below! */ + /* ?Subtracted below! */ ctx->left += rval.consumed; } ADVANCE(rval.consumed); @@ -273,7 +273,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, case RC_FAIL: /* Fatal error */ RETURN(rval.code); } /* switch(rval) */ - + ADVANCE(rval.consumed); } while(0); @@ -349,7 +349,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, /* No meaningful work here */ break; } - + RETURN(RC_OK); } @@ -904,7 +904,7 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, elm->name, td->name, rv.code); return rv; } - + asn_enc_rval_t CHOICE_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { @@ -984,7 +984,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td, _ASN_ENCODED_OK(rval); } } - + int CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, diff --git a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c index aba19bd26..72ef20c79 100644 --- a/src/core/libs/supl/asn-supl/constr_SEQUENCE.c +++ b/src/core/libs/supl/asn-supl/constr_SEQUENCE.c @@ -130,7 +130,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, int edx; /* SEQUENCE element's index */ ASN_DEBUG("Decoding %s as SEQUENCE", td->name); - + /* * Create the target structure if it is not present already. */ @@ -145,7 +145,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - + /* * Start to parse where left previously */ @@ -166,7 +166,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Substracted below! */ + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); NEXT_PHASE(ctx); @@ -389,7 +389,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ctx->step |= 1; /* Confirm entering next microphase */ microphase2: ASN_DEBUG("Inside SEQUENCE %s MF2", td->name); - + /* * Compute the position of the member inside a structure, * and also a type of containment (it may be contained @@ -431,7 +431,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, case RC_FAIL: /* Fatal error */ RETURN(RC_FAIL); } /* switch(rval) */ - + ADVANCE(rval.consumed); } /* for(all structure members) */ @@ -501,7 +501,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, PHASE_OUT(ctx); } - + RETURN(RC_OK); } @@ -1420,4 +1420,3 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, _ASN_ENCODED_OK(er); } - diff --git a/src/core/libs/supl/asn-supl/constr_SET_OF.c b/src/core/libs/supl/asn-supl/constr_SET_OF.c index 8b9c0669a..d6a2a90ea 100644 --- a/src/core/libs/supl/asn-supl/constr_SET_OF.c +++ b/src/core/libs/supl/asn-supl/constr_SET_OF.c @@ -86,7 +86,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ssize_t consumed_myself = 0; /* Consumed bytes from ptr */ ASN_DEBUG("Decoding %s as SET OF", td->name); - + /* * Create the target structure if it is not present already. */ @@ -101,7 +101,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, * Restore parsing context. */ ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset); - + /* * Start to parse where left previously */ @@ -122,7 +122,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, } if(ctx->left >= 0) - ctx->left += rval.consumed; /* ?Substracted below! */ + ctx->left += rval.consumed; /* ?Subtracted below! */ ADVANCE(rval.consumed); ASN_DEBUG("Structure consumes %ld bytes, " @@ -201,7 +201,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, */ ctx->step |= 1; /* Confirm entering next microphase */ microphase2: - + /* * Invoke the member fetch routine according to member's type */ @@ -231,7 +231,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ctx->ptr = 0; RETURN(RC_FAIL); } /* switch(rval) */ - + ADVANCE(rval.consumed); } /* for(all list members) */ @@ -260,7 +260,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, PHASE_OUT(ctx); } - + RETURN(RC_OK); } @@ -884,7 +884,7 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, if(!st) { st = *sptr = CALLOC(1, specs->struct_size); if(!st) _ASN_DECODE_FAILED; - } + } list = _A_SET_FROM_VOID(st); /* Figure out which constraints to use */ @@ -950,4 +950,3 @@ SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, rv.consumed = 0; return rv; } - diff --git a/src/core/libs/supl/asn-supl/constr_TYPE.h b/src/core/libs/supl/asn-supl/constr_TYPE.h index 0641f003c..d2716b2a0 100644 --- a/src/core/libs/supl/asn-supl/constr_TYPE.h +++ b/src/core/libs/supl/asn-supl/constr_TYPE.h @@ -162,8 +162,8 @@ extern "C" { ber_tlv_tag_t el_tag; /* Outmost tag of the member */ int el_no; /* Index of the associated member, base 0 */ - int toff_first; /* First occurence of the el_tag, relative */ - int toff_last; /* Last occurence of the el_tag, relatvie */ + int toff_first; /* First occurrence of the el_tag, relative */ + int toff_last; /* Last occurrence of the el_tag, relatvie */ } asn_TYPE_tag2member_t; /* diff --git a/src/core/libs/supl/asn-supl/per_support.h b/src/core/libs/supl/asn-supl/per_support.h index 7ea76d331..77ffe1335 100644 --- a/src/core/libs/supl/asn-supl/per_support.h +++ b/src/core/libs/supl/asn-supl/per_support.h @@ -58,7 +58,7 @@ extern "C" */ int32_t per_get_few_bits(asn_per_data_t *pd, int get_nbits); - /* Undo the immediately preceeding "get_few_bits" operation */ + /* Undo the immediately preceding "get_few_bits" operation */ void per_get_undo(asn_per_data_t *pd, int get_nbits); /* diff --git a/src/core/libs/supl/asn-supl/xer_support.h b/src/core/libs/supl/asn-supl/xer_support.h index e28316d59..12ee67e4d 100644 --- a/src/core/libs/supl/asn-supl/xer_support.h +++ b/src/core/libs/supl/asn-supl/xer_support.h @@ -21,7 +21,7 @@ extern "C" PXML_TEXT, /* Plain text between XML tags. */ PXML_TAG, /* A tag, starting with '<'. */ PXML_COMMENT, /* An XML comment, including "". */ - /* + /* * The following chunk types are reported if the chunk * terminates the specified XML element. */ @@ -31,10 +31,10 @@ extern "C" /* * Callback function that is called by the parser when parsed data is - * available. The _opaque is the pointer to a field containing opaque user - * data specified in pxml_create() call. The chunk type is _type and the text + * available. The _opaque is the pointer to a field containing opaque user + * data specified in pxml_create() call. The chunk type is _type and the text * data is the piece of buffer identified by _bufid (as supplied to - * pxml_feed() call) starting at offset _offset and of _size bytes size. + * pxml_feed() call) starting at offset _offset and of _size bytes size. * The chunk is NOT '\0'-terminated. */ typedef int(pxml_callback_f)(pxml_chunk_type_e _type, @@ -42,8 +42,8 @@ extern "C" /* * Parse the given buffer as it were a chunk of XML data. - * Invoke the specified callback each time the meaninful data is found. - * This function returns number of bytes consumed from the bufer. + * Invoke the specified callback each time the meaningful data is found. + * This function returns number of bytes consumed from the buffer. * It will always be lesser than or equal to the specified _size. * The next invocation of this function must account the difference. */ diff --git a/src/core/libs/supl/asn/rrlp-components.asn b/src/core/libs/supl/asn/rrlp-components.asn index 14ed9392a..0c1faff8b 100644 --- a/src/core/libs/supl/asn/rrlp-components.asn +++ b/src/core/libs/supl/asn/rrlp-components.asn @@ -36,7 +36,7 @@ MsrPosition-Req ::= SEQUENCE { extensionContainer ExtensionContainer OPTIONAL, ..., -- Release 98 extension element -rel98-MsrPosition-Req-extension Rel98-MsrPosition-Req-Extension OPTIONAL, +rel98-MsrPosition-Req-extension Rel98-MsrPosition-Req-Extension OPTIONAL, -- Release 5 extension element rel5-MsrPosition-Req-extension Rel5-MsrPosition-Req-Extension OPTIONAL -- Release 7 extension element @@ -44,7 +44,7 @@ rel5-MsrPosition-Req-extension Rel5-MsrPosition-Req-Extension OPTIONAL } --- add this defintion to RRLP-Components module +-- add this definition to RRLP-Components module -- Measurement Position response component MsrPosition-Rsp ::= SEQUENCE { @@ -55,9 +55,9 @@ MsrPosition-Rsp ::= SEQUENCE { gps-MeasureInfo GPS-MeasureInfo OPTIONAL, locationError LocationError OPTIONAL, extensionContainer ExtensionContainer OPTIONAL, - ..., + ..., -- Release extension here - rel-98-MsrPosition-Rsp-Extension + rel-98-MsrPosition-Rsp-Extension Rel-98-MsrPosition-Rsp-Extension OPTIONAL, rel-5-MsrPosition-Rsp-Extension Rel-5-MsrPosition-Rsp-Extension OPTIONAL @@ -68,14 +68,14 @@ MsrPosition-Rsp ::= SEQUENCE { } --- add this defintion to RRLP-Components module +-- add this definition to RRLP-Components module -- Assistance Data component AssistanceData ::= SEQUENCE { referenceAssistData ReferenceAssistData OPTIONAL, msrAssistData MsrAssistData OPTIONAL, systemInfoAssistData SystemInfoAssistData OPTIONAL, - gps-AssistData GPS-AssistData OPTIONAL, + gps-AssistData GPS-AssistData OPTIONAL, moreAssDataToBeSent MoreAssDataToBeSent OPTIONAL, -- If not present, interpret as only -- Assistance Data component used to -- deliver entire set of assistance @@ -85,15 +85,15 @@ AssistanceData ::= SEQUENCE { -- Release extension here rel98-AssistanceData-Extension Rel98-AssistanceData-Extension OPTIONAL, rel5-AssistanceData-Extension Rel5-AssistanceData-Extension OPTIONAL --- rel7-AssistanceData-Extension Rel7-AssistanceData-Extension OPTIONAL +-- rel7-AssistanceData-Extension Rel7-AssistanceData-Extension OPTIONAL } --- add this defintion to RRLP-Components module +-- add this definition to RRLP-Components module -- Protocol Error component ProtocolError ::= SEQUENCE { - errorCause ErrorCodes, + errorCause ErrorCodes, extensionContainer ExtensionContainer OPTIONAL, ..., -- Release extensions here @@ -101,15 +101,15 @@ ProtocolError ::= SEQUENCE { } --- add these defintions to RRLP-Components module +-- add these definitions to RRLP-Components module -- Position instructions PositionInstruct ::= SEQUENCE { -- Method type - methodType MethodType, + methodType MethodType, positionMethod PositionMethod, - measureResponseTime MeasureResponseTime, - useMultipleSets UseMultipleSets, - environmentCharacter EnvironmentCharacter OPTIONAL + measureResponseTime MeasureResponseTime, + useMultipleSets UseMultipleSets, + environmentCharacter EnvironmentCharacter OPTIONAL } -- @@ -250,7 +250,7 @@ ReferenceWGS84 ::= SEQUENCE { relativeAlt RelativeAlt OPTIONAL -- relative altitude } --- Fine RTD value between this BTS and the reference BTS +-- Fine RTD value between this BTS and the reference BTS FineRTD ::= INTEGER (0..255) -- Relative north/east distance @@ -264,7 +264,7 @@ RelativeAlt ::= INTEGER (-4000..4000) -- Multiple sets MultipleSets ::= SEQUENCE { -- number of reference sets - nbrOfSets INTEGER (2..3), + nbrOfSets INTEGER (2..3), -- This field actually tells the number of reference BTSs nbrOfReferenceBTSs INTEGER (1..3), @@ -274,7 +274,7 @@ MultipleSets ::= SEQUENCE { referenceRelation ReferenceRelation OPTIONAL } --- Relation between refence BTSs and sets +-- Relation between reference BTSs and sets ReferenceRelation ::= ENUMERATED { secondBTSThirdSet (0), -- 1st BTS related to 1st and 2nd sets secondBTSSecondSet (1), -- 1st BTS related to 1st and 3rd sets @@ -369,7 +369,7 @@ OTD-FirstSetMsrs ::= OTD-MeasurementWithID -- Neighbour info in OTD measurements 0-10 times in TD measurement info OTD-MsrsOfOtherSets ::= CHOICE { - identityNotPresent OTD-Measurement, + identityNotPresent OTD-Measurement, identityPresent OTD-MeasurementWithID } @@ -441,7 +441,7 @@ GPS-MeasureInfo ::= SEQUENCE { -- Measurement info elements -- user has to make sure that in this element is number of elements -- defined in reference BTS identity - gpsMsrSetList SeqOfGPS-MsrSetElement + gpsMsrSetList SeqOfGPS-MsrSetElement } SeqOfGPS-MsrSetElement ::= SEQUENCE (SIZE(1..3)) OF GPS-MsrSetElement @@ -472,7 +472,7 @@ GPS-MsrElement ::= SEQUENCE { -- the receiver shall consider a value of 1024 to be -- invalid data mpathIndic MpathIndic, -- multipath indicator - pseuRangeRMSErr INTEGER (0..63) -- index + pseuRangeRMSErr INTEGER (0..63) -- index } -- Multipath indicator @@ -491,7 +491,7 @@ LocationError ::= SEQUENCE { } LocErrorReason ::= ENUMERATED { - unDefined (0), + unDefined (0), notEnoughBTSs (1), notEnoughSats (2), eotdLocCalAssDataMissing (3), @@ -503,7 +503,7 @@ LocErrorReason ::= ENUMERATED { refBTSForGPSNotServingBTS (9), refBTSForEOTDNotServingBTS (10), ..., - notEnoughGANSSSats (11), + notEnoughGANSSSats (11), ganssAssDataMissing (12), refBTSForGANSSNotServingBTS (13) } @@ -539,11 +539,11 @@ maxGANSSAssistanceData INTEGER ::= 40 -- Protocol Error Causes ErrorCodes ::= ENUMERATED { unDefined (0), -missingComponet (1), -incorrectData (2), -missingIEorComponentElement (3), -messageTooShort (4), -unknowReferenceNumber (5), +missingComponet (1), +incorrectData (2), +missingIEorComponentElement (3), +messageTooShort (4), +unknowReferenceNumber (5), ... } @@ -655,7 +655,7 @@ DGPSCorrections ::= SEQUENCE { gpsTOW INTEGER (0..604799), -- DGPS reference time status INTEGER (0..7), -- N_SAT can be read from number of elements of satList - satList SeqOfSatElement + satList SeqOfSatElement } SeqOfSatElement ::= SEQUENCE (SIZE (1..16)) OF SatElement @@ -666,20 +666,20 @@ SatElement ::= SEQUENCE { --- Sequence number for ephemeris iode INTEGER (0..239), -- User Differential Range Error - udre INTEGER (0..3), + udre INTEGER (0..3), -- Pseudo Range Correction, range is -- -655.04 - +655.04, - pseudoRangeCor INTEGER (-2047..2047), + pseudoRangeCor INTEGER (-2047..2047), -- Pseudo Range Rate Correction, range is -- -4.064 - +4.064, rangeRateCor INTEGER (-127..127), --- Delta Pseudo Range Correction 2 +-- Delta Pseudo Range Correction 2 deltaPseudoRangeCor2 INTEGER (-127..127), -- This IE shall be ignored by the receiver and -- set to zero by the sender - -- Delta Pseudo Range Correction 2 + -- Delta Pseudo Range Correction 2 deltaRangeRateCor2 INTEGER (-7..7), -- This IE shall be ignored by the receiver and -- set to zero by the sender -- Delta Pseudo Range Correction 3 @@ -693,14 +693,14 @@ SatElement ::= SEQUENCE { SatelliteID ::= INTEGER (0..63) -- identifies satellite -- Navigation Model IE NavigationModel ::= SEQUENCE { - navModelList SeqOfNavModelElement + navModelList SeqOfNavModelElement } -- navigation model satellite list SeqOfNavModelElement ::= SEQUENCE (SIZE(1..16)) OF NavModelElement NavModelElement ::= SEQUENCE { - satelliteID SatelliteID, + satelliteID SatelliteID, satStatus SatStatus -- satellite status } @@ -790,7 +790,7 @@ Almanac ::= SEQUENCE { -- navigation model satellite list. -- The size of almanacList is actually Nums_Sats_Total field - almanacList SeqOfAlmanacElement + almanacList SeqOfAlmanacElement } SeqOfAlmanacElement ::= SEQUENCE (SIZE(1..64)) OF AlmanacElement @@ -818,7 +818,7 @@ AcquisAssist ::= SEQUENCE { -- Acquisition assistance list -- The size of Number of Satellites is actually Number of Satellites field - acquisList SeqOfAcquisElement + acquisList SeqOfAcquisElement } SeqOfAcquisElement ::= SEQUENCE (SIZE(1..16)) OF AcquisElement @@ -829,13 +829,13 @@ TimeRelation ::= SEQUENCE { gsmTime GSMTime OPTIONAL } --- data occuring per number of satellites +-- data occurring per number of satellites AcquisElement ::= SEQUENCE { svid SatelliteID, -- Doppler 0th order term, -- -5120.0 - 5117.5 Hz (= -2048 - 2047 with 2.5 Hz resolution) - doppler0 INTEGER (-2048..2047), + doppler0 INTEGER (-2048..2047), addionalDoppler AddionalDopplerFields OPTIONAL, codePhase INTEGER (0..1022), -- Code Phase intCodePhase INTEGER (0..19), -- Integer Code Phase @@ -869,15 +869,15 @@ SeqOf-BadSatelliteSet ::= SEQUENCE (SIZE(1..16)) OF SatelliteID -- Release 98 Extensions here Rel98-MsrPosition-Req-Extension ::= SEQUENCE { rel98-Ext-ExpOTD Rel98-Ext-ExpOTD OPTIONAL, -- ExpectedOTD extension - ..., - gpsTimeAssistanceMeasurementRequest NULL OPTIONAL, + ..., + gpsTimeAssistanceMeasurementRequest NULL OPTIONAL, gpsReferenceTimeUncertainty GPSReferenceTimeUncertainty OPTIONAL -- Further R98 extensions here } Rel98-AssistanceData-Extension ::= SEQUENCE { rel98-Ext-ExpOTD Rel98-Ext-ExpOTD OPTIONAL, -- ExpectedOTD extension - ..., + ..., gpsTimeAssistanceMeasurementRequest NULL OPTIONAL, gpsReferenceTimeUncertainty GPSReferenceTimeUncertainty OPTIONAL @@ -939,7 +939,7 @@ AssistBTSData-R98-ExpOTD ::= SEQUENCE { ExpectedOTD ::= INTEGER (0..1250) -- The ExpectedOTD value 1250 shall not be encoded by the transmitting entity and -- shall be treated by the receiving entity as 0. --- Uncertainty of Exptected OTD in bits +-- Uncertainty of Expected OTD in bits ExpOTDUncertainty ::= INTEGER(0..7) -- Release 98 extensions @@ -959,8 +959,8 @@ Rel-98-MsrPosition-Rsp-Extension ::= SEQUENCE { rel-98-Ext-MeasureInfo SEQUENCE { otd-MeasureInfo-R98-Ext OTD-MeasureInfo-R98-Ext OPTIONAL }, - ..., - timeAssistanceMeasurements GPSTimeAssistanceMeasurements OPTIONAL + ..., + timeAssistanceMeasurements GPSTimeAssistanceMeasurements OPTIONAL -- Further R98 extensions here } @@ -1049,7 +1049,7 @@ velocityRequested NULL OPTIONAL, ganssTODGSMTimeAssociationMeasurementRequest NULL OPTIONAL, requiredResponseTime RequiredResponseTime OPTIONAL, ... - -- Further Release 7 extentions here + -- Further Release 7 extensions here } -- additional satellite systems may be added in future versions of the protocol @@ -1113,7 +1113,7 @@ GANSSTOD ::= INTEGER (0 .. 86399) -- GANSS TOD uncertainty GANSSTODUncertainty ::= INTEGER (0 .. 127) -- Coding according to Annex --- GANSS TOD-GSM Time association +-- GANSS TOD-GSM Time association GANSSTOD-GSMTimeAssociation ::= SEQUENCE { bcchCarrier BCCHCarrier, -- BCCH carrier bsic BSIC, -- BSIC @@ -1140,7 +1140,7 @@ GANSSIonosphericModel ::= SEQUENCE { ... } --- GANSS ionosphere model. Coding according to Annex +-- GANSS ionosphere model. Coding according to Annex GANSSIonosphereModel ::= SEQUENCE { ai0 INTEGER (0 .. 4095), ai1 INTEGER (0 .. 4095), @@ -1169,7 +1169,7 @@ GANSSTimeModelElement ::= SEQUENCE { tA1 TA1 OPTIONAL, tA2 TA2 OPTIONAL, gnssTOID INTEGER (0 .. 7), - weekNumber INTEGER (0 .. 8191) OPTIONAL + weekNumber INTEGER (0 .. 8191) OPTIONAL } -- GANSS time model parameter A0 @@ -1210,11 +1210,11 @@ DGANSSSgnElement ::= SEQUENCE { iod INTEGER (0 .. 1023), -- User Differential Range Error - udre INTEGER (0..3), + udre INTEGER (0..3), -- Pseudo Range Correction, range is -- -655.04 - +655.04, - pseudoRangeCor INTEGER (-2047..2047), + pseudoRangeCor INTEGER (-2047..2047), -- Pseudo Range Rate Correction, range is -- -4.064 - +4.064, @@ -1226,7 +1226,7 @@ SVID ::= INTEGER (0 .. 63) -- Coding according to Annex -- GANSS Navigation Model IE GANSSNavModel ::= SEQUENCE { nonBroadcastIndFlag INTEGER (0 .. 1), - toeMSB INTEGER (0 .. 31) OPTIONAL, -- 5 MSB of toe and toc + toeMSB INTEGER (0 .. 31) OPTIONAL, -- 5 MSB of toe and toc eMSB INTEGER (0 .. 127) OPTIONAL, sqrtAMBS INTEGER (0 .. 63) OPTIONAL, ganssSatelliteList SeqOfGANSSSatelliteElement @@ -1238,14 +1238,14 @@ GANSSSatelliteElement ::= SEQUENCE { svID SVID, svHealth INTEGER (-7 .. 13), -- Coding according to Annex iod INTEGER (0 .. 1023), -- Coding according to Annex - ganssClockModel GANSSClockModel, - ganssOrbitModel GANSSOrbitModel, + ganssClockModel GANSSClockModel, + ganssOrbitModel GANSSOrbitModel, ... } -- GANSS orbit model for the GNSS satellite according to the choice GANSSOrbitModel ::= CHOICE { - keplerianSet NavModel-KeplerianSet, + keplerianSet NavModel-KeplerianSet, ... } @@ -1271,7 +1271,7 @@ NavModel-KeplerianSet ::= SEQUENCE { -- GANSS clock model for the GNSS satellite according to the choice GANSSClockModel ::= CHOICE { - standardClockModelList SeqOfStandardClockModelElement, + standardClockModelList SeqOfStandardClockModelElement, ... } @@ -1279,13 +1279,13 @@ SeqOfStandardClockModelElement ::= SEQUENCE (SIZE(1..2)) OF StandardClockModelEl StandardClockModelElement ::= SEQUENCE { stanClockTocLSB INTEGER (0 .. 511), -- 9LSB of time of clock - stanClockAF2 INTEGER (-2048 .. 2047), - stanClockAF1 INTEGER (-131072 .. 131071), + stanClockAF2 INTEGER (-2048 .. 2047), + stanClockAF1 INTEGER (-131072 .. 131071), stanClockAF0 INTEGER (-134217728 .. 134217727), stanClockTgd INTEGER (-512 .. 511) OPTIONAL, stanModelID INTEGER (0 .. 1) OPTIONAL, ... -} +} -- GANSS Real-Time Integrity IE GANSSRealTimeIntegrity ::= SEQUENCE { @@ -1316,7 +1316,7 @@ SeqOf-GANSSDataBits ::= SEQUENCE (SIZE(1 .. 1024)) OF GANSSDataBit GANSSDataBit ::= INTEGER(0 .. 1) -- GANSS Reference Measurement Assistance IE --- Code and Doppler assistance from the network. +-- Code and Doppler assistance from the network. GANSSRefMeasurementAssist ::= SEQUENCE { ganssSignalID INTEGER (0 .. 3) OPTIONAL, -- Coding according to Annex ganssRefMeasAssitList SeqOfGANSSRefMeasurementElement @@ -1357,9 +1357,9 @@ SVIDMASK ::= BIT STRING (SIZE (1..36)) SeqOfGANSSAlmanacElement ::= SEQUENCE (SIZE(1 .. 36)) OF GANSSAlmanacElement --- GANSS Almanac Model +-- GANSS Almanac Model GANSSAlmanacElement ::= CHOICE { - keplerianAlmanacSet Almanac-KeplerianSet, + keplerianAlmanacSet Almanac-KeplerianSet, ... } @@ -1389,7 +1389,7 @@ GANSSUTCModel ::= SEQUENCE { ganssUtcDeltaTlsf INTEGER (-128..127) } ---Required Measurement Request Response Time, range is 1 to 128 seconds. +--Required Measurement Request Response Time, range is 1 to 128 seconds. RequiredResponseTime ::= INTEGER (1..128) Rel-7-MsrPosition-Rsp-Extension ::= SEQUENCE { @@ -1405,7 +1405,7 @@ Rel-7-MsrPosition-Rsp-Extension ::= SEQUENCE { -- Further Release 7 extensions here } --- GANSS Location Information contains location estimate, time stamp with uncertainty +-- GANSS Location Information contains location estimate, time stamp with uncertainty -- and optionally Reference Frame field GANSSLocationInfo ::= SEQUENCE { referenceFrame ReferenceFrame OPTIONAL, -- Reference Frame Number @@ -1415,7 +1415,7 @@ GANSSLocationInfo ::= SEQUENCE { ganssTimeID INTEGER (0 .. 3) OPTIONAL, -- Coding according to Annex fixType FixType, posData PositionData, - stationaryIndication INTEGER(0 .. 1) OPTIONAL, -- ‘0’ if moving or motion not known + stationaryIndication INTEGER(0 .. 1) OPTIONAL, -- ‘0’ if moving or motion not known -- Possible shapes carried in posEstimate are -- ellipsoid point, -- ellipsoid point with uncertainty circle @@ -1442,7 +1442,7 @@ ReferenceFrame ::= SEQUENCE { --- GANSS Measurement Information +-- GANSS Measurement Information GANSSMeasureInfo ::= SEQUENCE { -- Measurement info elements -- user has to make sure that in this element is number of elements @@ -1456,22 +1456,22 @@ GANSS-MsrSetElement ::= SEQUENCE { referenceFrame ReferenceFrame OPTIONAL, -- Reference Frame Number ganssTODm GANSSTODm OPTIONAL, -- GANSS TOD modulo deltaGNASSTOD INTEGER (0 .. 127) OPTIONAL, - ganssTODUncertainty GANSSTODUncertainty OPTIONAL, -- Coding accoring to Annex + ganssTODUncertainty GANSSTODUncertainty OPTIONAL, -- Coding according to Annex --N_SGN_TYPE can be read from number of elements of SeqOfGANSS-SgnTypeElement ganss-SgnTypeList SeqOfGANSS-SgnTypeElement } --- Measurements can be returned up to 6 different signal types +-- Measurements can be returned up to 6 different signal types SeqOfGANSS-SgnTypeElement ::= SEQUENCE (SIZE(1..6)) OF GANSS-SgnTypeElement GANSS-SgnTypeElement ::= SEQUENCE { - ganssSignalID INTEGER (0 .. 15), -- Coding accroding to Annex + ganssSignalID INTEGER (0 .. 15), -- Coding according to Annex --N_SGN can be read from number of elements of SeqOfGANSS-SgnElement ganss-SgnList SeqOfGANSS-SgnElement } --- Measurements can be returned up to 16 per signal types +-- Measurements can be returned up to 16 per signal types SeqOfGANSS-SgnElement ::= SEQUENCE (SIZE(1..16)) OF GANSS-SgnElement @@ -1482,7 +1482,7 @@ GANSS-SgnElement ::= SEQUENCE { carrierQualityInd INTEGER (0 .. 3) OPTIONAL, -- Coding according to Annex codePhase INTEGER (0 .. 2097151), integerCodePhase INTEGER (0 .. 63) OPTIONAL, - codePhaseRMSError INTEGER (0..63), -- Coding accoring to Annex + codePhaseRMSError INTEGER (0..63), -- Coding according to Annex doppler INTEGER (-32768 .. 32767) OPTIONAL, adr INTEGER (0 .. 33554431) OPTIONAL } diff --git a/src/core/libs/supl/supl.c b/src/core/libs/supl/supl.c index 035496591..8cacb8019 100644 --- a/src/core/libs/supl/supl.c +++ b/src/core/libs/supl/supl.c @@ -469,7 +469,7 @@ static int pdu_make_ulp_pos_init(supl_ctx_t *ctx, supl_ulp_t *pdu) ulp->message.choice.msSUPLPOSINIT.sETCapabilities.posProtocol.rrlp = 1; //GNSS-SDR mod - // Use ctx->p.request to swith between a pre-defined set of assistence data request + // Use ctx->p.request to switch between a pre-defined set of assistance data request // reason: Some SUPL servers do not respond to Acquisition assistance depending on the status of other assistance flags switch (ctx->p.request) diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 83d684906..20c8b7ea0 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -19,17 +19,16 @@ set(GNSS_RECEIVER_SOURCES control_thread.cc - control_message_factory.cc file_configuration.cc gnss_block_factory.cc gnss_flowgraph.cc in_memory_configuration.cc tcp_cmd_interface.cc + command_event.cc ) set(GNSS_RECEIVER_HEADERS control_thread.h - control_message_factory.h file_configuration.h gnss_block_factory.h gnss_flowgraph.h @@ -38,6 +37,7 @@ set(GNSS_RECEIVER_HEADERS concurrent_map.h concurrent_queue.h control_message.h + command_event.h ) list(SORT GNSS_RECEIVER_HEADERS) diff --git a/src/core/receiver/command_event.cc b/src/core/receiver/command_event.cc new file mode 100644 index 000000000..771061255 --- /dev/null +++ b/src/core/receiver/command_event.cc @@ -0,0 +1,42 @@ +/*! + * \file command_event.cc + * \brief Class that defines a receiver command event + * \author Javier Arribas, 2019. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2019 (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. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#include "command_event.h" + +command_event_sptr command_event_make(int command_id, int event_type) +{ + return command_event_sptr(new command_event(command_id, event_type)); +} + +command_event::command_event(int command_id_, int event_type_) +{ + command_id = command_id_; + event_type = event_type_; +} diff --git a/src/core/receiver/command_event.h b/src/core/receiver/command_event.h new file mode 100644 index 000000000..094281578 --- /dev/null +++ b/src/core/receiver/command_event.h @@ -0,0 +1,53 @@ +/*! + * \file command_event.h + * \brief Class that defines a receiver command event + * \author Javier Arribas, 2019. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2019 (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. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_command_EVENT_H +#define GNSS_SDR_command_EVENT_H + +#include + +class command_event; + +using command_event_sptr = std::shared_ptr; + +command_event_sptr command_event_make(int command_id, int event_type); + +class command_event +{ +public: + int command_id; + int event_type; + +private: + friend command_event_sptr command_event_make(int command_id, int event_type); + command_event(int command_id_, int event_type_); +}; + +#endif diff --git a/src/core/receiver/control_message_factory.cc b/src/core/receiver/control_message_factory.cc deleted file mode 100644 index 566f884a4..000000000 --- a/src/core/receiver/control_message_factory.cc +++ /dev/null @@ -1,72 +0,0 @@ -/*! - * \file control_message_factory.cc - * \brief Implementation of a Control Message Factory - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2018 (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. - * - * GNSS-SDR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GNSS-SDR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNSS-SDR. If not, see . - * - * ------------------------------------------------------------------------- - */ - -#include "control_message_factory.h" -#include -#include // for memcpy -#include // for operator<<, basic_ostream - -// Constructor -ControlMessageFactory::ControlMessageFactory() = default; - - -// Destructor -ControlMessageFactory::~ControlMessageFactory() = default; - - -gr::message::sptr ControlMessageFactory::GetQueueMessage(unsigned int who, unsigned int what) -{ - std::shared_ptr control_message = std::make_shared(); - control_message->who = who; - control_message->what = what; - gr::message::sptr queue_message = gr::message::make(0, 0, 0, sizeof(ControlMessage)); - memcpy(queue_message->msg(), control_message.get(), sizeof(ControlMessage)); - return queue_message; -} - - -std::shared_ptr>> ControlMessageFactory::GetControlMessages(const gr::message::sptr queue_message) // NOLINT(performance-unnecessary-value-param) -{ - std::shared_ptr>> control_messages = std::make_shared>>(); - unsigned int control_messages_count = queue_message->length() / sizeof(ControlMessage); - if (queue_message->length() % sizeof(ControlMessage) != 0) - { - LOG(WARNING) << "Queue message has size " << queue_message->length() << ", which is not" - << " multiple of control message size " << sizeof(ControlMessage); - LOG(WARNING) << "Ignoring this queue message to prevent unexpected results."; - return control_messages; - } - for (unsigned int i = 0; i < control_messages_count; i++) - { - control_messages->push_back(std::make_shared()); - memcpy(control_messages->at(i).get(), queue_message->msg() + (i * sizeof(ControlMessage)), sizeof(ControlMessage)); - } - return control_messages; -} diff --git a/src/core/receiver/control_message_factory.h b/src/core/receiver/control_message_factory.h deleted file mode 100644 index f8a4666f6..000000000 --- a/src/core/receiver/control_message_factory.h +++ /dev/null @@ -1,64 +0,0 @@ -/*! - * \file control_message_factory.h - * \brief Interface of a factory for control messages. - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2018 (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. - * - * GNSS-SDR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GNSS-SDR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNSS-SDR. If not, see . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_CONTROL_MESSAGE_FACTORY_H_ -#define GNSS_SDR_CONTROL_MESSAGE_FACTORY_H_ - -#include -#include -#include - -//! Message described by who sent it and what it says -typedef struct control_message -{ - unsigned int who; - unsigned int what; -} ControlMessage; - - -/*! - * \brief This class implements a factory for Control Messages. - * - * It encapsulates the complexity behind getting Queue Messages and associated Control Messages - */ -class ControlMessageFactory -{ -public: - //! Constructor - ControlMessageFactory(); - - //! Virtual destructor - virtual ~ControlMessageFactory(); - - gr::message::sptr GetQueueMessage(unsigned int who, unsigned int what); - std::shared_ptr>> GetControlMessages(const gr::message::sptr queue_message); // NOLINT(performance-unnecessary-value-param) -}; - -#endif /*GNSS_SDR_CONTROL_MESSAGE_FACTORY_H_*/ diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 384d6f041..919a658a7 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -33,10 +33,10 @@ */ #include "control_thread.h" +#include "channel_event.h" +#include "command_event.h" #include "concurrent_map.h" -#include "concurrent_queue.h" #include "configuration_interface.h" -#include "control_message_factory.h" #include "file_configuration.h" #include "galileo_almanac.h" #include "galileo_ephemeris.h" @@ -62,9 +62,9 @@ #include "rtklib_rtkcmn.h" // for utc2gpst #include // for bad_lexical_cast #include // for LOG -#include // for message::sptr #include // for make_any #include // for find, min +#include // for array #include // for milliseconds #include // for floor, fmod, log #include // for gmtime, strftime @@ -110,7 +110,7 @@ ControlThread::ControlThread(std::shared_ptr configurati void ControlThread::init() { // Instantiates a control queue, a GNSS flowgraph, and a control message factory - control_queue_ = gr::msg_queue::make(0); + control_queue_ = std::make_shared>(); cmd_interface_.set_msg_queue(control_queue_); //set also the queue pointer for the telecommand thread try { @@ -120,7 +120,6 @@ void ControlThread::init() { std::cout << "Caught bad lexical cast with error " << e.what() << std::endl; } - control_message_factory_ = std::make_shared(); stop_ = false; processed_control_messages_ = 0; applied_actions_ = 0; @@ -226,6 +225,50 @@ void ControlThread::telecommand_listener() } } +void ControlThread::event_dispatcher(bool &valid_event, pmt::pmt_t &msg) +{ + if (valid_event) + { + processed_control_messages_++; + if (pmt::any_ref(msg).type() == typeid(channel_event_sptr)) + { + channel_event_sptr new_event; + new_event = boost::any_cast(pmt::any_ref(msg)); + DLOG(INFO) << "New channel event rx from ch id: " << new_event->channel_id + << " what: " << new_event->event_type; + flowgraph_->apply_action(new_event->channel_id, new_event->event_type); + } + else if (pmt::any_ref(msg).type() == typeid(command_event_sptr)) + { + command_event_sptr new_event; + new_event = boost::any_cast(pmt::any_ref(msg)); + DLOG(INFO) << "New command event rx from ch id: " << new_event->command_id + << " what: " << new_event->event_type; + + if (new_event->command_id == 200) + { + apply_action(new_event->event_type); + } + else + { + if (new_event->command_id == 300) // some TC commands require also actions from control_thread + { + apply_action(new_event->event_type); + } + flowgraph_->apply_action(new_event->command_id, new_event->event_type); + } + } + else + { + DLOG(INFO) << "Control Queue: unknown object type!\n"; + } + } + else + { + //perform non-priority tasks + flowgraph_->acquisition_manager(0); //start acquisition of untracked satellites + } +} /* * Runs the control thread that manages the receiver control plane @@ -285,14 +328,13 @@ int ControlThread::run() flowgraph_); #endif // Main loop to read and process the control messages + pmt::pmt_t msg; while (flowgraph_->running() && !stop_) { - //TODO re-enable the blocking read messages functions and fork the process - read_control_messages(); - if (control_messages_ != nullptr) - { - process_control_messages(); - } + //read event messages, triggered by event signaling with a 100 ms timeout to perform low priority receiver management tasks + bool valid_event = control_queue_->timed_wait_and_pop(msg, 100); + //call the new sat dispatcher and receiver controller + event_dispatcher(valid_event, msg); } std::cout << "Stopping GNSS-SDR, please wait!" << std::endl; flowgraph_->stop(); @@ -325,7 +367,7 @@ int ControlThread::run() } -void ControlThread::set_control_queue(const gr::msg_queue::sptr control_queue) // NOLINT(performance-unnecessary-value-param) +void ControlThread::set_control_queue(const std::shared_ptr> control_queue) // NOLINT(performance-unnecessary-value-param) { if (flowgraph_->running()) { @@ -791,65 +833,21 @@ void ControlThread::assist_GNSS() } -void ControlThread::read_control_messages() -{ - DLOG(INFO) << "Reading control messages from queue"; - gr::message::sptr queue_message = control_queue_->delete_head(); - if (queue_message != nullptr) - { - control_messages_ = control_message_factory_->GetControlMessages(queue_message); - } - else - { - control_messages_->clear(); - } -} - - -// Apply the corresponding control actions -void ControlThread::process_control_messages() -{ - for (auto &i : *control_messages_) - { - if (stop_) - { - break; - } - if (i->who == 200) - { - apply_action(i->what); - } - else - { - if (i->who == 300) // some TC commands require also actions from control_thread - { - apply_action(i->what); - } - flowgraph_->apply_action(i->who, i->what); - } - processed_control_messages_++; - } - control_messages_->clear(); - DLOG(INFO) << "Processed all control messages"; -} - - void ControlThread::apply_action(unsigned int what) { std::shared_ptr pvt_ptr; std::vector> visible_satellites; + applied_actions_++; switch (what) { case 0: LOG(INFO) << "Received action STOP"; stop_ = true; - applied_actions_++; break; case 1: LOG(INFO) << "Received action RESTART"; stop_ = true; restart_ = true; - applied_actions_++; break; case 11: LOG(INFO) << "Receiver action COLDSTART"; @@ -920,10 +918,10 @@ std::vector> ControlThread::get_visible_sats(time for (auto &it : gps_eph_map) { eph_t rtklib_eph = eph_to_rtklib(it.second); - double r_sat[3]; + std::array r_sat{}; double clock_bias_s; double sat_pos_variance_m2; - eph2pos(gps_gtime, &rtklib_eph, &r_sat[0], &clock_bias_s, + eph2pos(gps_gtime, &rtklib_eph, r_sat.data(), &clock_bias_s, &sat_pos_variance_m2); double Az, El, dist_m; arma::vec r_sat_eb_e = arma::vec{r_sat[0], r_sat[1], r_sat[2]}; @@ -943,10 +941,10 @@ std::vector> ControlThread::get_visible_sats(time for (auto &it : gal_eph_map) { eph_t rtklib_eph = eph_to_rtklib(it.second); - double r_sat[3]; + std::array r_sat{}; double clock_bias_s; double sat_pos_variance_m2; - eph2pos(gps_gtime, &rtklib_eph, &r_sat[0], &clock_bias_s, + eph2pos(gps_gtime, &rtklib_eph, r_sat.data(), &clock_bias_s, &sat_pos_variance_m2); double Az, El, dist_m; arma::vec r_sat_eb_e = arma::vec{r_sat[0], r_sat[1], r_sat[2]}; @@ -966,12 +964,12 @@ std::vector> ControlThread::get_visible_sats(time for (auto &it : gps_alm_map) { alm_t rtklib_alm = alm_to_rtklib(it.second); - double r_sat[3]; + std::array r_sat{}; double clock_bias_s; gtime_t aux_gtime; aux_gtime.time = fmod(utc2gpst(gps_gtime).time + 345600, 604800); aux_gtime.sec = 0.0; - alm2pos(aux_gtime, &rtklib_alm, &r_sat[0], &clock_bias_s); + alm2pos(aux_gtime, &rtklib_alm, r_sat.data(), &clock_bias_s); double Az, El, dist_m; arma::vec r_sat_eb_e = arma::vec{r_sat[0], r_sat[1], r_sat[2]}; arma::vec dx = r_sat_eb_e - r_eb_e; @@ -994,12 +992,12 @@ std::vector> ControlThread::get_visible_sats(time for (auto &it : gal_alm_map) { alm_t rtklib_alm = alm_to_rtklib(it.second); - double r_sat[3]; + std::array r_sat{}; double clock_bias_s; gtime_t gal_gtime; gal_gtime.time = fmod(utc2gpst(gps_gtime).time + 345600, 604800); gal_gtime.sec = 0.0; - alm2pos(gal_gtime, &rtklib_alm, &r_sat[0], &clock_bias_s); + alm2pos(gal_gtime, &rtklib_alm, r_sat.data(), &clock_bias_s); double Az, El, dist_m; arma::vec r_sat_eb_e = arma::vec{r_sat[0], r_sat[1], r_sat[2]}; arma::vec dx = r_sat_eb_e - r_eb_e; @@ -1092,11 +1090,7 @@ void ControlThread::sysv_queue_listener() if ((std::abs(received_message - (-200.0)) < 10 * std::numeric_limits::epsilon())) { std::cout << "Quit order received, stopping GNSS-SDR !!" << std::endl; - std::unique_ptr cmf(new ControlMessageFactory()); - if (control_queue_ != gr::msg_queue::sptr()) - { - control_queue_->handle(cmf->GetQueueMessage(200, 0)); - } + control_queue_->push(pmt::make_any(command_event_make(200, 0))); read_queue = false; } } @@ -1114,11 +1108,7 @@ void ControlThread::keyboard_listener() if (c == 'q') { std::cout << "Quit keystroke order received, stopping GNSS-SDR !!" << std::endl; - std::unique_ptr cmf(new ControlMessageFactory()); - if (control_queue_ != gr::msg_queue::sptr()) - { - control_queue_->handle(cmf->GetQueueMessage(200, 0)); - } + control_queue_->push(pmt::make_any(command_event_make(200, 0))); read_keys = false; } std::this_thread::sleep_for(std::chrono::milliseconds(100)); diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h index 7d58226e9..5fa84f791 100644 --- a/src/core/receiver/control_thread.h +++ b/src/core/receiver/control_thread.h @@ -35,20 +35,20 @@ #ifndef GNSS_SDR_CONTROL_THREAD_H_ #define GNSS_SDR_CONTROL_THREAD_H_ -#include "agnss_ref_location.h" // for Agnss_Ref_Location -#include "agnss_ref_time.h" // for Agnss_Ref_Time -#include "control_message_factory.h" // for ControlMessage -#include "gnss_sdr_supl_client.h" // for Gnss_Sdr_Supl_Client -#include "tcp_cmd_interface.h" // for TcpCmdInterface -#include // for arma::vec -#include // for boost::thread -#include // for msg_queue, msg_queue::sptr -#include // for time_t -#include // for shared_ptr -#include // for string -#include // for std::thread -#include // for pair -#include // for vector +#include "agnss_ref_location.h" // for Agnss_Ref_Location +#include "agnss_ref_time.h" // for Agnss_Ref_Time +#include "concurrent_queue.h" +#include "gnss_sdr_supl_client.h" // for Gnss_Sdr_Supl_Client +#include "tcp_cmd_interface.h" // for TcpCmdInterface +#include // for arma::vec +#include // for boost::thread +#include +#include // for time_t +#include // for shared_ptr +#include // for string +#include // for std::thread +#include // for pair +#include // for vector class ConfigurationInterface; class GNSSFlowgraph; @@ -95,9 +95,9 @@ public: /*! * \brief Sets the control_queue * - * \param[in] boost::shared_ptr control_queue + * \param[in] std::shared_ptr> control_queue */ - void set_control_queue(const gr::msg_queue::sptr control_queue); // NOLINT(performance-unnecessary-value-param) + void set_control_queue(const std::shared_ptr> control_queue); // NOLINT(performance-unnecessary-value-param) unsigned int processed_control_messages() { @@ -123,6 +123,10 @@ private: //Telecommand TCP interface TcpCmdInterface cmd_interface_; void telecommand_listener(); + /* + * New receiver event dispatcher + */ + void event_dispatcher(bool &valid_event, pmt::pmt_t &msg); std::thread cmd_interface_thread_; //SUPL assistance classes Gnss_Sdr_Supl_Client supl_client_acquisition_; @@ -140,10 +144,6 @@ private: // Save {ephemeris, iono, utc, ref loc, ref time} assistance to a local XML file //bool save_assistance_to_XML(); - void read_control_messages(); - - void process_control_messages(); - /* * Blocking function that reads the GPS assistance queue */ @@ -153,7 +153,7 @@ private: * Compute elevations for the specified time and position for all the available satellites in ephemeris and almanac queues * returns a vector filled with the available satellites ordered from high elevation to low elevation angle. */ - std::vector> get_visible_sats(time_t rx_utc_time, const arma::vec& LLH); + std::vector> get_visible_sats(time_t rx_utc_time, const arma::vec &LLH); /* * Read initial GNSS assistance from SUPL server or local XML files @@ -163,9 +163,7 @@ private: void apply_action(unsigned int what); std::shared_ptr flowgraph_; std::shared_ptr configuration_; - gr::msg_queue::sptr control_queue_; - std::shared_ptr control_message_factory_; - std::shared_ptr>> control_messages_; + std::shared_ptr> control_queue_; bool stop_; bool restart_; bool delete_configuration_; diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 7976d99da..f7574a986 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -182,7 +182,7 @@ GNSSBlockFactory::~GNSSBlockFactory() = default; std::unique_ptr GNSSBlockFactory::GetSignalSource( - const std::shared_ptr& configuration, const gr::msg_queue::sptr queue, int ID) // NOLINT(performance-unnecessary-value-param) + const std::shared_ptr& configuration, const std::shared_ptr> queue, int ID) // NOLINT(performance-unnecessary-value-param) { std::string default_implementation = "File_Signal_Source"; std::string role = "SignalSource"; //backwards compatibility for old conf files @@ -321,7 +321,7 @@ std::unique_ptr GNSSBlockFactory::GetPVT(const std::shared_p std::unique_ptr GNSSBlockFactory::GetChannel_1C( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { //"appendix" is added to the "role" with the aim of Acquisition, Tracking and Telemetry Decoder adapters //can find their specific configurations when they read the config @@ -389,7 +389,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1C( std::unique_ptr GNSSBlockFactory::GetChannel_2S( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { LOG(INFO) << "Instantiating Channel " << channel << " with Acquisition Implementation: " << acq << ", Tracking Implementation: " << trk << ", Telemetry Decoder implementation: " << tlm; @@ -453,7 +453,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2S( std::unique_ptr GNSSBlockFactory::GetChannel_1B( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -520,7 +520,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1B( std::unique_ptr GNSSBlockFactory::GetChannel_5X( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -587,7 +587,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_5X( std::unique_ptr GNSSBlockFactory::GetChannel_1G( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -655,7 +655,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_1G( std::unique_ptr GNSSBlockFactory::GetChannel_2G( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -723,7 +723,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_2G( std::unique_ptr GNSSBlockFactory::GetChannel_L5( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -790,7 +790,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_L5( std::unique_ptr GNSSBlockFactory::GetChannel_B1( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -857,7 +857,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B1( std::unique_ptr GNSSBlockFactory::GetChannel_B3( const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue) + std::shared_ptr> queue) { std::stringstream stream; stream << channel; @@ -921,7 +921,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel_B3( std::unique_ptr>> GNSSBlockFactory::GetChannels( - const std::shared_ptr& configuration, const gr::msg_queue::sptr queue) // NOLINT(performance-unnecessary-value-param) + const std::shared_ptr& configuration, const std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) { std::string default_implementation = "Pass_Through"; std::string tracking_implementation; @@ -1241,7 +1241,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( const std::shared_ptr& configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, - unsigned int out_streams, const gr::msg_queue::sptr queue) // NOLINT(performance-unnecessary-value-param) + unsigned int out_streams, const std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) { std::unique_ptr block; diff --git a/src/core/receiver/gnss_block_factory.h b/src/core/receiver/gnss_block_factory.h index 3076c879d..af9889c89 100644 --- a/src/core/receiver/gnss_block_factory.h +++ b/src/core/receiver/gnss_block_factory.h @@ -37,10 +37,11 @@ #ifndef GNSS_SDR_BLOCK_FACTORY_H_ #define GNSS_SDR_BLOCK_FACTORY_H_ -#include // for msg_queue::sptr -#include // for unique_ptr, shared_ptr -#include // for string -#include // for vector +#include "concurrent_queue.h" +#include +#include // for unique_ptr, shared_ptr +#include // for string +#include // for vector class ConfigurationInterface; @@ -59,12 +60,12 @@ public: virtual ~GNSSBlockFactory(); std::unique_ptr GetSignalSource(const std::shared_ptr& configuration, - const gr::msg_queue::sptr queue, int ID = -1); // NOLINT(performance-unnecessary-value-param) + const std::shared_ptr> queue, int ID = -1); // NOLINT(performance-unnecessary-value-param) std::unique_ptr GetSignalConditioner(const std::shared_ptr& configuration, int ID = -1); std::unique_ptr>> GetChannels(const std::shared_ptr& configuration, - const gr::msg_queue::sptr queue); // NOLINT(performance-unnecessary-value-param) + const std::shared_ptr> queue); // NOLINT(performance-unnecessary-value-param) std::unique_ptr GetObservables(const std::shared_ptr& configuration); @@ -76,44 +77,44 @@ public: std::unique_ptr GetBlock(const std::shared_ptr& configuration, const std::string& role, const std::string& implementation, unsigned int in_streams, unsigned int out_streams, - const gr::msg_queue::sptr queue = nullptr); // NOLINT(performance-unnecessary-value-param) + const std::shared_ptr> queue = nullptr); // NOLINT(performance-unnecessary-value-param) private: std::unique_ptr GetChannel_1C(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_2S(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_1B(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_5X(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_L5(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_1G(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_2G(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_B1(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - gr::msg_queue::sptr queue); + std::shared_ptr> queue); std::unique_ptr GetChannel_B3(const std::shared_ptr& configuration, const std::string& acq, const std::string& trk, const std::string& tlm, int channel, - boost::shared_ptr queue); + std::shared_ptr> queue); std::unique_ptr GetAcqBlock( const std::shared_ptr& configuration, diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 4d11c4193..7f7558599 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -75,7 +75,7 @@ #define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8 -GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, const gr::msg_queue::sptr queue) // NOLINT(performance-unnecessary-value-param) +GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configuration, const std::shared_ptr> queue) // NOLINT(performance-unnecessary-value-param) { connected_ = false; running_ = false; @@ -428,6 +428,8 @@ void GNSSFlowgraph::connect() case evBDS_B3: acq_fs = fs; break; + default: + break; } if (acq_fs < fs) @@ -528,7 +530,6 @@ void GNSSFlowgraph::connect() DLOG(INFO) << "signal conditioner " << selected_signal_conditioner_ID << " connected to channel " << i; } #endif - // Signal Source > Signal conditioner >> Channels >> Observables try { @@ -544,7 +545,7 @@ void GNSSFlowgraph::connect() } } - //check for unconnected signal conditioners and connect null_sinks in order to provide configuration flexibility to multiband files or signal sources + // check for unconnected signal conditioners and connect null_sinks in order to provide configuration flexibility to multiband files or signal sources if (configuration_->property(sig_source_.at(0)->role() + ".enable_FPGA", false) == false) { for (size_t n = 0; n < sig_conditioner_.size(); n++) @@ -598,7 +599,11 @@ void GNSSFlowgraph::connect() } if (sat == 0) { - channels_.at(i)->set_signal(search_next_signal(gnss_signal, false)); + bool assistance_available; + float estimated_doppler; + double RX_time; + bool is_primary_freq; + channels_.at(i)->set_signal(search_next_signal(gnss_signal, false, is_primary_freq, assistance_available, estimated_doppler, RX_time)); } else { @@ -680,7 +685,11 @@ void GNSSFlowgraph::connect() top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i); top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry")); } + + top_block_->msg_connect(observables_->get_right_block(), pmt::mp("status"), channels_status_, pmt::mp("status")); + top_block_->msg_connect(pvt_->get_left_block(), pmt::mp("pvt_to_observables"), observables_->get_right_block(), pmt::mp("pvt_to_observables")); + top_block_->msg_connect(pvt_->get_left_block(), pmt::mp("status"), channels_status_, pmt::mp("status")); } catch (const std::exception& e) { @@ -1054,6 +1063,188 @@ bool GNSSFlowgraph::send_telemetry_msg(const pmt::pmt_t& msg) } +void GNSSFlowgraph::push_back_signal(const Gnss_Signal& gs) +{ + switch (mapStringValues_[gs.get_signal_str()]) + { + case evGPS_1C: + available_GPS_1C_signals_.remove(gs); + available_GPS_1C_signals_.push_back(gs); + break; + + case evGPS_2S: + available_GPS_2S_signals_.remove(gs); + available_GPS_2S_signals_.push_back(gs); + break; + + case evGPS_L5: + available_GPS_L5_signals_.remove(gs); + available_GPS_L5_signals_.push_back(gs); + break; + + case evGAL_1B: + available_GAL_1B_signals_.remove(gs); + available_GAL_1B_signals_.push_back(gs); + break; + + case evGAL_5X: + available_GAL_5X_signals_.remove(gs); + available_GAL_5X_signals_.push_back(gs); + break; + + case evGLO_1G: + available_GLO_1G_signals_.remove(gs); + available_GLO_1G_signals_.push_back(gs); + break; + + case evGLO_2G: + available_GLO_2G_signals_.remove(gs); + available_GLO_2G_signals_.push_back(gs); + break; + + case evBDS_B1: + available_BDS_B1_signals_.remove(gs); + available_BDS_B1_signals_.push_back(gs); + break; + + case evBDS_B3: + available_BDS_B3_signals_.remove(gs); + available_BDS_B3_signals_.push_back(gs); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + break; + } +} + + +void GNSSFlowgraph::remove_signal(const Gnss_Signal& gs) +{ + switch (mapStringValues_[gs.get_signal_str()]) + { + case evGPS_1C: + available_GPS_1C_signals_.remove(gs); + break; + + case evGPS_2S: + available_GPS_2S_signals_.remove(gs); + break; + + case evGPS_L5: + available_GPS_L5_signals_.remove(gs); + break; + + case evGAL_1B: + available_GAL_1B_signals_.remove(gs); + break; + + case evGAL_5X: + available_GAL_5X_signals_.remove(gs); + break; + + case evGLO_1G: + available_GLO_1G_signals_.remove(gs); + break; + + case evGLO_2G: + available_GLO_2G_signals_.remove(gs); + break; + + case evBDS_B1: + available_BDS_B1_signals_.remove(gs); + break; + + case evBDS_B3: + available_BDS_B3_signals_.remove(gs); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + break; + } +} + + +void GNSSFlowgraph::acquisition_manager(unsigned int who) +{ + unsigned int current_channel; + for (unsigned int i = 0; i < channels_count_; i++) + { + current_channel = (i + who + 1) % channels_count_; + unsigned int sat_ = 0; + try + { + sat_ = configuration_->property("Channel" + std::to_string(current_channel) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } + if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[current_channel] == 0)) + { + bool is_primary_freq = true; + bool assistance_available = false; + bool start_acquisition = false; + Gnss_Signal gnss_signal; + if (sat_ == 0) + { + float estimated_doppler; + double RX_time; + gnss_signal = search_next_signal(channels_[current_channel]->get_signal().get_signal_str(), + true, + is_primary_freq, + assistance_available, + estimated_doppler, + RX_time); + channels_[current_channel]->set_signal(gnss_signal); + start_acquisition = is_primary_freq or assistance_available or !configuration_->property("GNSS-SDR.assist_dual_frequency_acq", false); + // if (assistance_available) + // { + // std::cout << "Channel " << current_channel + // << " assistance available for " << channels_[current_channel]->get_signal().get_satellite() + // << ", Signal " << channels_[current_channel]->get_signal().get_signal_str() << std::endl; + // } + } + else + { + start_acquisition = true; + } + + if (start_acquisition == true) + { + channels_state_[current_channel] = 1; + acq_channels_count_++; + DLOG(INFO) << "Channel " << current_channel + << " Starting acquisition " << channels_[current_channel]->get_signal().get_satellite() + << ", Signal " << channels_[current_channel]->get_signal().get_signal_str(); +#ifndef ENABLE_FPGA + channels_[current_channel]->start_acquisition(); +#else + // create a task for the FPGA such that it doesn't stop the flow + std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[current_channel]); + tmp_thread.detach(); +#endif + } + else + { + push_back_signal(gnss_signal); + DLOG(INFO) << "Channel " << current_channel + << " secondary frequency acquisition assistance not available in " + << channels_[current_channel]->get_signal().get_satellite() + << ", Signal " << channels_[current_channel]->get_signal().get_signal_str(); + + // std::cout << "Channel " << current_channel + // << " secondary frequency acquisition assistance not available in " + // << channels_[current_channel]->get_signal().get_satellite() + // << ", Signal " << channels_[current_channel]->get_signal().get_signal_str() << std::endl; + } + } + DLOG(INFO) << "Channel " << current_channel << " in state " << channels_state_[current_channel]; + } +} + + /* * Applies an action to the flow graph * @@ -1078,8 +1269,10 @@ bool GNSSFlowgraph::send_telemetry_msg(const pmt::pmt_t& msg) */ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { + //todo: the acquisition events are initiated from the acquisition success or failure queued msg. If the acquisition is disabled for non-assisted secondary freq channels, the engine stops.. + std::lock_guard lock(signal_list_mutex); - DLOG(INFO) << "Received " << what << " from " << who << ". Number of applied actions = " << applied_actions_; + DLOG(INFO) << "Received " << what << " from " << who; unsigned int sat = 0; if (who < 200) { @@ -1099,183 +1292,32 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) if (sat == 0) { Gnss_Signal gs = channels_[who]->get_signal(); - switch (mapStringValues_[gs.get_signal_str()]) - { - case evGPS_1C: - available_GPS_1C_signals_.remove(gs); - available_GPS_1C_signals_.push_back(gs); - break; - - case evGPS_2S: - available_GPS_2S_signals_.remove(gs); - available_GPS_2S_signals_.push_back(gs); - break; - - case evGPS_L5: - available_GPS_L5_signals_.remove(gs); - available_GPS_L5_signals_.push_back(gs); - break; - - case evGAL_1B: - available_GAL_1B_signals_.remove(gs); - available_GAL_1B_signals_.push_back(gs); - break; - - case evGAL_5X: - available_GAL_5X_signals_.remove(gs); - available_GAL_5X_signals_.push_back(gs); - break; - - case evGLO_1G: - available_GLO_1G_signals_.remove(gs); - available_GLO_1G_signals_.push_back(gs); - break; - - case evGLO_2G: - available_GLO_2G_signals_.remove(gs); - available_GLO_2G_signals_.push_back(gs); - break; - - case evBDS_B1: - available_BDS_B1_signals_.remove(gs); - available_BDS_B1_signals_.push_back(gs); - break; - - case evBDS_B3: - available_BDS_B3_signals_.remove(gs); - available_BDS_B3_signals_.push_back(gs); - break; - - default: - LOG(ERROR) << "This should not happen :-("; - break; - } + push_back_signal(gs); } channels_state_[who] = 0; - acq_channels_count_--; - for (unsigned int i = 0; i < channels_count_; i++) - { - unsigned int ch_index = (who + i + 1) % channels_count_; - unsigned int sat_ = 0; - try - { - sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0); - } - catch (const std::exception& e) - { - LOG(WARNING) << e.what(); - } - if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) - { - channels_state_[ch_index] = 1; - if (sat_ == 0) - { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); - } - acq_channels_count_++; - DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); -#ifndef ENABLE_FPGA - channels_[ch_index]->start_acquisition(); -#else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[ch_index]); - tmp_thread.detach(); -#endif - } - DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; - } + if (acq_channels_count_ > 0) acq_channels_count_--; + // call the acquisition manager to assign new satellite and start next acquisition (if required) + acquisition_manager(who); break; - case 1: - LOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_[who]->get_signal().get_satellite(); - + DLOG(INFO) << "Channel " << who << " ACQ SUCCESS satellite " << channels_[who]->get_signal().get_satellite(); // If the satellite is in the list of available ones, remove it. - switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) - { - case evGPS_1C: - available_GPS_1C_signals_.remove(channels_[who]->get_signal()); - break; - - case evGPS_2S: - available_GPS_2S_signals_.remove(channels_[who]->get_signal()); - break; - - case evGPS_L5: - available_GPS_L5_signals_.remove(channels_[who]->get_signal()); - break; - - case evGAL_1B: - available_GAL_1B_signals_.remove(channels_[who]->get_signal()); - break; - - case evGAL_5X: - available_GAL_5X_signals_.remove(channels_[who]->get_signal()); - break; - - case evGLO_1G: - available_GLO_1G_signals_.remove(channels_[who]->get_signal()); - break; - - case evGLO_2G: - available_GLO_2G_signals_.remove(channels_[who]->get_signal()); - break; - - case evBDS_B1: - available_BDS_B1_signals_.remove(channels_[who]->get_signal()); - break; - - case evBDS_B3: - available_BDS_B3_signals_.remove(channels_[who]->get_signal()); - break; - - default: - LOG(ERROR) << "This should not happen :-("; - break; - } + remove_signal(channels_[who]->get_signal()); channels_state_[who] = 2; - acq_channels_count_--; - for (unsigned int i = 0; i < channels_count_; i++) - { - unsigned int sat_ = 0; - try - { - sat_ = configuration_->property("Channel" + std::to_string(i) + ".satellite", 0); - } - catch (const std::exception& e) - { - LOG(WARNING) << e.what(); - } - if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) - { - channels_state_[i] = 1; - if (sat_ == 0) - { - channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true)); - } - acq_channels_count_++; - DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); -#ifndef ENABLE_FPGA - channels_[i]->start_acquisition(); -#else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[i]); - tmp_thread.detach(); -#endif - } - DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; - } + if (acq_channels_count_ > 0) acq_channels_count_--; + // call the acquisition manager to assign new satellite and start next acquisition (if required) + acquisition_manager(who); break; case 2: - LOG(INFO) << "Channel " << who << " TRK FAILED satellite " << channels_[who]->get_signal().get_satellite(); - DLOG(INFO) << "Number of channels in acquisition = " << acq_channels_count_; - + DLOG(INFO) << "Channel " << who << " TRK FAILED satellite " << channels_[who]->get_signal().get_satellite(); if (acq_channels_count_ < max_acq_channels_) { + // try to acquire the same satellite channels_state_[who] = 1; acq_channels_count_++; - LOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); + DLOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); #ifndef ENABLE_FPGA channels_[who]->start_acquisition(); #else @@ -1290,48 +1332,7 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) LOG(INFO) << "Channel " << who << " Idle state"; if (sat == 0) { - switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) - { - case evGPS_1C: - available_GPS_1C_signals_.push_back(channels_[who]->get_signal()); - break; - - case evGPS_2S: - available_GPS_2S_signals_.push_back(channels_[who]->get_signal()); - break; - - case evGPS_L5: - available_GPS_L5_signals_.push_back(channels_[who]->get_signal()); - break; - - case evGAL_1B: - available_GAL_1B_signals_.push_back(channels_[who]->get_signal()); - break; - - case evGAL_5X: - available_GAL_5X_signals_.push_back(channels_[who]->get_signal()); - break; - - case evGLO_1G: - available_GLO_1G_signals_.push_back(channels_[who]->get_signal()); - break; - - case evGLO_2G: - available_GLO_2G_signals_.push_back(channels_[who]->get_signal()); - break; - - case evBDS_B1: - available_BDS_B1_signals_.push_back(channels_[who]->get_signal()); - break; - - case evBDS_B3: - available_BDS_B3_signals_.push_back(channels_[who]->get_signal()); - break; - - default: - LOG(ERROR) << "This should not happen :-("; - break; - } + push_back_signal(channels_[who]->get_signal()); } } break; @@ -1339,61 +1340,12 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) LOG(INFO) << "TC request standby mode"; for (size_t n = 0; n < channels_.size(); n++) { - if (channels_state_[n] == 1 or channels_state_[n] == 2) //channel in acquisition or in tracking + if (channels_state_[n] == 1 or channels_state_[n] == 2) // channel in acquisition or in tracking { - //recover the satellite assigned + // recover the satellite assigned Gnss_Signal gs = channels_[n]->get_signal(); - switch (mapStringValues_[gs.get_signal_str()]) - { - case evGPS_1C: - available_GPS_1C_signals_.remove(gs); - available_GPS_1C_signals_.push_back(gs); - break; + push_back_signal(gs); - case evGPS_2S: - available_GPS_2S_signals_.remove(gs); - available_GPS_2S_signals_.push_back(gs); - break; - - case evGPS_L5: - available_GPS_L5_signals_.remove(gs); - available_GPS_L5_signals_.push_back(gs); - break; - - case evGAL_1B: - available_GAL_1B_signals_.remove(gs); - available_GAL_1B_signals_.push_back(gs); - break; - - case evGAL_5X: - available_GAL_5X_signals_.remove(gs); - available_GAL_5X_signals_.push_back(gs); - break; - - case evGLO_1G: - available_GLO_1G_signals_.remove(gs); - available_GLO_1G_signals_.push_back(gs); - break; - - case evGLO_2G: - available_GLO_2G_signals_.remove(gs); - available_GLO_2G_signals_.push_back(gs); - break; - - case evBDS_B1: - available_BDS_B1_signals_.remove(gs); - available_BDS_B1_signals_.push_back(gs); - break; - - case evBDS_B3: - available_BDS_B3_signals_.remove(gs); - available_BDS_B3_signals_.push_back(gs); - break; - - default: - LOG(ERROR) << "This should not happen :-("; - break; - } channels_[n]->stop_channel(); // stop the acquisition or tracking operation channels_state_[n] = 0; } @@ -1402,112 +1354,22 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) break; case 11: // request coldstart mode LOG(INFO) << "TC request flowgraph coldstart"; - // start again the satellite acquisitions - for (unsigned int i = 0; i < channels_count_; i++) - { - unsigned int ch_index = (who + i + 1) % channels_count_; - unsigned int sat_ = 0; - try - { - sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0); - } - catch (const std::exception& e) - { - LOG(WARNING) << e.what(); - } - if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) - { - channels_state_[ch_index] = 1; - if (sat_ == 0) - { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); - } - acq_channels_count_++; - DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); -#ifndef ENABLE_FPGA - channels_[ch_index]->start_acquisition(); -#else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[ch_index]); - tmp_thread.detach(); -#endif - } - DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; - } + // call the acquisition manager to assign new satellite and start next acquisition (if required) + acquisition_manager(who); break; case 12: // request hotstart mode LOG(INFO) << "TC request flowgraph hotstart"; - for (unsigned int i = 0; i < channels_count_; i++) - { - unsigned int ch_index = (who + i + 1) % channels_count_; - unsigned int sat_ = 0; - try - { - sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0); - } - catch (const std::exception& e) - { - LOG(WARNING) << e.what(); - } - if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) - { - channels_state_[ch_index] = 1; - if (sat_ == 0) - { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); - } - acq_channels_count_++; - DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); -#ifndef ENABLE_FPGA - channels_[ch_index]->start_acquisition(); -#else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[ch_index]); - tmp_thread.detach(); -#endif - } - DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; - } + // call the acquisition manager to assign new satellite and start next acquisition (if required) + acquisition_manager(who); break; case 13: // request warmstart mode LOG(INFO) << "TC request flowgraph warmstart"; - // start again the satellite acquisitions - for (unsigned int i = 0; i < channels_count_; i++) - { - unsigned int ch_index = (who + i + 1) % channels_count_; - unsigned int sat_ = 0; - try - { - sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0); - } - catch (const std::exception& e) - { - LOG(WARNING) << e.what(); - } - if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) - { - channels_state_[ch_index] = 1; - if (sat_ == 0) - { - channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); - } - acq_channels_count_++; - DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); -#ifndef ENABLE_FPGA - channels_[ch_index]->start_acquisition(); -#else - // create a task for the FPGA such that it doesn't stop the flow - std::thread tmp_thread(&ChannelInterface::start_acquisition, channels_[ch_index]); - tmp_thread.detach(); -#endif - } - DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; - } + // call the acquisition manager to assign new satellite and start next acquisition (if required) + acquisition_manager(who); break; default: break; } - applied_actions_++; } @@ -1610,6 +1472,8 @@ void GNSSFlowgraph::init() */ std::unique_ptr block_factory_(new GNSSBlockFactory()); + channels_status_ = channel_status_msg_receiver_make(); + // 1. read the number of RF front-ends available (one file_source per RF front-end) sources_count_ = configuration_->property("Receiver.sources_count", 1); @@ -1701,7 +1565,6 @@ void GNSSFlowgraph::init() // fill the signals queue with the satellites ID's to be searched by the acquisition set_signals_list(); set_channels_state(); - applied_actions_ = 0; DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels."; /* @@ -1953,9 +1816,7 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_B1.count", 0) > 0) { - /* - * Loop to create the list of BeiDou B1C signals - */ + // Loop to create the list of BeiDou B1C signals for (available_gnss_prn_iter = available_beidou_prn.cbegin(); available_gnss_prn_iter != available_beidou_prn.cend(); available_gnss_prn_iter++) @@ -1968,9 +1829,7 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_B3.count", 0) > 0) { - /* - * Loop to create the list of BeiDou B1C signals - */ + // Loop to create the list of BeiDou B1C signals for (available_gnss_prn_iter = available_beidou_prn.cbegin(); available_gnss_prn_iter != available_beidou_prn.cend(); available_gnss_prn_iter++) @@ -2010,110 +1869,124 @@ void GNSSFlowgraph::set_channels_state() } -Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal, bool pop, bool tracked) +Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal, + const bool pop, + bool& is_primary_frequency, + bool& assistance_available, + float& estimated_doppler, + double& RX_time) { + is_primary_frequency = false; + assistance_available = false; Gnss_Signal result; - bool untracked_satellite = true; + bool found_signal = false; switch (mapStringValues_[searched_signal]) { case evGPS_1C: + //todo: assist the satellite selection with almanac and current PVT here (rehuse priorize_satellite function used in control_thread) result = available_GPS_1C_signals_.front(); available_GPS_1C_signals_.pop_front(); if (!pop) { available_GPS_1C_signals_.push_back(result); } - if (tracked) - { - if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1C")) - { - untracked_satellite = false; - } - } - if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); - available_GPS_2S_signals_.remove(gs); - available_GPS_2S_signals_.push_front(gs); - } - if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); - available_GPS_L5_signals_.remove(gs); - available_GPS_L5_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; // indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evGPS_2S: - result = available_GPS_2S_signals_.front(); - available_GPS_2S_signals_.pop_front(); - if (!pop) + if (configuration_->property("Channels_1C.count", 0) > 0) { - available_GPS_2S_signals_.push_back(result); - } - if (tracked) - { - if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + // 1. Get the current channel status map + std::map> current_channels_status = channels_status_->get_current_status_map(); + // 2. search the currently tracked GPS L1 satellites and assist the GPS L2 acquisition if the satellite is not tracked on L2 + bool found_signal = false; + for (std::map>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it) { - for (unsigned int ch = 0; ch < channels_count_; ch++) + if (std::string(it->second->Signal) == "1C") { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2S")) + std::list::iterator it2; + it2 = std::find_if(std::begin(available_GPS_2S_signals_), std::end(available_GPS_2S_signals_), + [&](Gnss_Signal const& sig) { return sig.get_satellite().get_PRN() == it->second->PRN; }); + + if (it2 != available_GPS_2S_signals_.end()) { - untracked_satellite = false; + estimated_doppler = it->second->Carrier_Doppler_hz; + RX_time = it->second->RX_time; + // std::cout << " Channel: " << it->first << " => Doppler: " << estimated_doppler << "[Hz] \n"; + // 3. return the GPS L2 satellite and remove it from list + result = *it2; + if (pop) + { + available_GPS_2S_signals_.erase(it2); + } + found_signal = true; + assistance_available = true; + break; } } - if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + } + // fallback: pick the front satellite because there is no tracked satellites in L1 to assist L2 + if (found_signal == false) + { + result = available_GPS_2S_signals_.front(); + available_GPS_2S_signals_.pop_front(); + if (!pop) { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); - available_GPS_1C_signals_.remove(gs); - available_GPS_1C_signals_.push_front(gs); - } - if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); - available_GPS_L5_signals_.remove(gs); - available_GPS_L5_signals_.push_front(gs); + available_GPS_2S_signals_.push_back(result); } } } + else + { + result = available_GPS_2S_signals_.front(); + available_GPS_2S_signals_.pop_front(); + if (!pop) + { + available_GPS_2S_signals_.push_back(result); + } + } break; case evGPS_L5: - result = available_GPS_L5_signals_.front(); - available_GPS_L5_signals_.pop_front(); - if (!pop) + if (configuration_->property("Channels_1C.count", 0) > 0) { - available_GPS_L5_signals_.push_back(result); - } - if (tracked) - { - if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_2S.count", 0) > 0)) + // 1. Get the current channel status map + std::map> current_channels_status = channels_status_->get_current_status_map(); + // 2. search the currently tracked GPS L1 satellites and assist the GPS L5 acquisition if the satellite is not tracked on L5 + for (std::map>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it) { - for (unsigned int ch = 0; ch < channels_count_; ch++) + if (std::string(it->second->Signal) == "1C") { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "L5")) + std::list::iterator it2; + it2 = std::find_if(std::begin(available_GPS_L5_signals_), std::end(available_GPS_L5_signals_), + [&](Gnss_Signal const& sig) { return sig.get_satellite().get_PRN() == it->second->PRN; }); + + if (it2 != available_GPS_L5_signals_.end()) { - untracked_satellite = false; + estimated_doppler = it->second->Carrier_Doppler_hz; + RX_time = it->second->RX_time; + // std::cout << " Channel: " << it->first << " => Doppler: " << estimated_doppler << "[Hz] \n"; + // 3. return the GPS L5 satellite and remove it from list + result = *it2; + if (pop) + { + available_GPS_L5_signals_.erase(it2); + } + found_signal = true; + assistance_available = true; + break; } } - if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); - available_GPS_1C_signals_.remove(gs); - available_GPS_1C_signals_.push_front(gs); - } - if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); - available_GPS_2S_signals_.remove(gs); - available_GPS_2S_signals_.push_front(gs); - } + } + } + // fallback: pick the front satellite because there is no tracked satellites in L1 to assist L5 + if (found_signal == false) + { + result = available_GPS_L5_signals_.front(); + available_GPS_L5_signals_.pop_front(); + if (!pop) + { + available_GPS_L5_signals_.push_back(result); } } break; @@ -2125,51 +1998,49 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GAL_1B_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_5X.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1B")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X"); - available_GAL_5X_signals_.remove(gs); - available_GAL_5X_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; // indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evGAL_5X: - result = available_GAL_5X_signals_.front(); - available_GAL_5X_signals_.pop_front(); - if (!pop) + if (configuration_->property("Channels_1B.count", 0) > 0) { - available_GAL_5X_signals_.push_back(result); - } - if (tracked) - { - if (configuration_->property("Channels_1B.count", 0) > 0) + // 1. Get the current channel status map + std::map> current_channels_status = channels_status_->get_current_status_map(); + // 2. search the currently tracked Galileo E1 satellites and assist the Galileo E5 acquisition if the satellite is not tracked on E5 + for (std::map>::iterator it = current_channels_status.begin(); it != current_channels_status.end(); ++it) { - for (unsigned int ch = 0; ch < channels_count_; ch++) + if (std::string(it->second->Signal) == "1B") { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "5X")) + std::list::iterator it2; + it2 = std::find_if(std::begin(available_GAL_5X_signals_), std::end(available_GAL_5X_signals_), + [&](Gnss_Signal const& sig) { return sig.get_satellite().get_PRN() == it->second->PRN; }); + + if (it2 != available_GAL_5X_signals_.end()) { - untracked_satellite = false; + estimated_doppler = it->second->Carrier_Doppler_hz; + RX_time = it->second->RX_time; + // std::cout << " Channel: " << it->first << " => Doppler: " << estimated_doppler << "[Hz] \n"; + // 3. return the Gal 5X satellite and remove it from list + result = *it2; + if (pop) + { + available_GAL_5X_signals_.erase(it2); + } + found_signal = true; + assistance_available = true; + break; } } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B"); - available_GAL_1B_signals_.remove(gs); - available_GAL_1B_signals_.push_front(gs); - } + } + } + // fallback: pick the front satellite because there is no tracked satellites in E1 to assist E5 + if (found_signal == false) + { + result = available_GAL_5X_signals_.front(); + available_GAL_5X_signals_.pop_front(); + if (!pop) + { + available_GAL_5X_signals_.push_back(result); } } break; @@ -2181,25 +2052,7 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GLO_1G_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_2G.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "1G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G"); - available_GLO_2G_signals_.remove(gs); - available_GLO_2G_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; // indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evGLO_2G: @@ -2209,25 +2062,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_GLO_2G_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_1G.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G"); - available_GLO_1G_signals_.remove(gs); - available_GLO_1G_signals_.push_front(gs); - } - } - } break; case evBDS_B1: @@ -2237,25 +2071,7 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_BDS_B1_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_B3.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B3"); - available_BDS_B3_signals_.remove(gs); - available_BDS_B3_signals_.push_front(gs); - } - } - } + is_primary_frequency = true; // indicate that the searched satellite signal belongs to "primary" link (L1, E1, B1, etc..) break; case evBDS_B3: @@ -2265,25 +2081,6 @@ Gnss_Signal GNSSFlowgraph::search_next_signal(const std::string& searched_signal { available_BDS_B3_signals_.push_back(result); } - if (tracked) - { - if (configuration_->property("Channels_B1.count", 0) > 0) - { - for (unsigned int ch = 0; ch < channels_count_; ch++) - { - if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str() != "2G")) - { - untracked_satellite = false; - } - } - if (untracked_satellite) - { - Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "B1"); - available_BDS_B1_signals_.remove(gs); - available_BDS_B1_signals_.push_front(gs); - } - } - } break; default: diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 7552c46a7..d60995b36 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -37,11 +37,12 @@ #ifndef GNSS_SDR_GNSS_FLOWGRAPH_H_ #define GNSS_SDR_GNSS_FLOWGRAPH_H_ +#include "channel_status_msg_receiver.h" +#include "concurrent_queue.h" #include "gnss_sdr_sample_counter.h" #include "gnss_signal.h" #include "pvt_interface.h" #include //for null_sink -#include // for msg_queue, msg_queue::sptr #include // for basic_block_sptr, top_block_sptr #include // for pmt_t #include // for list @@ -71,7 +72,7 @@ public: /*! * \brief Constructor that initializes the receiver flow graph */ - GNSSFlowgraph(std::shared_ptr configuration, const gr::msg_queue::sptr queue); // NOLINT(performance-unnecessary-value-param) + GNSSFlowgraph(std::shared_ptr configuration, const std::shared_ptr> queue); // NOLINT(performance-unnecessary-value-param) /*! * \brief Destructor @@ -99,6 +100,8 @@ public: void perform_hw_reset(); #endif + + void acquisition_manager(unsigned int who); /*! * \brief Applies an action to the flow graph * @@ -107,12 +110,11 @@ public: */ void apply_action(unsigned int who, unsigned int what); - void set_configuration(std::shared_ptr configuration); - unsigned int applied_actions() const - { - return applied_actions_; - } + void push_back_signal(const Gnss_Signal& gs); + void remove_signal(const Gnss_Signal& gs); + + void set_configuration(std::shared_ptr configuration); bool connected() const { @@ -149,7 +151,12 @@ private: void set_signals_list(); void set_channels_state(); // Initializes the channels state (start acquisition or keep standby) // using the configuration parameters (number of channels and max channels in acquisition) - Gnss_Signal search_next_signal(const std::string& searched_signal, bool pop, bool tracked = false); + Gnss_Signal search_next_signal(const std::string& searched_signal, + const bool pop, + bool& is_primary_frequency, + bool& assistance_available, + float& estimated_doppler, + double& RX_time); bool connected_; bool running_; int sources_count_; @@ -157,7 +164,6 @@ private: unsigned int channels_count_; unsigned int acq_channels_count_; unsigned int max_acq_channels_; - unsigned int applied_actions_; std::string config_file_; std::shared_ptr configuration_; @@ -175,7 +181,7 @@ private: gnss_sdr_fpga_sample_counter_sptr ch_out_fpga_sample_counter; #endif gr::top_block_sptr top_block_; - gr::msg_queue::sptr queue_; + std::shared_ptr> queue_; std::list available_GPS_1C_signals_; std::list available_GPS_2S_signals_; @@ -203,6 +209,7 @@ private: std::map mapStringValues_; std::vector channels_state_; + channel_status_msg_receiver_sptr channels_status_; //class that receives and stores the current status of the receiver channels std::mutex signal_list_mutex; bool enable_monitor_; diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 5cac461ad..f274c82dc 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -30,7 +30,7 @@ */ #include "tcp_cmd_interface.h" -#include "control_message_factory.h" +#include "command_event.h" #include "pvt_interface.h" #include #include @@ -94,17 +94,16 @@ arma::vec TcpCmdInterface::get_LLH() std::string TcpCmdInterface::reset(const std::vector &commandLine __attribute__((unused))) { std::string response; - std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(200, 1)); //send the restart message (who=200,what=1) + command_event_sptr new_evnt = command_event_make(200, 1); //send the restart message (who=200,what=1) + control_queue_->push(pmt::make_any(new_evnt)); response = "OK\n"; } else { response = "ERROR\n"; } - return response; } @@ -112,10 +111,10 @@ std::string TcpCmdInterface::reset(const std::vector &commandLine _ std::string TcpCmdInterface::standby(const std::vector &commandLine __attribute__((unused))) { std::string response; - std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(300, 10)); //send the standby message (who=300,what=10) + command_event_sptr new_evnt = command_event_make(300, 10); //send the standby message (who=300,what=10) + control_queue_->push(pmt::make_any(new_evnt)); response = "OK\n"; } else @@ -203,10 +202,10 @@ std::string TcpCmdInterface::hotstart(const std::vector &commandLin } else { - std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(300, 12)); //send the standby message (who=300,what=12) + command_event_sptr new_evnt = command_event_make(300, 12); //send the standby message (who=300,what=12) + control_queue_->push(pmt::make_any(new_evnt)); response = "OK\n"; } else @@ -250,10 +249,10 @@ std::string TcpCmdInterface::warmstart(const std::vector &commandLi } else { - std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(300, 13)); // send the warmstart message (who=300,what=13) + command_event_sptr new_evnt = command_event_make(300, 13); // send the warmstart message (who=300,what=13) + control_queue_->push(pmt::make_any(new_evnt)); response = "OK\n"; } else @@ -273,16 +272,17 @@ std::string TcpCmdInterface::warmstart(const std::vector &commandLi std::string TcpCmdInterface::coldstart(const std::vector &commandLine __attribute__((unused))) { std::string response; - std::unique_ptr cmf(new ControlMessageFactory()); if (control_queue_ != nullptr) { - control_queue_->handle(cmf->GetQueueMessage(300, 11)); // send the coldstart message (who=300,what=11) + command_event_sptr new_evnt = command_event_make(300, 11); // send the coldstart message (who=300,what=11) + control_queue_->push(pmt::make_any(new_evnt)); response = "OK\n"; } else { response = "ERROR\n"; } + return response; } @@ -296,7 +296,7 @@ std::string TcpCmdInterface::set_ch_satellite(const std::vector &co } -void TcpCmdInterface::set_msg_queue(gr::msg_queue::sptr control_queue) +void TcpCmdInterface::set_msg_queue(std::shared_ptr> control_queue) { control_queue_ = std::move(control_queue); } diff --git a/src/core/receiver/tcp_cmd_interface.h b/src/core/receiver/tcp_cmd_interface.h index e5658a6d9..0b6276e92 100644 --- a/src/core/receiver/tcp_cmd_interface.h +++ b/src/core/receiver/tcp_cmd_interface.h @@ -32,8 +32,9 @@ #define GNSS_SDR_TCP_CMD_INTERFACE_H_ +#include "concurrent_queue.h" #include -#include +#include #include #include #include @@ -50,7 +51,7 @@ public: TcpCmdInterface(); virtual ~TcpCmdInterface(); void run_cmd_server(int tcp_port); - void set_msg_queue(gr::msg_queue::sptr control_queue); + void set_msg_queue(std::shared_ptr> control_queue); /*! * \brief gets the UTC time parsed from the last TC command issued @@ -77,7 +78,7 @@ private: void register_functions(); - gr::msg_queue::sptr control_queue_; + std::shared_ptr> control_queue_; bool keep_running_; time_t receiver_utc_time_; diff --git a/src/core/system_parameters/Beidou_DNAV.h b/src/core/system_parameters/Beidou_DNAV.h index fdbdf7dfd..8cd45077c 100644 --- a/src/core/system_parameters/Beidou_DNAV.h +++ b/src/core/system_parameters/Beidou_DNAV.h @@ -46,13 +46,11 @@ const double BEIDOU_DNAV_F = -4.442807309e-10; //!< Constant, [s/(m)^ const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11; const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // ************** -const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300; -const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300; +const int32_t BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300; +const uint32_t BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300; const int32_t BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits] -const double BEIDOU_DNAV_WORDS_SUBFRAME = 10; -const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30; -const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50; -const double BEIDOU_D2NAV_SYMBOL_RATE_SPS = 500; +const uint32_t BEIDOU_DNAV_WORDS_SUBFRAME = 10; +const uint32_t BEIDOU_DNAV_WORD_LENGTH_BITS = 30; const std::string BEIDOU_DNAV_PREAMBLE = "11100010010"; // Number of leap seconds passed from the start of the GPS epoch up to the start of BeiDou epoch diff --git a/src/core/system_parameters/beidou_dnav_navigation_message.cc b/src/core/system_parameters/beidou_dnav_navigation_message.cc index c93e07c4e..4cb83cd1c 100644 --- a/src/core/system_parameters/beidou_dnav_navigation_message.cc +++ b/src/core/system_parameters/beidou_dnav_navigation_message.cc @@ -256,10 +256,10 @@ uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned( { for (int32_t j = 0; j < parameter[i].second; j++) { - value <<= 1; //shift left + value <<= 1U; // shift left if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1) { - value += 1; // insert the bit + value += 1U; // insert the bit } } } @@ -544,7 +544,7 @@ int32_t Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& s d_sqrt_A = d_sqrt_A * D1_SQRT_A_LSB; d_Toe_sf2 = static_cast(read_navigation_unsigned(subframe_bits, D1_TOE_SF2)); - d_Toe_sf2 = static_cast((static_cast(d_Toe_sf2) << 15)); + d_Toe_sf2 = static_cast((static_cast(d_Toe_sf2) << 15U)); // Set system flags for message reception flag_d1_sf2 = true; @@ -800,7 +800,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_A_f0 = static_cast(read_navigation_signed(subframe_bits, D2_A0)) * D1_A0_LSB; d_A_f1_msb_bits = (read_navigation_unsigned(subframe_bits, D2_A1_MSB)); // Adjust for lsb in next page - d_A_f1_msb_bits = d_A_f1_msb_bits << 18; + d_A_f1_msb_bits = d_A_f1_msb_bits << 18ULL; // Set system flags for message reception flag_sf1_p3 = true; @@ -815,7 +815,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_Delta_n = static_cast(read_navigation_signed(subframe_bits, D2_DELTA_N)) * D1_DELTA_N_LSB; d_Cuc_msb_bits = (read_navigation_unsigned(subframe_bits, D2_CUC_MSB)); // Adjust for lsb in next page - d_Cuc_msb_bits = d_Cuc_msb_bits << 4; + d_Cuc_msb_bits = d_Cuc_msb_bits << 4U; // Set system flags for message reception flag_sf1_p4 = true; @@ -830,8 +830,8 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_eccentricity_msb = static_cast(read_navigation_unsigned(subframe_bits, D2_E_MSB)); d_eccentricity_msb_bits = (read_navigation_unsigned(subframe_bits, D2_E_MSB)); // Adjust for lsb in next page (shift number of lsb to the left) - d_eccentricity_msb = static_cast((static_cast(d_eccentricity_msb) << 22)); - d_eccentricity_msb_bits = d_eccentricity_msb_bits << 22; + d_eccentricity_msb = static_cast((static_cast(d_eccentricity_msb) << 22U)); + d_eccentricity_msb_bits = d_eccentricity_msb_bits << 22U; // Set system flags for message reception flag_sf1_p5 = true; @@ -845,7 +845,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_sqrt_A = static_cast(read_navigation_unsigned(subframe_bits, D2_SQRT_A)) * D1_SQRT_A_LSB; d_Cic_msb_bits = (read_navigation_unsigned(subframe_bits, D2_CIC_MSB)); // Adjust for lsb in next page (shift number of lsb to the left) - d_Cic_msb_bits = d_Cic_msb_bits << 8; + d_Cic_msb_bits = d_Cic_msb_bits << 8U; // Set system flags for message reception flag_sf1_p6 = true; @@ -859,7 +859,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_Toe = static_cast(read_navigation_unsigned(subframe_bits, D2_TOE)) * D1_TOE_LSB; d_i_0_msb_bits = (read_navigation_unsigned(subframe_bits, D2_I0_MSB)); // Adjust for lsb in next page (shift number of lsb to the left) - d_i_0_msb_bits = d_i_0_msb_bits << 11; + d_i_0_msb_bits = d_i_0_msb_bits << 11U; // Set system flags for message reception flag_sf1_p7 = true; @@ -873,7 +873,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_Crs = static_cast(read_navigation_signed(subframe_bits, D2_CRS)) * D1_CRS_LSB; d_OMEGA_DOT_msb_bits = (read_navigation_unsigned(subframe_bits, D2_OMEGA_DOT_MSB)); // Adjust for lsb in next page (shift number of lsb to the left) - d_OMEGA_DOT_msb_bits = d_OMEGA_DOT_msb_bits << 5; + d_OMEGA_DOT_msb_bits = d_OMEGA_DOT_msb_bits << 5ULL; // Set system flags for message reception flag_sf1_p8 = true; @@ -886,7 +886,7 @@ int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& s d_OMEGA0 = static_cast(read_navigation_signed(subframe_bits, D2_OMEGA0)) * D1_OMEGA0_LSB; d_OMEGA_msb_bits = (read_navigation_unsigned(subframe_bits, D2_OMEGA_MSB)); // Adjust for lsb in next page (shift number of lsb to the left) - d_OMEGA_msb_bits = d_OMEGA_msb_bits << 5; + d_OMEGA_msb_bits = d_OMEGA_msb_bits << 5U; // Set system flags for message reception flag_sf1_p9 = true; diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index 3807fc143..499a2bd77 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -439,7 +439,7 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset(bits[GALILEO_FNAV_DATA_FRAME_BITS - parameter[i].first - j]) == 1) { value += 1; // insert the bit diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index cb5f55b02..a1c21ca0a 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -266,7 +266,7 @@ uint64_t Galileo_Navigation_Message::read_navigation_unsigned(std::bitset(bits[GALILEO_DATA_JK_BITS - parameter[i].first - j]) == 1) { value += 1; // insert the bit @@ -285,7 +285,7 @@ uint64_t Galileo_Navigation_Message::read_page_type_unsigned(std::bitset(bits[GALILEO_PAGE_TYPE_BITS - parameter[i].first - j]) == 1) { value += 1ULL; // insert the bit @@ -965,6 +965,9 @@ int32_t Galileo_Navigation_Message::page_jk_decoder(const char* data_jk) DLOG(INFO) << "TOW_0= " << TOW_0; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; break; + + default: + break; } return page_number; } diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index c3d4176cd..b9f06aa43 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -111,7 +111,7 @@ Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message() bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset bits) { - int32_t sum_bits = 0; + uint32_t sum_bits = 0; int32_t sum_hamming = 0; int32_t C1 = 0; int32_t C2 = 0; @@ -121,12 +121,12 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset string_bits(GLONASS_GNAV_STRING_BITS); + std::vector string_bits(GLONASS_GNAV_STRING_BITS); // Populate data and hamming code vectors - for (int32_t i = 0; i < static_cast(GLONASS_GNAV_STRING_BITS); i++) + for (uint32_t i = 0; i < string_bits.size(); i++) { - string_bits[i] = static_cast(bits[i]); + string_bits[i] = static_cast(bits[i]); } // Compute C1 term @@ -239,7 +239,7 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset(bits[GPS_CNAV_DATA_PAGE_BITS - parameter[i].first - j]) == 1) { value += 1ULL; // insert the bit diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 8a4fb8943..021966a1a 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -869,7 +869,6 @@ endif() if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) add_executable(control_thread_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc - ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_message_factory_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/control_thread_test.cc ) if(${FILESYSTEM_FOUND}) diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index e20338cfa..748df14a1 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -60,7 +60,6 @@ DECLARE_string(log_dir); #include "unit-tests/arithmetic/fft_speed_test.cc" #include "unit-tests/arithmetic/magnitude_squared_test.cc" #include "unit-tests/arithmetic/multiply_test.cc" -#include "unit-tests/control-plane/control_message_factory_test.cc" #include "unit-tests/control-plane/control_thread_test.cc" #include "unit-tests/control-plane/file_configuration_test.cc" #include "unit-tests/control-plane/gnss_block_factory_test.cc" diff --git a/src/tests/unit-tests/control-plane/control_message_factory_test.cc b/src/tests/unit-tests/control-plane/control_message_factory_test.cc deleted file mode 100644 index 7440d37f4..000000000 --- a/src/tests/unit-tests/control-plane/control_message_factory_test.cc +++ /dev/null @@ -1,90 +0,0 @@ -/*! - * \file control message_factory_test.cc - * \brief This file implements tests for the ControlMessageFactory. - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * Carles Fernandez-Prades, 2012. cfernandez(at)cttc.es - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2018 (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. - * - * GNSS-SDR is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GNSS-SDR is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNSS-SDR. If not, see . - * - * ------------------------------------------------------------------------- - */ - - -#include "control_message_factory.h" -#include -#include - - -TEST(ControlMessageFactoryTest, GetQueueMessage) -{ - std::shared_ptr factory = std::make_shared(); - gr::message::sptr queue_message = factory->GetQueueMessage(0, 2); - auto control_messages = factory->GetControlMessages(queue_message); - unsigned int expected0 = 0; - unsigned int expected2 = 2; - EXPECT_EQ(expected0, control_messages->at(0)->who); - EXPECT_EQ(expected2, control_messages->at(0)->what); - EXPECT_EQ(sizeof(ControlMessage), queue_message->length()); -} - - -TEST(ControlMessageFactoryTest, GetControlMessages) -{ - std::shared_ptr factory = std::make_shared(); - gr::message::sptr queue_message = gr::message::make(0, 0, 0, sizeof(ControlMessage)); - std::shared_ptr control_message = std::make_shared(); - - control_message->who = 1; - control_message->what = 4; - - memcpy(queue_message->msg(), control_message.get(), sizeof(ControlMessage)); - std::shared_ptr>> control_messages = factory->GetControlMessages(queue_message); - - unsigned int expected1 = 1; - unsigned int expected4 = 4; - EXPECT_EQ(expected1, control_messages->size()); - EXPECT_EQ(expected1, control_messages->at(0)->who); - EXPECT_EQ(expected4, control_messages->at(0)->what); -} - -/* - -TEST(ControlMessageFactoryTest, GetControlMessagesWrongSize) -{ - - std::shared_ptr factory = std::make_shared(); - std::shared_ptr control_message = std::make_shared(); - - control_message->who = 1; - control_message->what = 4; - int another_int = 10; - - gr::message::sptr queue_message = gr::message::make(0, 0, 0, sizeof(ControlMessage) + sizeof(int)); - memcpy(queue_message->msg(), control_message.get(), sizeof(ControlMessage)); - memcpy(queue_message->msg() + sizeof(ControlMessage), &another_int, sizeof(int)); - std::shared_ptr>> control_messages = factory->GetControlMessages(queue_message); - - unsigned int expected0 = 0; - EXPECT_EQ(expected0, control_messages->size()); -} */ diff --git a/src/tests/unit-tests/control-plane/control_thread_test.cc b/src/tests/unit-tests/control-plane/control_thread_test.cc index 781a5af76..4a0ffa18e 100644 --- a/src/tests/unit-tests/control-plane/control_thread_test.cc +++ b/src/tests/unit-tests/control-plane/control_thread_test.cc @@ -32,16 +32,17 @@ #include "control_thread.h" -#include "control_message_factory.h" +#include "channel_event.h" +#include "command_event.h" +#include "concurrent_queue.h" #include "in_memory_configuration.h" #include #include #include #include #include -#include -#include #include +#include #include #include #include @@ -121,13 +122,10 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages /*unused*/) std::shared_ptr control_thread = std::make_shared(config); - gr::msg_queue::sptr control_queue = gr::msg_queue::make(0); - - std::unique_ptr control_msg_factory(new ControlMessageFactory()); - - control_queue->handle(control_msg_factory->GetQueueMessage(0, 0)); - control_queue->handle(control_msg_factory->GetQueueMessage(1, 0)); - control_queue->handle(control_msg_factory->GetQueueMessage(200, 0)); + std::shared_ptr> control_queue = std::make_shared>(); + control_queue->push(pmt::make_any(channel_event_make(0, 0))); + control_queue->push(pmt::make_any(channel_event_make(1, 0))); + control_queue->push(pmt::make_any(command_event_make(200, 0))); control_thread->set_control_queue(control_queue); try @@ -181,16 +179,14 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages2 /*unused*/) config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); std::unique_ptr control_thread2(new ControlThread(config)); + std::shared_ptr> control_queue2 = std::make_shared>(); - gr::msg_queue::sptr control_queue2 = gr::msg_queue::make(0); + control_queue2->push(pmt::make_any(channel_event_make(0, 0))); + control_queue2->push(pmt::make_any(channel_event_make(2, 0))); + control_queue2->push(pmt::make_any(channel_event_make(1, 0))); + control_queue2->push(pmt::make_any(channel_event_make(3, 0))); + control_queue2->push(pmt::make_any(command_event_make(200, 0))); - std::unique_ptr control_msg_factory2(new ControlMessageFactory()); - - control_queue2->handle(control_msg_factory2->GetQueueMessage(0, 0)); - control_queue2->handle(control_msg_factory2->GetQueueMessage(2, 0)); - control_queue2->handle(control_msg_factory2->GetQueueMessage(1, 0)); - control_queue2->handle(control_msg_factory2->GetQueueMessage(3, 0)); - control_queue2->handle(control_msg_factory2->GetQueueMessage(200, 0)); control_thread2->set_control_queue(control_queue2); @@ -245,7 +241,7 @@ TEST_F(ControlThreadTest /*unused*/, StopReceiverProgrammatically /*unused*/) config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); std::shared_ptr control_thread = std::make_shared(config); - gr::msg_queue::sptr control_queue = gr::msg_queue::make(0); + std::shared_ptr> control_queue = std::make_shared>(); control_thread->set_control_queue(control_queue); std::thread stop_receiver_thread(stop_receiver); diff --git a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc b/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc index 0af18c4e1..7fd850f73 100644 --- a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc +++ b/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc @@ -36,14 +36,15 @@ #include "gnss_block_factory.h" #include "acquisition_interface.h" #include "channel.h" +#include "concurrent_queue.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" #include "observables_interface.h" #include "pvt_interface.h" #include "telemetry_decoder_interface.h" #include "tracking_interface.h" -#include #include +#include #include TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource) @@ -53,7 +54,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFileSignalSource) std::string path = std::string(TEST_PATH); std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat"; configuration->set_property("SignalSource.filename", filename); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); // Example of a factory as a shared_ptr std::shared_ptr factory = std::make_shared(); // Example of a block as a shared_ptr @@ -67,7 +68,7 @@ TEST(GNSSBlockFactoryTest, InstantiateWrongSignalSource) { std::shared_ptr configuration = std::make_shared(); configuration->set_property("SignalSource.implementation", "Pepito"); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); // Example of a factory as a unique_ptr std::unique_ptr factory; // Example of a block as a unique_ptr @@ -90,7 +91,7 @@ TEST(GNSSBlockFactoryTest, InstantiateSignalConditioner) TEST(GNSSBlockFactoryTest, InstantiateFIRFilter) { std::shared_ptr configuration = std::make_shared(); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); configuration->set_property("InputFilter.implementation", "Fir_Filter"); @@ -123,7 +124,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFIRFilter) TEST(GNSSBlockFactoryTest, InstantiateFreqXlatingFIRFilter) { std::shared_ptr configuration = std::make_shared(); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); configuration->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter"); @@ -158,7 +159,7 @@ TEST(GNSSBlockFactoryTest, InstantiateFreqXlatingFIRFilter) TEST(GNSSBlockFactoryTest, InstantiatePulseBlankingFilter) { std::shared_ptr configuration = std::make_shared(); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); configuration->set_property("InputFilter.implementation", "Pulse_Blanking_Filter"); std::unique_ptr factory; @@ -171,7 +172,7 @@ TEST(GNSSBlockFactoryTest, InstantiatePulseBlankingFilter) TEST(GNSSBlockFactoryTest, InstantiateNotchFilter) { std::shared_ptr configuration = std::make_shared(); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); configuration->set_property("InputFilter.implementation", "Notch_Filter"); std::unique_ptr factory; @@ -184,7 +185,7 @@ TEST(GNSSBlockFactoryTest, InstantiateNotchFilter) TEST(GNSSBlockFactoryTest, InstantiateNotchFilterLite) { std::shared_ptr configuration = std::make_shared(); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); configuration->set_property("InputFilter.implementation", "Notch_Filter_Lite"); std::unique_ptr factory; @@ -309,7 +310,7 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels) configuration->set_property("Channel0.item_type", "gr_complex"); configuration->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); configuration->set_property("Channel1.item_type", "gr_complex"); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); std::unique_ptr factory; std::unique_ptr>> channels = factory->GetChannels(configuration, queue); EXPECT_EQ(static_cast(2), channels->size()); diff --git a/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc b/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc index 711b49d5f..56a7671d1 100644 --- a/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc +++ b/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc @@ -30,17 +30,17 @@ * ------------------------------------------------------------------------- */ +#include "gnss_flowgraph.h" #include "acquisition_interface.h" #include "channel.h" #include "channel_interface.h" +#include "concurrent_queue.h" #include "file_configuration.h" #include "file_signal_source.h" #include "gnss_block_interface.h" -#include "gnss_flowgraph.h" #include "in_memory_configuration.h" #include "pass_through.h" #include "tracking_interface.h" -#include #include @@ -68,7 +68,7 @@ TEST(GNSSFlowgraph /*unused*/, InstantiateConnectStartStopOldNotation /*unused*/ config->set_property("Observables.implementation", "Hybrid_Observables"); config->set_property("PVT.implementation", "RTKLIB_PVT"); - std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); + std::shared_ptr flowgraph = std::make_shared(config, std::make_shared>()); EXPECT_NO_THROW(flowgraph->connect()); EXPECT_TRUE(flowgraph->connected()); @@ -103,7 +103,7 @@ TEST(GNSSFlowgraph /*unused*/, InstantiateConnectStartStop /*unused*/) config->set_property("Observables.implementation", "Hybrid_Observables"); config->set_property("PVT.implementation", "RTKLIB_PVT"); - std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); + std::shared_ptr flowgraph = std::make_shared(config, std::make_shared>()); EXPECT_NO_THROW(flowgraph->connect()); EXPECT_TRUE(flowgraph->connected()); @@ -137,7 +137,7 @@ TEST(GNSSFlowgraph /*unused*/, InstantiateConnectStartStopGalileoE1B /*unused*/) config->set_property("Observables.implementation", "Hybrid_Observables"); config->set_property("PVT.implementation", "RTKLIB_PVT"); - std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); + std::shared_ptr flowgraph = std::make_shared(config, std::make_shared>()); EXPECT_NO_THROW(flowgraph->connect()); EXPECT_TRUE(flowgraph->connected()); @@ -253,7 +253,7 @@ TEST(GNSSFlowgraph /*unused*/, InstantiateConnectStartStopHybrid /*unused*/) config->set_property("Observables.implementation", "Hybrid_Observables"); config->set_property("PVT.implementation", "RTKLIB_PVT"); - std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); + std::shared_ptr flowgraph = std::make_shared(config, std::make_shared>()); EXPECT_NO_THROW(flowgraph->connect()); EXPECT_TRUE(flowgraph->connected()); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc index 8c9c87779..94f96e4a6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -342,7 +343,7 @@ protected: Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr config; @@ -598,7 +599,7 @@ int AcquisitionPerformanceTest::run_receiver() boost::shared_ptr msg_rx = AcqPerfTest_msg_rx_make(channel_internal_queue); gr::blocks::skiphead::sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), FLAGS_acq_test_skiphead); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); gnss_synchro = Gnss_Synchro(); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc index c2658889a..8278d3e42 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc @@ -31,9 +31,10 @@ */ +#include "beidou_b1i_pcps_acquisition.h" #include "Beidou_B1I.h" #include "acquisition_dump_reader.h" -#include "beidou_b1i_pcps_acquisition.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -46,9 +47,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -198,7 +199,7 @@ void BeidouB1iPcpsAcquisitionTest::plot_grid() std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; - std::vector > *mag = &acq_dump.mag; + std::vector> *mag = &acq_dump.mag; const std::string gnuplot_executable(FLAGS_gnuplot_executable); if (gnuplot_executable.empty()) @@ -261,7 +262,7 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ConnectAndRun) int nsamples = 25000; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc index 725135d5b..6415b44cc 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc @@ -31,9 +31,10 @@ */ +#include "beidou_b3i_pcps_acquisition.h" #include "Beidou_B3I.h" #include "acquisition_dump_reader.h" -#include "beidou_b3i_pcps_acquisition.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -46,9 +47,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -197,7 +198,7 @@ void BeidouB3iPcpsAcquisitionTest::plot_grid() std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; - std::vector > *mag = &acq_dump.mag; + std::vector> *mag = &acq_dump.mag; const std::string gnuplot_executable(FLAGS_gnuplot_executable); if (gnuplot_executable.empty()) @@ -260,7 +261,7 @@ TEST_F(BeidouB3iPcpsAcquisitionTest, ConnectAndRun) int nsamples = 50000; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index a1517dd8f..37c8396e0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -30,8 +30,9 @@ */ -#include "fir_filter.h" #include "galileo_e1_pcps_8ms_ambiguous_acquisition.h" +#include "concurrent_queue.h" +#include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -43,8 +44,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -134,7 +135,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr factory; @@ -433,7 +434,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) std::chrono::duration elapsed_seconds(0.0); config_1(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); @@ -483,7 +484,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue); @@ -572,7 +573,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index b9c692c4b..fc90be2ed 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -31,8 +31,9 @@ */ -#include "fir_filter.h" #include "galileo_e1_pcps_ambiguous_acquisition.h" +#include "concurrent_queue.h" +#include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -43,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -134,7 +134,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr factory; @@ -435,7 +435,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); config_1(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); @@ -466,7 +466,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -551,7 +551,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi { config_2(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 591f7bf25..850367401 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -42,6 +42,7 @@ #include "galileo_e1_pcps_ambiguous_acquisition.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -52,8 +53,8 @@ #include #include #include -#include #include +#include #include #include #ifdef GR_GREATER_38 @@ -140,7 +141,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -217,7 +218,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) int nsamples = 4 * fs_in; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); init(); @@ -248,7 +249,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 58fa9b8e6..7b4815f34 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -31,9 +31,10 @@ */ +#include "galileo_e1_pcps_ambiguous_acquisition.h" #include "Galileo_E1.h" #include "acquisition_dump_reader.h" -#include "galileo_e1_pcps_ambiguous_acquisition.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -47,9 +48,9 @@ #include #include #include -#include #include #include +#include #include #include @@ -200,7 +201,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() std::vector* doppler = &acq_dump.doppler; std::vector* samples = &acq_dump.samples; - std::vector >* mag = &acq_dump.mag; + std::vector>* mag = &acq_dump.mag; const std::string gnuplot_executable(FLAGS_gnuplot_executable); if (gnuplot_executable.empty()) @@ -265,7 +266,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); init(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index 60d23b6ba..d69972648 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -31,8 +31,9 @@ */ -#include "fir_filter.h" #include "galileo_e1_pcps_cccwsr_ambiguous_acquisition.h" +#include "concurrent_queue.h" +#include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -44,8 +45,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -135,7 +136,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr factory; @@ -438,7 +439,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); @@ -468,7 +469,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) { config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); @@ -561,7 +562,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili { config_2(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 8c06a3419..45287515c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -31,8 +31,8 @@ */ -#include "fir_filter.h" #include "galileo_e1_pcps_quicksync_ambiguous_acquisition.h" +#include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -142,7 +143,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr factory; @@ -560,7 +561,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) std::chrono::time_point begin, end; std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); config_1(); @@ -597,7 +598,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul LOG(INFO) << "Start validation of results test"; config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); @@ -688,7 +689,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul LOG(INFO) << "Start validation of results with noise+interference test"; config_3(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); @@ -776,7 +777,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul { config_2(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index a021e5196..d7c414fcf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -30,9 +30,10 @@ * ------------------------------------------------------------------------- */ +#include "galileo_e1_pcps_tong_ambiguous_acquisition.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include "fir_filter.h" -#include "galileo_e1_pcps_tong_ambiguous_acquisition.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -44,9 +45,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -135,7 +136,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr factory; @@ -438,7 +439,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0.0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); config_1(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); @@ -466,7 +467,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -555,7 +556,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro { config_2(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 652384472..cdf5ca0c0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -29,6 +29,7 @@ * ------------------------------------------------------------------------- */ +#include "concurrent_queue.h" #include "fir_filter.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" #include "gen_signal_source.h" @@ -42,8 +43,8 @@ #include #include #include -#include #include +#include #include #include #ifdef GR_GREATER_38 @@ -131,7 +132,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; @@ -540,7 +541,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) std::chrono::duration elapsed_seconds(0); acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 0); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); ASSERT_NO_THROW({ @@ -566,7 +567,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) { config_1(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 0); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc index dbee4f413..6972e356b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc @@ -31,10 +31,11 @@ */ +#include "glonass_l1_ca_pcps_acquisition.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include "freq_xlating_fir_filter.h" #include "gen_signal_source.h" -#include "glonass_l1_ca_pcps_acquisition.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" @@ -46,9 +47,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -140,7 +141,7 @@ protected: Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; GlonassL1CaPcpsAcquisition* acquisition; std::shared_ptr config; @@ -442,7 +443,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun) int nsamples = floor(fs_in * integration_time_ms * 1e-3); std::chrono::time_point begin, end; std::chrono::duration elapsed_seconds(0); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); config_1(); @@ -474,7 +475,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun) TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) { config_1(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); @@ -563,7 +564,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities) { config_2(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc index 86602ec9c..e339018a4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc @@ -30,8 +30,9 @@ * ------------------------------------------------------------------------- */ -#include "freq_xlating_fir_filter.h" #include "glonass_l1_ca_pcps_acquisition.h" +#include "concurrent_queue.h" +#include "freq_xlating_fir_filter.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -41,9 +42,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -184,7 +185,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ConnectAndRun) int nsamples = 62314; std::chrono::time_point begin, end; std::chrono::duration elapsed_seconds(0); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc index ba0611f90..1086d3119 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc @@ -30,10 +30,11 @@ */ +#include "glonass_l2_ca_pcps_acquisition.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include "fir_filter.h" #include "gen_signal_source.h" -#include "glonass_l2_ca_pcps_acquisition.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" @@ -45,9 +46,9 @@ #include #include #include -#include #include #include +#include #include #include #ifdef GR_GREATER_38 @@ -140,9 +141,9 @@ protected: void process_message(); void stop_queue(); - concurrent_queue channel_internal_queue; + Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; GlonassL2CaPcpsAcquisition* acquisition; std::shared_ptr config; @@ -440,7 +441,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ConnectAndRun) int nsamples = floor(fs_in * integration_time_ms * 1e-3); std::chrono::time_point begin, end; std::chrono::duration elapsed_seconds(0); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); config_1(); @@ -472,7 +473,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ConnectAndRun) TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults) { config_1(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); @@ -562,7 +563,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults) TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResultsProbabilities) { config_2(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); boost::shared_ptr msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index e4ef9974b..b6223065b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -31,13 +31,14 @@ */ +#include "gps_l1_ca_pcps_acquisition.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" -#include "gps_l1_ca_pcps_acquisition.h" #include "in_memory_configuration.h" #include "pass_through.h" #include "signal_generator.h" @@ -46,9 +47,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -140,7 +141,7 @@ protected: Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; GpsL1CaPcpsAcquisition* acquisition; std::shared_ptr config; @@ -435,7 +436,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) int nsamples = floor(fs_in * integration_time_ms * 1e-3); std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); config_1(); @@ -467,7 +468,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); @@ -557,7 +558,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 0ec417ee0..541a2a3b8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -31,14 +31,15 @@ */ +#include "gps_l1_ca_pcps_acquisition.h" #include "GPS_L1_CA.h" #include "acquisition_dump_reader.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" #include "gnuplot_i.h" -#include "gps_l1_ca_pcps_acquisition.h" #include "in_memory_configuration.h" #include "test_flags.h" #include @@ -46,7 +47,6 @@ #include #include #include -#include #include #include #include @@ -199,7 +199,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; - std::vector > *mag = &acq_dump.mag; + std::vector> *mag = &acq_dump.mag; const std::string gnuplot_executable(FLAGS_gnuplot_executable); if (gnuplot_executable.empty()) @@ -262,7 +262,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) int nsamples = 4000; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); init(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc index 58dd36719..dcc07a9e5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc @@ -41,7 +41,7 @@ #include #include #include -#include +#include "concurrent_queue.h" #include #include #include diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index 702b89f31..5a6bb87aa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -31,13 +31,14 @@ */ +#include "gps_l1_ca_pcps_opencl_acquisition.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" -#include "gps_l1_ca_pcps_opencl_acquisition.h" #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" @@ -45,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -118,7 +118,7 @@ class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test : public ::testing::Test protected: GpsL1CaPcpsOpenClAcquisitionGSoC2013Test() { - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); item_size = sizeof(gr_complex); stop = false; @@ -140,7 +140,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr config; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index 7dfcc5ea1..3f471fa44 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -31,11 +31,12 @@ */ +#include "gps_l1_ca_pcps_quicksync_acquisition.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" -#include "gps_l1_ca_pcps_quicksync_acquisition.h" #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" @@ -43,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -141,7 +141,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr acquisition; @@ -545,7 +545,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0.0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); config_1(); @@ -575,7 +575,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) { config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -669,7 +669,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise //config_3(); config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -760,7 +760,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili { config_2(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index b5977ff39..fd1a57464 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -31,13 +31,14 @@ */ +#include "gps_l1_ca_pcps_tong_acquisition.h" +#include "concurrent_queue.h" #include "configuration_interface.h" #include "fir_filter.h" #include "gen_signal_source.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" -#include "gps_l1_ca_pcps_tong_acquisition.h" #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" @@ -45,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -135,7 +135,7 @@ protected: void stop_queue(); Concurrent_Queue channel_internal_queue; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr acquisition; std::shared_ptr config; @@ -431,7 +431,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); config_1(); acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); @@ -461,7 +461,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -550,7 +550,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) { config_2(); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index de7bc4e27..d810a3a12 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -31,14 +31,15 @@ */ +#include "gps_l2_m_pcps_acquisition.h" #include "GPS_L2C.h" #include "acquisition_dump_reader.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" #include "gnuplot_i.h" -#include "gps_l2_m_pcps_acquisition.h" #include "in_memory_configuration.h" #include "test_flags.h" #include @@ -47,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -143,7 +143,7 @@ protected: void init(); void plot_grid(); - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -202,7 +202,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; - std::vector > *mag = &acq_dump.mag; + std::vector> *mag = &acq_dump.mag; const std::string gnuplot_executable(FLAGS_gnuplot_executable); if (gnuplot_executable.empty()) @@ -255,7 +255,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() TEST_F(GpsL2MPcpsAcquisitionTest, Instantiate) { init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 0); } @@ -265,7 +265,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); init(); std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 0); @@ -295,7 +295,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); top_block = gr::make_top_block("Acquisition test"); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); double expected_delay_samples = 1; //2004; double expected_doppler_hz = 1200; //3000; diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc index 03d055fac..32173ef44 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc @@ -39,6 +39,7 @@ #else #include #endif +#include "concurrent_queue.h" #include "file_signal_source.h" #include "fir_filter.h" #include "gnss_block_factory.h" @@ -48,7 +49,6 @@ #include "interleaved_byte_to_complex_byte.h" #include "interleaved_short_to_complex_short.h" #include -#include #include @@ -59,7 +59,7 @@ class FirFilterTest : public ::testing::Test protected: FirFilterTest() { - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); item_size = sizeof(gr_complex); config = std::make_shared(); } @@ -70,7 +70,7 @@ protected: void configure_cbyte_gr_complex(); void configure_gr_complex_gr_complex(); void configure_cshort_cshort(); - boost::shared_ptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr config; size_t item_size; diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc index 69c1dddf9..6aa42dafd 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc @@ -39,6 +39,7 @@ #else #include #endif +#include "concurrent_queue.h" #include "file_signal_source.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -46,7 +47,6 @@ #include "in_memory_configuration.h" #include "notch_filter_lite.h" #include -#include #include @@ -57,7 +57,7 @@ class NotchFilterLiteTest : public ::testing::Test protected: NotchFilterLiteTest() { - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); item_size = sizeof(gr_complex); config = std::make_shared(); nsamples = FLAGS_notch_filter_lite_test_nsamples; @@ -66,7 +66,7 @@ protected: void init(); void configure_gr_complex_gr_complex(); - boost::shared_ptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr config; size_t item_size; diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc index 8fb783b5f..c20c894c6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc @@ -39,6 +39,7 @@ #else #include #endif +#include "concurrent_queue.h" #include "file_signal_source.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -46,7 +47,6 @@ #include "in_memory_configuration.h" #include "notch_filter.h" #include -#include #include @@ -57,7 +57,7 @@ class NotchFilterTest : public ::testing::Test protected: NotchFilterTest() { - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); item_size = sizeof(gr_complex); config = std::make_shared(); nsamples = FLAGS_notch_filter_test_nsamples; @@ -66,7 +66,7 @@ protected: void init(); void configure_gr_complex_gr_complex(); - boost::shared_ptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr config; size_t item_size; diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc index d31b971fb..dab090737 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc @@ -39,6 +39,7 @@ #else #include #endif +#include "concurrent_queue.h" #include "file_signal_source.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -46,7 +47,6 @@ #include "in_memory_configuration.h" #include "pulse_blanking_filter.h" #include -#include #include @@ -57,7 +57,7 @@ class PulseBlankingFilterTest : public ::testing::Test protected: PulseBlankingFilterTest() { - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); item_size = sizeof(gr_complex); config = std::make_shared(); nsamples = FLAGS_pb_filter_test_nsamples; @@ -66,7 +66,7 @@ protected: void init(); void configure_gr_complex_gr_complex(); - boost::shared_ptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr config; size_t item_size; diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index 497805de7..a15b0ec02 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -415,7 +415,7 @@ bool HybridObservablesTest::acquire_signal() System_and_Signal = "Galileo E5a"; config->set_property("Acquisition_5X.coherent_integration_time_ms", "1"); config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); - config->set_property("Acquisition.CAF_window_hz", "0"); // **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is desactivated. Recommended value 3000 Hz + config->set_property("Acquisition.CAF_window_hz", "0"); // **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is deactivated. Recommended value 3000 Hz config->set_property("Acquisition.Zero_padding", "0"); //**Only for E5a** Avoids power loss and doppler ambiguity in bit transitions by correlating one code with twice the input data length, ensuring that at least one full code is present without transitions. If set to 1 it is ON, if set to 0 it is OFF. config->set_property("Acquisition.bit_transition_flag", "false"); acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); @@ -707,9 +707,9 @@ void HybridObservablesTest::configure_receiver( std::memcpy(static_cast(gnss_synchro_master.Signal), str, 3); // copy string into synchro char array: 2 char + null config->set_property("Tracking.early_late_space_chips", "0.15"); - config->set_property("Tracking.very_early_late_space_chips", "0.6"); + config->set_property("Tracking.very_early_late_space_chips", "0.5"); config->set_property("Tracking.early_late_space_narrow_chips", "0.15"); - config->set_property("Tracking.very_early_late_space_narrow_chips", "0.6"); + config->set_property("Tracking.very_early_late_space_narrow_chips", "0.5"); config->set_property("Tracking.track_pilot", "true"); config->set_property("TelemetryDecoder.implementation", "Galileo_E1B_Telemetry_Decoder"); @@ -741,7 +741,8 @@ void HybridObservablesTest::configure_receiver( } config->set_property("Tracking.early_late_space_chips", "0.5"); config->set_property("Tracking.track_pilot", "true"); - config->set_property("Tracking.order", "2"); + config->set_property("Tracking.pll_filter_order", "2"); + config->set_property("Tracking.dll_filter_order", "2"); config->set_property("TelemetryDecoder.implementation", "Galileo_E5a_Telemetry_Decoder"); } @@ -755,7 +756,8 @@ void HybridObservablesTest::configure_receiver( config->set_property("Tracking.early_late_space_chips", "0.5"); config->set_property("Tracking.track_pilot", "true"); - config->set_property("Tracking.order", "2"); + config->set_property("Tracking.pll_filter_order", "2"); + config->set_property("Tracking.dll_filter_order", "2"); config->set_property("TelemetryDecoder.implementation", "GPS_L5_Telemetry_Decoder"); } @@ -875,78 +877,81 @@ void HybridObservablesTest::check_results_carrier_phase_double_diff( int size2 = measured_ch1.col(0).n_rows; double t1 = std::min(measured_ch0(size1 - 1, 0), measured_ch1(size2 - 1, 0)); - arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); - //conversion between arma::vec and std:vector - arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); - std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - - - arma::vec true_ch0_carrier_phase_interp; - arma::vec true_ch1_carrier_phase_interp; - arma::interp1(true_tow_ch0_s, true_ch0.col(3), t, true_ch0_carrier_phase_interp); - arma::interp1(true_tow_ch1_s, true_ch1.col(3), t, true_ch1_carrier_phase_interp); - - arma::vec meas_ch0_carrier_phase_interp; - arma::vec meas_ch1_carrier_phase_interp; - arma::interp1(measured_ch0.col(0), measured_ch0.col(3), t, meas_ch0_carrier_phase_interp); - arma::interp1(measured_ch1.col(0), measured_ch1.col(3), t, meas_ch1_carrier_phase_interp); - - // generate double difference accumulated carrier phases - //compute error without the accumulated carrier phase offsets (which depends on the receiver starting time) - arma::vec delta_true_carrier_phase_cycles = (true_ch0_carrier_phase_interp - true_ch0_carrier_phase_interp(0)) - (true_ch1_carrier_phase_interp - true_ch1_carrier_phase_interp(0)); - arma::vec delta_measured_carrier_phase_cycles = (meas_ch0_carrier_phase_interp - meas_ch0_carrier_phase_interp(0)) - (meas_ch1_carrier_phase_interp - meas_ch1_carrier_phase_interp(0)); - - //2. RMSE - arma::vec err; - - err = delta_measured_carrier_phase_cycles - delta_true_carrier_phase_cycles; - arma::vec err2 = arma::square(err); - double rmse = sqrt(arma::mean(err2)); - - //3. Mean err and variance - double error_mean = arma::mean(err); - double error_var = arma::var(err); - - // 4. Peaks - double max_error = arma::max(err); - double min_error = arma::min(err); - - //5. report - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Double diff Carrier Phase RMSE = " - << rmse << ", mean = " << error_mean - << ", stdev = " << sqrt(error_var) - << " (max,min) = " << max_error - << "," << min_error - << " [Cycles]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) + if ((t1 - t0) > 0) { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Double diff Carrier Phase error [Cycles]"); + arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); //conversion between arma::vec and std:vector - std::vector range_error_m(err.colptr(0), err.colptr(0) + err.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, range_error_m, - "Double diff Carrier Phase error"); - g3.set_legend(); - g3.savetops(data_title + "double_diff_carrier_phase_error"); + arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); + std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - g3.showonscreen(); // window output + + arma::vec true_ch0_carrier_phase_interp; + arma::vec true_ch1_carrier_phase_interp; + arma::interp1(true_tow_ch0_s, true_ch0.col(3), t, true_ch0_carrier_phase_interp); + arma::interp1(true_tow_ch1_s, true_ch1.col(3), t, true_ch1_carrier_phase_interp); + + arma::vec meas_ch0_carrier_phase_interp; + arma::vec meas_ch1_carrier_phase_interp; + arma::interp1(measured_ch0.col(0), measured_ch0.col(3), t, meas_ch0_carrier_phase_interp); + arma::interp1(measured_ch1.col(0), measured_ch1.col(3), t, meas_ch1_carrier_phase_interp); + + // generate double difference accumulated carrier phases + //compute error without the accumulated carrier phase offsets (which depends on the receiver starting time) + arma::vec delta_true_carrier_phase_cycles = (true_ch0_carrier_phase_interp - true_ch0_carrier_phase_interp(0)) - (true_ch1_carrier_phase_interp - true_ch1_carrier_phase_interp(0)); + arma::vec delta_measured_carrier_phase_cycles = (meas_ch0_carrier_phase_interp - meas_ch0_carrier_phase_interp(0)) - (meas_ch1_carrier_phase_interp - meas_ch1_carrier_phase_interp(0)); + + //2. RMSE + arma::vec err; + + err = delta_measured_carrier_phase_cycles - delta_true_carrier_phase_cycles; + arma::vec err2 = arma::square(err); + double rmse = sqrt(arma::mean(err2)); + + //3. Mean err and variance + double error_mean = arma::mean(err); + double error_var = arma::var(err); + + // 4. Peaks + double max_error = arma::max(err); + double min_error = arma::min(err); + + //5. report + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Double diff Carrier Phase RMSE = " + << rmse << ", mean = " << error_mean + << ", stdev = " << sqrt(error_var) + << " (max,min) = " << max_error + << "," << min_error + << " [Cycles]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Double diff Carrier Phase error [Cycles]"); + //conversion between arma::vec and std:vector + std::vector range_error_m(err.colptr(0), err.colptr(0) + err.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, range_error_m, + "Double diff Carrier Phase error"); + g3.set_legend(); + g3.savetops(data_title + "double_diff_carrier_phase_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + ASSERT_LT(rmse, 0.25); + ASSERT_LT(error_mean, 0.2); + ASSERT_GT(error_mean, -0.2); + ASSERT_LT(error_var, 0.5); + ASSERT_LT(max_error, 0.5); + ASSERT_GT(min_error, -0.5); } - - //check results against the test tolerance - ASSERT_LT(rmse, 0.25); - ASSERT_LT(error_mean, 0.2); - ASSERT_GT(error_mean, -0.2); - ASSERT_LT(error_var, 0.5); - ASSERT_LT(max_error, 0.5); - ASSERT_GT(min_error, -0.5); } @@ -966,78 +971,81 @@ void HybridObservablesTest::check_results_carrier_doppler_double_diff( int size2 = measured_ch1.col(0).n_rows; double t1 = std::min(measured_ch0(size1 - 1, 0), measured_ch1(size2 - 1, 0)); - arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); - //conversion between arma::vec and std:vector - arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); - std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - - - arma::vec true_ch0_carrier_doppler_interp; - arma::vec true_ch1_carrier_doppler_interp; - arma::interp1(true_tow_ch0_s, true_ch0.col(2), t, true_ch0_carrier_doppler_interp); - arma::interp1(true_tow_ch1_s, true_ch1.col(2), t, true_ch1_carrier_doppler_interp); - - arma::vec meas_ch0_carrier_doppler_interp; - arma::vec meas_ch1_carrier_doppler_interp; - arma::interp1(measured_ch0.col(0), measured_ch0.col(2), t, meas_ch0_carrier_doppler_interp); - arma::interp1(measured_ch1.col(0), measured_ch1.col(2), t, meas_ch1_carrier_doppler_interp); - - // generate double difference carrier Doppler - arma::vec delta_true_carrier_doppler_cycles = true_ch0_carrier_doppler_interp - true_ch1_carrier_doppler_interp; - arma::vec delta_measured_carrier_doppler_cycles = meas_ch0_carrier_doppler_interp - meas_ch1_carrier_doppler_interp; - - //2. RMSE - arma::vec err; - - err = delta_measured_carrier_doppler_cycles - delta_true_carrier_doppler_cycles; - arma::vec err2 = arma::square(err); - double rmse = sqrt(arma::mean(err2)); - - //3. Mean err and variance - double error_mean = arma::mean(err); - double error_var = arma::var(err); - - // 4. Peaks - double max_error = arma::max(err); - double min_error = arma::min(err); - - //5. report - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Double diff Carrier Doppler RMSE = " - << rmse << ", mean = " << error_mean - << ", stdev = " << sqrt(error_var) - << " (max,min) = " << max_error - << "," << min_error - << " [Hz]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) + if ((t1 - t0) > 0) { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Double diff Carrier Doppler error [Hz]"); + arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); //conversion between arma::vec and std:vector - std::vector range_error_m(err.colptr(0), err.colptr(0) + err.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, range_error_m, - "Double diff Carrier Doppler error"); - g3.set_legend(); - g3.savetops(data_title + "double_diff_carrier_doppler_error"); + arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); + std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - g3.showonscreen(); // window output + + arma::vec true_ch0_carrier_doppler_interp; + arma::vec true_ch1_carrier_doppler_interp; + arma::interp1(true_tow_ch0_s, true_ch0.col(2), t, true_ch0_carrier_doppler_interp); + arma::interp1(true_tow_ch1_s, true_ch1.col(2), t, true_ch1_carrier_doppler_interp); + + arma::vec meas_ch0_carrier_doppler_interp; + arma::vec meas_ch1_carrier_doppler_interp; + arma::interp1(measured_ch0.col(0), measured_ch0.col(2), t, meas_ch0_carrier_doppler_interp); + arma::interp1(measured_ch1.col(0), measured_ch1.col(2), t, meas_ch1_carrier_doppler_interp); + + // generate double difference carrier Doppler + arma::vec delta_true_carrier_doppler_cycles = true_ch0_carrier_doppler_interp - true_ch1_carrier_doppler_interp; + arma::vec delta_measured_carrier_doppler_cycles = meas_ch0_carrier_doppler_interp - meas_ch1_carrier_doppler_interp; + + //2. RMSE + arma::vec err; + + err = delta_measured_carrier_doppler_cycles - delta_true_carrier_doppler_cycles; + arma::vec err2 = arma::square(err); + double rmse = sqrt(arma::mean(err2)); + + //3. Mean err and variance + double error_mean = arma::mean(err); + double error_var = arma::var(err); + + // 4. Peaks + double max_error = arma::max(err); + double min_error = arma::min(err); + + //5. report + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Double diff Carrier Doppler RMSE = " + << rmse << ", mean = " << error_mean + << ", stdev = " << sqrt(error_var) + << " (max,min) = " << max_error + << "," << min_error + << " [Hz]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Double diff Carrier Doppler error [Hz]"); + //conversion between arma::vec and std:vector + std::vector range_error_m(err.colptr(0), err.colptr(0) + err.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, range_error_m, + "Double diff Carrier Doppler error"); + g3.set_legend(); + g3.savetops(data_title + "double_diff_carrier_doppler_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + ASSERT_LT(error_mean, 5); + ASSERT_GT(error_mean, -5); + //assuming PLL BW=35 + ASSERT_LT(error_var, 250); + ASSERT_LT(max_error, 100); + ASSERT_GT(min_error, -100); + ASSERT_LT(rmse, 30); } - - //check results against the test tolerance - ASSERT_LT(error_mean, 5); - ASSERT_GT(error_mean, -5); - //assuming PLL BW=35 - ASSERT_LT(error_var, 250); - ASSERT_LT(max_error, 100); - ASSERT_GT(min_error, -100); - ASSERT_LT(rmse, 30); } @@ -1052,71 +1060,75 @@ void HybridObservablesTest::check_results_carrier_doppler( double t0 = measured_ch0(0, 0); int size1 = measured_ch0.col(0).n_rows; double t1 = measured_ch0(size1 - 1, 0); - arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); - //conversion between arma::vec and std:vector - arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); - std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - arma::vec true_ch0_doppler_interp; - arma::interp1(true_tow_s, true_ch0.col(2), t, true_ch0_doppler_interp); - - arma::vec meas_ch0_doppler_interp; - arma::interp1(measured_ch0.col(0), measured_ch0.col(2), t, meas_ch0_doppler_interp); - - //2. RMSE - arma::vec err_ch0_hz; - - //compute error - err_ch0_hz = meas_ch0_doppler_interp - true_ch0_doppler_interp; - - arma::vec err2_ch0 = arma::square(err_ch0_hz); - double rmse_ch0 = sqrt(arma::mean(err2_ch0)); - - //3. Mean err and variance - double error_mean_ch0 = arma::mean(err_ch0_hz); - double error_var_ch0 = arma::var(err_ch0_hz); - - // 4. Peaks - double max_error_ch0 = arma::max(err_ch0_hz); - double min_error_ch0 = arma::min(err_ch0_hz); - - //5. report - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Carrier Doppler RMSE = " - << rmse_ch0 << ", mean = " << error_mean_ch0 - << ", stdev = " << sqrt(error_var_ch0) - << " (max,min) = " << max_error_ch0 - << "," << min_error_ch0 - << " [Hz]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) + if ((t1 - t0) > 0) { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Carrier Doppler error [Hz]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Carrier Doppler error [Hz]"); + arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); //conversion between arma::vec and std:vector - std::vector error_vec(err_ch0_hz.colptr(0), err_ch0_hz.colptr(0) + err_ch0_hz.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, error_vec, - "Carrier Doppler error"); - g3.set_legend(); - g3.savetops(data_title + "Carrier_doppler_error"); + arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); + std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - g3.showonscreen(); // window output + arma::vec true_ch0_doppler_interp; + arma::interp1(true_tow_s, true_ch0.col(2), t, true_ch0_doppler_interp); + + arma::vec meas_ch0_doppler_interp; + arma::interp1(measured_ch0.col(0), measured_ch0.col(2), t, meas_ch0_doppler_interp); + + //2. RMSE + arma::vec err_ch0_hz; + + //compute error + err_ch0_hz = meas_ch0_doppler_interp - true_ch0_doppler_interp; + + arma::vec err2_ch0 = arma::square(err_ch0_hz); + double rmse_ch0 = sqrt(arma::mean(err2_ch0)); + + //3. Mean err and variance + double error_mean_ch0 = arma::mean(err_ch0_hz); + double error_var_ch0 = arma::var(err_ch0_hz); + + // 4. Peaks + double max_error_ch0 = arma::max(err_ch0_hz); + double min_error_ch0 = arma::min(err_ch0_hz); + + //5. report + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Carrier Doppler RMSE = " + << rmse_ch0 << ", mean = " << error_mean_ch0 + << ", stdev = " << sqrt(error_var_ch0) + << " (max,min) = " << max_error_ch0 + << "," << min_error_ch0 + << " [Hz]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Carrier Doppler error [Hz]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Carrier Doppler error [Hz]"); + //conversion between arma::vec and std:vector + std::vector error_vec(err_ch0_hz.colptr(0), err_ch0_hz.colptr(0) + err_ch0_hz.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, error_vec, + "Carrier Doppler error"); + g3.set_legend(); + g3.savetops(data_title + "Carrier_doppler_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + ASSERT_LT(error_mean_ch0, 5); + ASSERT_GT(error_mean_ch0, -5); + //assuming PLL BW=35 + ASSERT_LT(error_var_ch0, 250); + ASSERT_LT(max_error_ch0, 100); + ASSERT_GT(min_error_ch0, -100); + ASSERT_LT(rmse_ch0, 30); } - - //check results against the test tolerance - ASSERT_LT(error_mean_ch0, 5); - ASSERT_GT(error_mean_ch0, -5); - //assuming PLL BW=35 - ASSERT_LT(error_var_ch0, 250); - ASSERT_LT(max_error_ch0, 100); - ASSERT_GT(min_error_ch0, -100); - ASSERT_LT(rmse_ch0, 30); } void HybridObservablesTest::check_results_duplicated_satellite( @@ -1156,217 +1168,220 @@ void HybridObservablesTest::check_results_duplicated_satellite( t1 = t1_sat1; } - arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); - //conversion between arma::vec and std:vector - arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); - std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - //Doppler - arma::vec meas_sat1_doppler_interp; - arma::interp1(measured_sat1.col(0), measured_sat1.col(2), t, meas_sat1_doppler_interp); - arma::vec meas_sat2_doppler_interp; - arma::interp1(measured_sat2.col(0), measured_sat2.col(2), t, meas_sat2_doppler_interp); - - //Carrier Phase - arma::vec meas_sat1_carrier_phase_interp; - arma::vec meas_sat2_carrier_phase_interp; - arma::interp1(measured_sat1.col(0), measured_sat1.col(3), t, meas_sat1_carrier_phase_interp); - arma::interp1(measured_sat2.col(0), measured_sat2.col(3), t, meas_sat2_carrier_phase_interp); - - // generate double difference accumulated carrier phases - //compute error without the accumulated carrier phase offsets (which depends on the receiver starting time) - arma::vec delta_measured_carrier_phase_cycles = (meas_sat1_carrier_phase_interp - meas_sat1_carrier_phase_interp(0)) - (meas_sat2_carrier_phase_interp - meas_sat2_carrier_phase_interp(0)); - - //Pseudoranges - arma::vec meas_sat1_dist_interp; - arma::vec meas_sat2_dist_interp; - arma::interp1(measured_sat1.col(0), measured_sat1.col(4), t, meas_sat1_dist_interp); - arma::interp1(measured_sat2.col(0), measured_sat2.col(4), t, meas_sat2_dist_interp); - // generate delta pseudoranges - arma::vec delta_measured_dist_m = meas_sat1_dist_interp - meas_sat2_dist_interp; - - //Carrier Doppler error - //2. RMSE - arma::vec err_ch0_hz; - - //compute error - err_ch0_hz = meas_sat1_doppler_interp - meas_sat2_doppler_interp; - - //save matlab file for further analysis - std::vector tmp_vector_common_time_s(t.colptr(0), - t.colptr(0) + t.n_rows); - - std::vector tmp_vector_err_ch0_hz(err_ch0_hz.colptr(0), - err_ch0_hz.colptr(0) + err_ch0_hz.n_rows); - save_mat_xy(tmp_vector_common_time_s, tmp_vector_err_ch0_hz, std::string("measured_doppler_error_ch_" + std::to_string(ch_id))); - - //compute statistics - arma::vec err2_ch0 = arma::square(err_ch0_hz); - double rmse_ch0 = sqrt(arma::mean(err2_ch0)); - - //3. Mean err and variance - double error_mean_ch0 = arma::mean(err_ch0_hz); - double error_var_ch0 = arma::var(err_ch0_hz); - - // 4. Peaks - double max_error_ch0 = arma::max(err_ch0_hz); - double min_error_ch0 = arma::min(err_ch0_hz); - - //5. report - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Carrier Doppler RMSE = " - << rmse_ch0 << ", mean = " << error_mean_ch0 - << ", stdev = " << sqrt(error_var_ch0) - << " (max,min) = " << max_error_ch0 - << "," << min_error_ch0 - << " [Hz]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) + if ((t1 - t0) > 0) { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Carrier Doppler error [Hz]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Carrier Doppler error [Hz]"); + arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); //conversion between arma::vec and std:vector - std::vector error_vec(err_ch0_hz.colptr(0), err_ch0_hz.colptr(0) + err_ch0_hz.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, error_vec, - "Carrier Doppler error"); - g3.set_legend(); - g3.savetops(data_title + "Carrier_doppler_error"); + arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); + std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); + //Doppler + arma::vec meas_sat1_doppler_interp; + arma::interp1(measured_sat1.col(0), measured_sat1.col(2), t, meas_sat1_doppler_interp); + arma::vec meas_sat2_doppler_interp; + arma::interp1(measured_sat2.col(0), measured_sat2.col(2), t, meas_sat2_doppler_interp); - g3.showonscreen(); // window output + //Carrier Phase + arma::vec meas_sat1_carrier_phase_interp; + arma::vec meas_sat2_carrier_phase_interp; + arma::interp1(measured_sat1.col(0), measured_sat1.col(3), t, meas_sat1_carrier_phase_interp); + arma::interp1(measured_sat2.col(0), measured_sat2.col(3), t, meas_sat2_carrier_phase_interp); + + // generate double difference accumulated carrier phases + //compute error without the accumulated carrier phase offsets (which depends on the receiver starting time) + arma::vec delta_measured_carrier_phase_cycles = (meas_sat1_carrier_phase_interp - meas_sat1_carrier_phase_interp(0)) - (meas_sat2_carrier_phase_interp - meas_sat2_carrier_phase_interp(0)); + + //Pseudoranges + arma::vec meas_sat1_dist_interp; + arma::vec meas_sat2_dist_interp; + arma::interp1(measured_sat1.col(0), measured_sat1.col(4), t, meas_sat1_dist_interp); + arma::interp1(measured_sat2.col(0), measured_sat2.col(4), t, meas_sat2_dist_interp); + // generate delta pseudoranges + arma::vec delta_measured_dist_m = meas_sat1_dist_interp - meas_sat2_dist_interp; + + //Carrier Doppler error + //2. RMSE + arma::vec err_ch0_hz; + + //compute error + err_ch0_hz = meas_sat1_doppler_interp - meas_sat2_doppler_interp; + + //save matlab file for further analysis + std::vector tmp_vector_common_time_s(t.colptr(0), + t.colptr(0) + t.n_rows); + + std::vector tmp_vector_err_ch0_hz(err_ch0_hz.colptr(0), + err_ch0_hz.colptr(0) + err_ch0_hz.n_rows); + save_mat_xy(tmp_vector_common_time_s, tmp_vector_err_ch0_hz, std::string("measured_doppler_error_ch_" + std::to_string(ch_id))); + + //compute statistics + arma::vec err2_ch0 = arma::square(err_ch0_hz); + double rmse_ch0 = sqrt(arma::mean(err2_ch0)); + + //3. Mean err and variance + double error_mean_ch0 = arma::mean(err_ch0_hz); + double error_var_ch0 = arma::var(err_ch0_hz); + + // 4. Peaks + double max_error_ch0 = arma::max(err_ch0_hz); + double min_error_ch0 = arma::min(err_ch0_hz); + + //5. report + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Carrier Doppler RMSE = " + << rmse_ch0 << ", mean = " << error_mean_ch0 + << ", stdev = " << sqrt(error_var_ch0) + << " (max,min) = " << max_error_ch0 + << "," << min_error_ch0 + << " [Hz]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Carrier Doppler error [Hz]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Carrier Doppler error [Hz]"); + //conversion between arma::vec and std:vector + std::vector error_vec(err_ch0_hz.colptr(0), err_ch0_hz.colptr(0) + err_ch0_hz.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, error_vec, + "Carrier Doppler error"); + g3.set_legend(); + g3.savetops(data_title + "Carrier_doppler_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + EXPECT_LT(error_mean_ch0, 5); + EXPECT_GT(error_mean_ch0, -5); + //assuming PLL BW=35 + EXPECT_LT(error_var_ch0, 250); + EXPECT_LT(max_error_ch0, 100); + EXPECT_GT(min_error_ch0, -100); + EXPECT_LT(rmse_ch0, 30); + + //Carrier Phase error + //2. RMSE + arma::vec err_carrier_phase; + + err_carrier_phase = delta_measured_carrier_phase_cycles; + + //save matlab file for further analysis + std::vector tmp_vector_err_carrier_phase(err_carrier_phase.colptr(0), + err_carrier_phase.colptr(0) + err_carrier_phase.n_rows); + save_mat_xy(tmp_vector_common_time_s, tmp_vector_err_carrier_phase, std::string("measured_carrier_phase_error_ch_" + std::to_string(ch_id))); + + + arma::vec err2_carrier_phase = arma::square(err_carrier_phase); + double rmse_carrier_phase = sqrt(arma::mean(err2_carrier_phase)); + + //3. Mean err and variance + double error_mean_carrier_phase = arma::mean(err_carrier_phase); + double error_var_carrier_phase = arma::var(err_carrier_phase); + + // 4. Peaks + double max_error_carrier_phase = arma::max(err_carrier_phase); + double min_error_carrier_phase = arma::min(err_carrier_phase); + + //5. report + ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Carrier Phase RMSE = " + << rmse_carrier_phase << ", mean = " << error_mean_carrier_phase + << ", stdev = " << sqrt(error_var_carrier_phase) + << " (max,min) = " << max_error_carrier_phase + << "," << min_error_carrier_phase + << " [Cycles]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Carrier Phase error [Cycles]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Carrier Phase error [Cycles]"); + //conversion between arma::vec and std:vector + std::vector range_error_m(err_carrier_phase.colptr(0), err_carrier_phase.colptr(0) + err_carrier_phase.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, range_error_m, + "Carrier Phase error"); + g3.set_legend(); + g3.savetops(data_title + "duplicated_satellite_carrier_phase_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + EXPECT_LT(rmse_carrier_phase, 0.25); + EXPECT_LT(error_mean_carrier_phase, 0.2); + EXPECT_GT(error_mean_carrier_phase, -0.2); + EXPECT_LT(error_var_carrier_phase, 0.5); + EXPECT_LT(max_error_carrier_phase, 0.5); + EXPECT_GT(min_error_carrier_phase, -0.5); + + //Pseudorange error + //2. RMSE + arma::vec err_pseudorange; + + err_pseudorange = delta_measured_dist_m; + + //save matlab file for further analysis + std::vector tmp_vector_err_pseudorange(err_pseudorange.colptr(0), + err_pseudorange.colptr(0) + err_pseudorange.n_rows); + save_mat_xy(tmp_vector_common_time_s, tmp_vector_err_pseudorange, std::string("measured_pr_error_ch_" + std::to_string(ch_id))); + + arma::vec err2_pseudorange = arma::square(err_pseudorange); + double rmse_pseudorange = sqrt(arma::mean(err2_pseudorange)); + + //3. Mean err and variance + double error_mean_pseudorange = arma::mean(err_pseudorange); + double error_var_pseudorange = arma::var(err_pseudorange); + + // 4. Peaks + double max_error_pseudorange = arma::max(err_pseudorange); + double min_error_pseudorange = arma::min(err_pseudorange); + + //5. report + ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Pseudorange RMSE = " + << rmse_pseudorange << ", mean = " << error_mean_pseudorange + << ", stdev = " << sqrt(error_var_pseudorange) + << " (max,min) = " << max_error_pseudorange + << "," << min_error_pseudorange + << " [meters]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Pseudorange error [m]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Pseudorange error [m]"); + //conversion between arma::vec and std:vector + std::vector range_error_m(err_pseudorange.colptr(0), err_pseudorange.colptr(0) + err_pseudorange.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, range_error_m, + "Pseudorrange error"); + g3.set_legend(); + g3.savetops(data_title + "duplicated_satellite_pseudorrange_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + EXPECT_LT(rmse_pseudorange, 3.0); + EXPECT_LT(error_mean_pseudorange, 1.0); + EXPECT_GT(error_mean_pseudorange, -1.0); + EXPECT_LT(error_var_pseudorange, 10.0); + EXPECT_LT(max_error_pseudorange, 10.0); + EXPECT_GT(min_error_pseudorange, -10.0); } - - //check results against the test tolerance - EXPECT_LT(error_mean_ch0, 5); - EXPECT_GT(error_mean_ch0, -5); - //assuming PLL BW=35 - EXPECT_LT(error_var_ch0, 250); - EXPECT_LT(max_error_ch0, 100); - EXPECT_GT(min_error_ch0, -100); - EXPECT_LT(rmse_ch0, 30); - - //Carrier Phase error - //2. RMSE - arma::vec err_carrier_phase; - - err_carrier_phase = delta_measured_carrier_phase_cycles; - - //save matlab file for further analysis - std::vector tmp_vector_err_carrier_phase(err_carrier_phase.colptr(0), - err_carrier_phase.colptr(0) + err_carrier_phase.n_rows); - save_mat_xy(tmp_vector_common_time_s, tmp_vector_err_carrier_phase, std::string("measured_carrier_phase_error_ch_" + std::to_string(ch_id))); - - - arma::vec err2_carrier_phase = arma::square(err_carrier_phase); - double rmse_carrier_phase = sqrt(arma::mean(err2_carrier_phase)); - - //3. Mean err and variance - double error_mean_carrier_phase = arma::mean(err_carrier_phase); - double error_var_carrier_phase = arma::var(err_carrier_phase); - - // 4. Peaks - double max_error_carrier_phase = arma::max(err_carrier_phase); - double min_error_carrier_phase = arma::min(err_carrier_phase); - - //5. report - ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Carrier Phase RMSE = " - << rmse_carrier_phase << ", mean = " << error_mean_carrier_phase - << ", stdev = " << sqrt(error_var_carrier_phase) - << " (max,min) = " << max_error_carrier_phase - << "," << min_error_carrier_phase - << " [Cycles]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) - { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Carrier Phase error [Cycles]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Carrier Phase error [Cycles]"); - //conversion between arma::vec and std:vector - std::vector range_error_m(err_carrier_phase.colptr(0), err_carrier_phase.colptr(0) + err_carrier_phase.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, range_error_m, - "Carrier Phase error"); - g3.set_legend(); - g3.savetops(data_title + "duplicated_satellite_carrier_phase_error"); - - g3.showonscreen(); // window output - } - - //check results against the test tolerance - EXPECT_LT(rmse_carrier_phase, 0.25); - EXPECT_LT(error_mean_carrier_phase, 0.2); - EXPECT_GT(error_mean_carrier_phase, -0.2); - EXPECT_LT(error_var_carrier_phase, 0.5); - EXPECT_LT(max_error_carrier_phase, 0.5); - EXPECT_GT(min_error_carrier_phase, -0.5); - - //Pseudorange error - //2. RMSE - arma::vec err_pseudorange; - - err_pseudorange = delta_measured_dist_m; - - //save matlab file for further analysis - std::vector tmp_vector_err_pseudorange(err_pseudorange.colptr(0), - err_pseudorange.colptr(0) + err_pseudorange.n_rows); - save_mat_xy(tmp_vector_common_time_s, tmp_vector_err_pseudorange, std::string("measured_pr_error_ch_" + std::to_string(ch_id))); - - arma::vec err2_pseudorange = arma::square(err_pseudorange); - double rmse_pseudorange = sqrt(arma::mean(err2_pseudorange)); - - //3. Mean err and variance - double error_mean_pseudorange = arma::mean(err_pseudorange); - double error_var_pseudorange = arma::var(err_pseudorange); - - // 4. Peaks - double max_error_pseudorange = arma::max(err_pseudorange); - double min_error_pseudorange = arma::min(err_pseudorange); - - //5. report - ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Pseudorange RMSE = " - << rmse_pseudorange << ", mean = " << error_mean_pseudorange - << ", stdev = " << sqrt(error_var_pseudorange) - << " (max,min) = " << max_error_pseudorange - << "," << min_error_pseudorange - << " [meters]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) - { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Pseudorange error [m]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Pseudorange error [m]"); - //conversion between arma::vec and std:vector - std::vector range_error_m(err_pseudorange.colptr(0), err_pseudorange.colptr(0) + err_pseudorange.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, range_error_m, - "Pseudorrange error"); - g3.set_legend(); - g3.savetops(data_title + "duplicated_satellite_pseudorrange_error"); - - g3.showonscreen(); // window output - } - - //check results against the test tolerance - EXPECT_LT(rmse_pseudorange, 3.0); - EXPECT_LT(error_mean_pseudorange, 1.0); - EXPECT_GT(error_mean_pseudorange, -1.0); - EXPECT_LT(error_var_pseudorange, 10.0); - EXPECT_LT(max_error_pseudorange, 10.0); - EXPECT_GT(min_error_pseudorange, -10.0); } bool HybridObservablesTest::save_mat_xy(std::vector& x, std::vector& y, std::string filename) @@ -1420,77 +1435,82 @@ void HybridObservablesTest::check_results_code_pseudorange( int size2 = measured_ch1.col(0).n_rows; double t1 = std::min(measured_ch0(size1 - 1, 0), measured_ch1(size2 - 1, 0)); - arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); - //conversion between arma::vec and std:vector - arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); - std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); - - - arma::vec true_ch0_dist_interp; - arma::vec true_ch1_dist_interp; - arma::interp1(true_tow_ch0_s, true_ch0.col(1), t, true_ch0_dist_interp); - arma::interp1(true_tow_ch1_s, true_ch1.col(1), t, true_ch1_dist_interp); - - arma::vec meas_ch0_dist_interp; - arma::vec meas_ch1_dist_interp; - arma::interp1(measured_ch0.col(0), measured_ch0.col(4), t, meas_ch0_dist_interp); - arma::interp1(measured_ch1.col(0), measured_ch1.col(4), t, meas_ch1_dist_interp); - - // generate delta pseudoranges - arma::vec delta_true_dist_m = true_ch0_dist_interp - true_ch1_dist_interp; - arma::vec delta_measured_dist_m = meas_ch0_dist_interp - meas_ch1_dist_interp; - - //2. RMSE - arma::vec err; - - err = delta_measured_dist_m - delta_true_dist_m; - arma::vec err2 = arma::square(err); - double rmse = sqrt(arma::mean(err2)); - - //3. Mean err and variance - double error_mean = arma::mean(err); - double error_var = arma::var(err); - - // 4. Peaks - double max_error = arma::max(err); - double min_error = arma::min(err); - - //5. report - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(10) << data_title << "Double diff Pseudorange RMSE = " - << rmse << ", mean = " << error_mean - << ", stdev = " << sqrt(error_var) - << " (max,min) = " << max_error - << "," << min_error - << " [meters]" << std::endl; - std::cout.precision(ss); - - //plots - if (FLAGS_show_plots) + if ((t1 - t0) > 0) { - Gnuplot g3("linespoints"); - g3.set_title(data_title + "Double diff Pseudorange error [m]"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Double diff Pseudorange error [m]"); + arma::vec t = arma::linspace(t0, t1, floor((t1 - t0) * 1e3)); //conversion between arma::vec and std:vector - std::vector range_error_m(err.colptr(0), err.colptr(0) + err.n_rows); - g3.cmd("set key box opaque"); - g3.plot_xy(time_vector, range_error_m, - "Double diff Pseudorrange error"); - g3.set_legend(); - g3.savetops(data_title + "double_diff_pseudorrange_error"); + arma::vec t_from_start = arma::linspace(0, t1 - t0, floor((t1 - t0) * 1e3)); + std::vector time_vector(t_from_start.colptr(0), t_from_start.colptr(0) + t_from_start.n_rows); + arma::vec true_ch0_dist_interp; + arma::vec true_ch1_dist_interp; + arma::interp1(true_tow_ch0_s, true_ch0.col(1), t, true_ch0_dist_interp); + arma::interp1(true_tow_ch1_s, true_ch1.col(1), t, true_ch1_dist_interp); - g3.showonscreen(); // window output + arma::vec meas_ch0_dist_interp; + arma::vec meas_ch1_dist_interp; + arma::interp1(measured_ch0.col(0), measured_ch0.col(4), t, meas_ch0_dist_interp); + arma::interp1(measured_ch1.col(0), measured_ch1.col(4), t, meas_ch1_dist_interp); + + // generate delta pseudoranges + arma::vec delta_true_dist_m = true_ch0_dist_interp - true_ch1_dist_interp; + arma::vec delta_measured_dist_m = meas_ch0_dist_interp - meas_ch1_dist_interp; + + //2. RMSE + arma::vec err; + + err = delta_measured_dist_m - delta_true_dist_m; + arma::vec err2 = arma::square(err); + double rmse = sqrt(arma::mean(err2)); + + //3. Mean err and variance + double error_mean = arma::mean(err); + double error_var = arma::var(err); + + // 4. Peaks + double max_error = arma::max(err); + double min_error = arma::min(err); + + //5. report + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(10) << data_title << "Double diff Pseudorange RMSE = " + << rmse << ", mean = " << error_mean + << ", stdev = " << sqrt(error_var) + << " (max,min) = " << max_error + << "," << min_error + << " [meters]" << std::endl; + std::cout.precision(ss); + + //plots + if (FLAGS_show_plots) + { + Gnuplot g3("linespoints"); + g3.set_title(data_title + "Double diff Pseudorange error [m]"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Double diff Pseudorange error [m]"); + //conversion between arma::vec and std:vector + std::vector range_error_m(err.colptr(0), err.colptr(0) + err.n_rows); + g3.cmd("set key box opaque"); + g3.plot_xy(time_vector, range_error_m, + "Double diff Pseudorrange error"); + g3.set_legend(); + g3.savetops(data_title + "double_diff_pseudorrange_error"); + + g3.showonscreen(); // window output + } + + //check results against the test tolerance + ASSERT_LT(rmse, 3.0); + ASSERT_LT(error_mean, 1.0); + ASSERT_GT(error_mean, -1.0); + ASSERT_LT(error_var, 10.0); + ASSERT_LT(max_error, 10.0); + ASSERT_GT(min_error, -10.0); + } + else + { + std::cout << "Problem with observables in " << data_title << std::endl; } - - //check results against the test tolerance - ASSERT_LT(rmse, 3.0); - ASSERT_LT(error_mean, 1.0); - ASSERT_GT(error_mean, -1.0); - ASSERT_LT(error_var, 10.0); - ASSERT_LT(max_error, 10.0); - ASSERT_GT(min_error, -10.0); } bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_Synchro gnss) @@ -1629,7 +1649,7 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S std::cout << "ReadRinexObs info:" << std::endl; for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++) { - std::cout << "SAT PRN " << gnss_synchro_vec.at(n).PRN << " RINEX epoch readed: " << obs_vec->at(n).n_rows << std::endl; + std::cout << "SAT PRN " << gnss_synchro_vec.at(n).PRN << " RINEX epoch read: " << obs_vec->at(n).n_rows << std::endl; } return true; } @@ -1981,7 +2001,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) int sat2_ch_id = -1; for (unsigned int ch = 0; ch < measured_obs_vec.size(); ch++) { - if (epoch_counters_vec.at(ch) > 10) //discard non-valid channels + if (epoch_counters_vec.at(ch) > 100) //discard non-valid channels { if (gnss_synchro_vec.at(ch).PRN == prn_pairs.at(n)) { @@ -2023,7 +2043,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) unsigned int min_pr_ch_id = 0; for (unsigned int n = 0; n < measured_obs_vec.size(); n++) { - if (epoch_counters_vec.at(n) > 10) //discard non-valid channels + if (epoch_counters_vec.at(n) > 100) //discard non-valid channels { { if (measured_obs_vec.at(n)(0, 4) < min_pr) @@ -2040,8 +2060,20 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } arma::vec receiver_time_offset_ref_channel_s; - receiver_time_offset_ref_channel_s = (true_obs_vec.at(min_pr_ch_id).col(1)(0) - measured_obs_vec.at(min_pr_ch_id).col(4)(0)) / GPS_C_M_S; - std::cout << "Ref. channel initial Receiver time offset " << receiver_time_offset_ref_channel_s(0) * 1e3 << " [ms]" << std::endl; + arma::uvec index2; + index2 = arma::find(true_obs_vec.at(min_pr_ch_id).col(0) >= measured_obs_vec.at(min_pr_ch_id).col(0)(0), 1, "first"); + if ((!index2.empty()) and (index2(0) > 0)) + { + receiver_time_offset_ref_channel_s = (true_obs_vec.at(min_pr_ch_id).col(1)(index2(0)) - measured_obs_vec.at(min_pr_ch_id).col(4)(0)) / GPS_C_M_S; + std::cout << "Ref. channel initial Receiver time offset " << receiver_time_offset_ref_channel_s(0) * 1e3 << " [ms]" << std::endl; + } + else + { + ASSERT_NO_THROW( + throw std::exception();) + << "Error finding observation time epoch in the reference data"; + } + for (unsigned int n = 0; n < measured_obs_vec.size(); n++) { @@ -2083,7 +2115,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) save_mat_xy(tmp_vector_x6, tmp_vector_y6, std::string("measured_cp_ch_" + std::to_string(n))); - if (epoch_counters_vec.at(n) > 10) //discard non-valid channels + if (epoch_counters_vec.at(n) > 100) //discard non-valid channels { arma::vec true_TOW_ref_ch_s = true_obs_vec.at(min_pr_ch_id).col(0) - receiver_time_offset_ref_channel_s(0); arma::vec true_TOW_ch_s = true_obs_vec.at(n).col(0) - receiver_time_offset_ref_channel_s(0); @@ -2097,7 +2129,6 @@ TEST_F(HybridObservablesTest, ValidationOfResults) measured_obs_vec.at(n), measured_obs_vec.at(min_pr_ch_id), "[CH " + std::to_string(n) + "] PRN " + std::to_string(gnss_synchro_vec.at(n).PRN) + " "); - //Do not compare E5a with E5 RINEX due to the Doppler frequency discrepancy caused by the different center frequencies //E5a_fc=1176.45e6, E5b_fc=1207.14e6, E5_fc=1191.795e6; if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or FLAGS_compare_with_5X) diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc index 96c0374a6..be6583874 100644 --- a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc @@ -1455,7 +1455,7 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn std::cout << "ReadRinexObs info:" << std::endl; for (unsigned int n = 0; n < gnss_synchro_vec.size(); n++) { - std::cout << "SAT PRN " << gnss_synchro_vec.at(n).PRN << " RINEX epoch readed: " << obs_vec->at(n).n_rows << std::endl; + std::cout << "SAT PRN " << gnss_synchro_vec.at(n).PRN << " RINEX epoch read: " << obs_vec->at(n).n_rows << std::endl; } return true; } diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc index eb586f147..647e7f245 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc @@ -29,12 +29,13 @@ */ #include "serdes_monitor_pvt.h" +#include TEST(Serdes_Monitor_Pvt_Test, Simpletest) { - Monitor_Pvt monitor = Monitor_Pvt(); + std::shared_ptr monitor = std::make_shared(Monitor_Pvt()); double true_latitude = 23.4; - monitor.latitude = true_latitude; + monitor->latitude = true_latitude; Serdes_Monitor_Pvt serdes = Serdes_Monitor_Pvt(); std::string serialized_data = serdes.createProtobuffer(monitor); diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc b/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc index d8ce67450..0f4c3ad47 100644 --- a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc @@ -39,10 +39,10 @@ #else #include #endif +#include "concurrent_queue.h" #include "direct_resampler_conditioner_cc.h" #include "gnss_sdr_valve.h" #include -#include TEST(DirectResamplerConditionerCcTest, InstantiationAndRunTest) @@ -52,7 +52,7 @@ TEST(DirectResamplerConditionerCcTest, InstantiationAndRunTest) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; //Number of samples to be computed - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); gr::top_block_sptr top_block = gr::make_top_block("direct_resampler_conditioner_cc_test"); boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc b/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc index 2bc26b8b4..acf888a0b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc @@ -37,10 +37,10 @@ #else #include #endif +#include "concurrent_queue.h" #include "gnss_sdr_valve.h" #include "mmse_resampler_conditioner.h" #include -#include TEST(MmseResamplerTest, InstantiationAndRunTestWarning) { @@ -49,7 +49,7 @@ TEST(MmseResamplerTest, InstantiationAndRunTestWarning) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; //Number of samples to be computed - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test"); boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); @@ -90,7 +90,7 @@ TEST(MmseResamplerTest, InstantiationAndRunTest2) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); int nsamples = 1000000; //Number of samples to be computed - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); gr::top_block_sptr top_block = gr::make_top_block("mmse_resampler_conditioner_cc_test"); boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0)); boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc b/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc index dd1020249..49ea2c244 100644 --- a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc @@ -30,15 +30,15 @@ */ #include "file_signal_source.h" +#include "concurrent_queue.h" #include "in_memory_configuration.h" -#include #include #include #include TEST(FileSignalSource, Instantiate) { - boost::shared_ptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); std::shared_ptr config = std::make_shared(); config->set_property("Test.samples", "0"); @@ -57,7 +57,7 @@ TEST(FileSignalSource, Instantiate) TEST(FileSignalSource, InstantiateFileNotExists) { - boost::shared_ptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); std::shared_ptr config = std::make_shared(); config->set_property("Test.samples", "0"); diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc b/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc index 02e1b09df..52e987bf3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc @@ -38,13 +38,14 @@ #else #include #endif +#include "concurrent_queue.h" #include "gnss_sdr_valve.h" #include -#include +#include TEST(ValveTest, CheckEventSentAfter100Samples) { - gr::msg_queue::sptr queue = gr::msg_queue::make(0); + std::shared_ptr> queue = std::make_shared>(); gr::top_block_sptr top_block = gr::make_top_block("gnss_sdr_valve_test"); @@ -52,8 +53,9 @@ TEST(ValveTest, CheckEventSentAfter100Samples) boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(float), 100, queue); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(float)); - unsigned int expected0 = 0; - EXPECT_EQ(expected0, queue->count()); + bool expected0 = false; + pmt::pmt_t msg; + EXPECT_EQ(expected0, queue->timed_wait_and_pop(msg, 100)); top_block->connect(source, 0, valve, 0); top_block->connect(valve, 0, sink, 0); @@ -61,6 +63,6 @@ TEST(ValveTest, CheckEventSentAfter100Samples) top_block->run(); top_block->stop(); - unsigned int expected1 = 1; - EXPECT_EQ(expected1, queue->count()); + bool expected1 = true; + EXPECT_EQ(expected1, queue->timed_wait_and_pop(msg, 100)); } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc index 6fa5f1da0..17b359077 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc @@ -1,6 +1,6 @@ /*! * \file bayesian_estimation_test.cc - * \brief This file implements feasability test for the BCE library. + * \brief This file implements feasibility test for the BCE library. * \author Gerald LaMountain, 2018. gerald(at)ece.neu.edu * * diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index 469ec2c27..0b2bdd9aa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -32,6 +32,7 @@ #include "galileo_e1_dll_pll_veml_tracking.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -41,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +68,7 @@ protected: void init(); - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -114,7 +114,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory @@ -161,7 +161,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults) int num_samples = 80000000; // 8 Msps unsigned int skiphead_sps = 8000000; // 8 Msps init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc index 122184eb7..92dae1d47 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc @@ -31,6 +31,7 @@ */ +#include "concurrent_queue.h" #include "galileo_e5a_dll_pll_tracking.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" @@ -41,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -69,7 +69,7 @@ protected: void init(); - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -110,7 +110,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults) int fs_in = 32000000; int nsamples = 32000000 * 5; init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); // Example using smart pointers and the block factory diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc index 003c63a9d..2a2e8d860 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc @@ -32,6 +32,7 @@ #include "glonass_l1_ca_dll_pll_c_aid_tracking.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -42,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -119,7 +119,7 @@ protected: void init(); - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -156,7 +156,7 @@ TEST_F(GlonassL1CaDllPllCAidTrackingTest, ValidationOfResults) int nsamples = fs_in * 4e-3 * 2; init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1G", 1, 1); boost::shared_ptr msg_rx = GlonassL1CaDllPllCAidTrackingTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc index 20a910ce4..be9128699 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc @@ -32,6 +32,7 @@ #include "glonass_l1_ca_dll_pll_tracking.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" @@ -42,7 +43,6 @@ #include #include #include -#include #include #include #include @@ -120,7 +120,7 @@ protected: void init(); - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -156,7 +156,7 @@ TEST_F(GlonassL1CaDllPllTrackingTest, ValidationOfResults) int nsamples = fs_in * 4e-3 * 2; init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1G", 1, 1); boost::shared_ptr msg_rx = GlonassL1CaDllPllTrackingTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index 411221e1e..cc9d9b12f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -1056,7 +1056,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) if (FLAGS_plot_gps_l1_tracking_test == true) { - std::cout << "Ploting performance metrics..." << std::endl; + std::cout << "Plotting performance metrics..." << std::endl; try { if (generator_CN0_values.size() > 1) diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index a640db425..2ace452e5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -31,18 +31,18 @@ */ +#include "gps_l2_m_dll_pll_tracking.h" +#include "concurrent_queue.h" #include "gnss_block_factory.h" #include "gnss_block_interface.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" -#include "gps_l2_m_dll_pll_tracking.h" #include "in_memory_configuration.h" #include "tracking_interface.h" #include #include #include #include -#include #include #include #include @@ -123,7 +123,7 @@ protected: void init(); - gr::msg_queue::sptr queue; + std::shared_ptr> queue; gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; @@ -160,7 +160,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults) int nsamples = fs_in * 9; init(); - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Tracking test"); std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_2S", 1, 1); boost::shared_ptr msg_rx = GpsL2MDllPllTrackingTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index fb38b8efa..164a2825a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -36,7 +36,7 @@ #include "Galileo_E1.h" #include "Galileo_E5a.h" #include "acquisition_msg_rx.h" -#include "control_message_factory.h" +#include "concurrent_queue.h" #include "galileo_e1_pcps_ambiguous_acquisition.h" #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" #include "galileo_e5a_pcps_acquisition.h" @@ -61,9 +61,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -229,7 +229,7 @@ public: Gnss_Synchro gnss_synchro; size_t item_size; - gr::msg_queue::sptr queue; + std::shared_ptr> queue; }; @@ -450,7 +450,7 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) System_and_Signal = "Galileo E5a"; config->set_property("Acquisition_5X.coherent_integration_time_ms", "1"); config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); - config->set_property("Acquisition.CAF_window_hz", "0"); // **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is desactivated. Recommended value 3000 Hz + config->set_property("Acquisition.CAF_window_hz", "0"); // **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is deactivated. Recommended value 3000 Hz config->set_property("Acquisition.Zero_padding", "0"); //**Only for E5a** Avoids power loss and doppler ambiguity in bit transitions by correlating one code with twice the input data length, ensuring that at least one full code is present without transitions. If set to 1 it is ON, if set to 0 it is OFF. config->set_property("Acquisition.bit_transition_flag", "false"); acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); @@ -795,14 +795,10 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // create the msg queue for valve - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); long long int acq_to_trk_delay_samples = ceil(static_cast(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s); auto resetable_valve_ = gnss_sdr_make_valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue, false); - std::shared_ptr control_message_factory_; - std::shared_ptr>> control_messages_; - - //CN0 LOOP std::vector> pull_in_results_v_v; @@ -883,15 +879,8 @@ TEST_F(TrackingPullInTest, ValidationOfResults) top_block->start(); std::cout << " Waiting for valve...\n"; //wait the valve message indicating the circulation of the amount of samples of the delay - gr::message::sptr queue_message = queue->delete_head(); - if (queue_message != nullptr) - { - control_messages_ = control_message_factory_->GetControlMessages(queue_message); - } - else - { - control_messages_->clear(); - } + pmt::pmt_t msg; + queue->wait_and_pop(msg); std::cout << " Starting tracking...\n"; tracking->start_tracking(); resetable_valve_->open_valve(); diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc index 4940f6082..7dbd89e91 100644 --- a/src/utils/front-end-cal/front_end_cal.cc +++ b/src/utils/front-end-cal/front_end_cal.cc @@ -385,7 +385,6 @@ void FrontEndCal::GPS_L1_front_end_model_E4000(double f_bb_true_Hz, double f_bb_ double f_rf_err = (f_bb_meas_Hz - f_bb_true_Hz) - f_bb_err_pll; double f_osc_err_hz = (f_rf_err * R) / (N + X / Y); - // OJO,segun los datos gnss, la IF positiva hace disminuir la fs!! f_osc_err_hz = -f_osc_err_hz; *f_osc_err_ppm = f_osc_err_hz / (f_osc_n / 1e6); diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 54723dfc5..696abfa6c 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -60,9 +60,8 @@ #include #include #include -#include // for gr_complex -#include // for io_signature -#include +#include // for gr_complex +#include // for io_signature #include // for block_sptr #include #include // for pmt_t, to_long @@ -189,9 +188,9 @@ bool front_end_capture(const std::shared_ptr& configurat { gr::top_block_sptr top_block; GNSSBlockFactory block_factory; - boost::shared_ptr queue; + std::shared_ptr> queue; - queue = gr::msg_queue::make(0); + queue = std::make_shared>(); top_block = gr::make_top_block("Acquisition test"); std::shared_ptr source; diff --git a/src/utils/rinex2assist/README.md b/src/utils/rinex2assist/README.md index 9d378d797..4708a3f87 100644 --- a/src/utils/rinex2assist/README.md +++ b/src/utils/rinex2assist/README.md @@ -10,7 +10,7 @@ This program is built along with GNSS-SDR if the options `ENABLE_UNIT_TESTING_EX ``` $ cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. $ make -$ sudo make intall +$ sudo make install ``` The last step is optional. Without it, you will get the executable at `../install/rinex2assist`.